From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shuah Khan Subject: Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition Date: Tue, 22 Sep 2015 07:49:13 -0600 Message-ID: <56015C59.5010300@osg.samsung.com> References: <1442918756-17892-1-git-send-email-andre.przywara@arm.com> <1442918756-17892-3-git-send-email-andre.przywara@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1442918756-17892-3-git-send-email-andre.przywara-5wv7dgnIgG8@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andre Przywara , Andrea Arcangeli Cc: Andrew Morton , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pavel Emelyanov , Shuah Khan List-Id: linux-api@vger.kernel.org On 09/22/2015 04:45 AM, Andre Przywara wrote: > At the moment the userfaultfd test program only supports x86 and an > architecture called "powewrpc" ;-) > Fix that typo and add the syscall numbers for other architectures as > well. > Also as in an ideal world a syscall number should come from the system > header file , include that header and guard the explicit > syscall number section below to avoid redefinitions. > > Signed-off-by: Andre Przywara > --- > tools/testing/selftests/vm/userfaultfd.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c > index 2c7cca6..63be27f 100644 > --- a/tools/testing/selftests/vm/userfaultfd.c > +++ b/tools/testing/selftests/vm/userfaultfd.c > @@ -65,16 +65,27 @@ > #include > #include > #include "../../../../include/uapi/linux/userfaultfd.h" > +#include > > +/* ideally the above user header provides that number, but ... */ > +#ifndef __NR_userfaultfd > #ifdef __x86_64__ > #define __NR_userfaultfd 323 > #elif defined(__i386__) > #define __NR_userfaultfd 374 > -#elif defined(__powewrpc__) > +#elif defined(__powerpc__) > #define __NR_userfaultfd 364 > +#elif defined(__ia64__) > +#define __NR_userfaultfd 1343 > +#elif defined(__arm__) > +#define __NR_userfaultfd 388 > +#elif defined(__aarch64__) > +/* this is from the generic syscall table, used also on other architectures */ > +#define __NR_userfaultfd 283 > #else > #error "missing __NR_userfaultfd definition" > #endif > +#endif /* !__NR_userfaultfd */ > > static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; > > This is not okay. User-space shouldn't be (re)defining/duplicating syscall numbers. I can't take this patch. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org | (970) 217-8978 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933569AbbIVNtY (ORCPT ); Tue, 22 Sep 2015 09:49:24 -0400 Received: from lists.s-osg.org ([54.187.51.154]:38601 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933338AbbIVNtW (ORCPT ); Tue, 22 Sep 2015 09:49:22 -0400 Subject: Re: [PATCH 2/2] selftests/userfaultfd: improve syscall number definition To: Andre Przywara , Andrea Arcangeli References: <1442918756-17892-1-git-send-email-andre.przywara@arm.com> <1442918756-17892-3-git-send-email-andre.przywara@arm.com> Cc: Andrew Morton , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Pavel Emelyanov , Shuah Khan From: Shuah Khan Organization: Samsung Open Source Group Message-ID: <56015C59.5010300@osg.samsung.com> Date: Tue, 22 Sep 2015 07:49:13 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1442918756-17892-3-git-send-email-andre.przywara@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/22/2015 04:45 AM, Andre Przywara wrote: > At the moment the userfaultfd test program only supports x86 and an > architecture called "powewrpc" ;-) > Fix that typo and add the syscall numbers for other architectures as > well. > Also as in an ideal world a syscall number should come from the system > header file , include that header and guard the explicit > syscall number section below to avoid redefinitions. > > Signed-off-by: Andre Przywara > --- > tools/testing/selftests/vm/userfaultfd.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c > index 2c7cca6..63be27f 100644 > --- a/tools/testing/selftests/vm/userfaultfd.c > +++ b/tools/testing/selftests/vm/userfaultfd.c > @@ -65,16 +65,27 @@ > #include > #include > #include "../../../../include/uapi/linux/userfaultfd.h" > +#include > > +/* ideally the above user header provides that number, but ... */ > +#ifndef __NR_userfaultfd > #ifdef __x86_64__ > #define __NR_userfaultfd 323 > #elif defined(__i386__) > #define __NR_userfaultfd 374 > -#elif defined(__powewrpc__) > +#elif defined(__powerpc__) > #define __NR_userfaultfd 364 > +#elif defined(__ia64__) > +#define __NR_userfaultfd 1343 > +#elif defined(__arm__) > +#define __NR_userfaultfd 388 > +#elif defined(__aarch64__) > +/* this is from the generic syscall table, used also on other architectures */ > +#define __NR_userfaultfd 283 > #else > #error "missing __NR_userfaultfd definition" > #endif > +#endif /* !__NR_userfaultfd */ > > static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; > > This is not okay. User-space shouldn't be (re)defining/duplicating syscall numbers. I can't take this patch. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh@osg.samsung.com | (970) 217-8978