From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbbGPDlV (ORCPT ); Wed, 15 Jul 2015 23:41:21 -0400 Received: from ozlabs.org ([103.22.144.67]:55915 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753441AbbGPDlU (ORCPT ); Wed, 15 Jul 2015 23:41:20 -0400 Message-ID: <1437018079.28475.5.camel@ellerman.id.au> Subject: Re: [RFC PATCH 11/12] selftests/seccomp: Make seccomp tests work on big endian From: Michael Ellerman To: Kees Cook Cc: "linuxppc-dev@ozlabs.org" , LKML , Andy Lutomirski , Will Drewry , strosake@linux.vnet.ibm.com, bogdan.purcareata@freescale.com Date: Thu, 16 Jul 2015 13:41:19 +1000 In-Reply-To: References: <1436945834-26660-1-git-send-email-mpe@ellerman.id.au> <1436945834-26660-11-git-send-email-mpe@ellerman.id.au> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-07-15 at 08:16 -0700, Kees Cook wrote: > On Wed, Jul 15, 2015 at 12:37 AM, Michael Ellerman wrote: > > 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