Thread (20 messages) flat view 20 messages, 3 authors, 2015-07-17

Re: [RFC PATCH 11/12] selftests/seccomp: Make seccomp tests work on big endian

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-07-16 03:41:21
Also in: lkml

On Wed, 2015-07-15 at 08:16 -0700, Kees Cook wrote:
On Wed, Jul 15, 2015 at 12:37 AM, Michael Ellerman [off-list ref] wrote:
quoted
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index b2374c131340..51adb9afb511 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -82,7 +82,13 @@ struct seccomp_data {
 };
 #endif

+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define syscall_arg(_n) (offsetof(struct seccomp_data, args[_n]))
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define syscall_arg(_n) (offsetof(struct seccomp_data, args[_n]) + sizeof(__u32))
+#else
+#error "wut?"
+#endif
Ah-ha! Yes, thanks. Could you change the #error to something that
describes the particular (impossible) failure condition? "wut? Unknown
__BYTE_ORDER?!". Not a huge deal, but I always like verbose errors. :)
Especially for "impossible" situations. :)
Yeah sorry that was a "quick hack" which got promoted into an actual patch.

Fixed to use your message.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help