From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Brauner Subject: Re: [PATCH v2 2/2] tests: add close_range() tests Date: Tue, 28 May 2019 11:57:56 +0200 Message-ID: <20190528095754.peumcgjysw2nq24y@brauner.io> References: <20190523154747.15162-1-christian@brauner.io> <20190523154747.15162-3-christian@brauner.io> <8736kzqpdm.fsf@concordia.ellerman.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <8736kzqpdm.fsf@concordia.ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org To: Michael Ellerman Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, torvalds@linux-foundation.org, fweimer@redhat.com, jannh@google.com, oleg@redhat.com, tglx@linutronix.de, arnd@arndb.de, shuah@kernel.org, dhowells@redhat.com, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org List-Id: linux-arch.vger.kernel.org On Tue, May 28, 2019 at 12:33:41PM +1000, Michael Ellerman wrote: > Christian Brauner writes: > > This adds basic tests for the new close_range() syscall. > > - test that no invalid flags can be passed > > - test that a range of file descriptors is correctly closed > > - test that a range of file descriptors is correctly closed if there there > > are already closed file descriptors in the range > > - test that max_fd is correctly capped to the current fdtable maximum > > > > Signed-off-by: Christian Brauner > > Cc: Arnd Bergmann > > Cc: Jann Horn > > Cc: David Howells > > Cc: Dmitry V. Levin > > Cc: Oleg Nesterov > > Cc: Linus Torvalds > > Cc: Florian Weimer > > Cc: linux-api@vger.kernel.org > > --- > > v1: unchanged > > v2: > > - Christian Brauner : > > - verify that close_range() correctly closes a single file descriptor > > --- > > tools/testing/selftests/Makefile | 1 + > > tools/testing/selftests/core/.gitignore | 1 + > > tools/testing/selftests/core/Makefile | 6 + > > .../testing/selftests/core/close_range_test.c | 142 ++++++++++++++++++ > > 4 files changed, 150 insertions(+) > > create mode 100644 tools/testing/selftests/core/.gitignore > > create mode 100644 tools/testing/selftests/core/Makefile > > create mode 100644 tools/testing/selftests/core/close_range_test.c > > > > diff --git a/tools/testing/selftests/core/.gitignore b/tools/testing/selftests/core/.gitignore > > new file mode 100644 > > index 000000000000..6e6712ce5817 > > --- /dev/null > > +++ b/tools/testing/selftests/core/.gitignore > > @@ -0,0 +1 @@ > > +close_range_test > > diff --git a/tools/testing/selftests/core/Makefile b/tools/testing/selftests/core/Makefile > > new file mode 100644 > > index 000000000000..de3ae68aa345 > > --- /dev/null > > +++ b/tools/testing/selftests/core/Makefile > > @@ -0,0 +1,6 @@ > > +CFLAGS += -g -I../../../../usr/include/ -I../../../../include > > Your second -I pulls the unexported kernel headers in, userspace > programs shouldn't include unexported kernel headers. > > It breaks the build on powerpc with eg: > > powerpc64le-linux-gnu-gcc -g -I../../../../usr/include/ -I../../../../include close_range_test.c -o /output/kselftest/core/close_range_test > In file included from /usr/powerpc64le-linux-gnu/include/bits/fcntl-linux.h:346, > from /usr/powerpc64le-linux-gnu/include/bits/fcntl.h:62, > from /usr/powerpc64le-linux-gnu/include/fcntl.h:35, > from close_range_test.c:5: > ../../../../include/linux/falloc.h:13:2: error: unknown type name '__s16' > __s16 l_type; > ^~~~~ > > > Did you do that on purpose or just copy it from one of the other > Makefiles? :) I originally did that on purpose because checkpatch was yammering on about me not having used ARRAY_SIZE(). But that include can go, you are right. Christian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-f66.google.com ([209.85.210.66]:43817 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726706AbfE1J6K (ORCPT ); Tue, 28 May 2019 05:58:10 -0400 Received: by mail-ot1-f66.google.com with SMTP id i8so17153609oth.10 for ; Tue, 28 May 2019 02:58:09 -0700 (PDT) Date: Tue, 28 May 2019 11:57:56 +0200 From: Christian Brauner Subject: Re: [PATCH v2 2/2] tests: add close_range() tests Message-ID: <20190528095754.peumcgjysw2nq24y@brauner.io> References: <20190523154747.15162-1-christian@brauner.io> <20190523154747.15162-3-christian@brauner.io> <8736kzqpdm.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8736kzqpdm.fsf@concordia.ellerman.id.au> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Michael Ellerman Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, torvalds@linux-foundation.org, fweimer@redhat.com, jannh@google.com, oleg@redhat.com, tglx@linutronix.de, arnd@arndb.de, shuah@kernel.org, dhowells@redhat.com, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org Message-ID: <20190528095756.7E2a3XtYGEOFFPFG13X2cbNSAdB2evOjUbdnfZt7UHc@z> On Tue, May 28, 2019 at 12:33:41PM +1000, Michael Ellerman wrote: > Christian Brauner writes: > > This adds basic tests for the new close_range() syscall. > > - test that no invalid flags can be passed > > - test that a range of file descriptors is correctly closed > > - test that a range of file descriptors is correctly closed if there there > > are already closed file descriptors in the range > > - test that max_fd is correctly capped to the current fdtable maximum > > > > Signed-off-by: Christian Brauner > > Cc: Arnd Bergmann > > Cc: Jann Horn > > Cc: David Howells > > Cc: Dmitry V. Levin > > Cc: Oleg Nesterov > > Cc: Linus Torvalds > > Cc: Florian Weimer > > Cc: linux-api@vger.kernel.org > > --- > > v1: unchanged > > v2: > > - Christian Brauner : > > - verify that close_range() correctly closes a single file descriptor > > --- > > tools/testing/selftests/Makefile | 1 + > > tools/testing/selftests/core/.gitignore | 1 + > > tools/testing/selftests/core/Makefile | 6 + > > .../testing/selftests/core/close_range_test.c | 142 ++++++++++++++++++ > > 4 files changed, 150 insertions(+) > > create mode 100644 tools/testing/selftests/core/.gitignore > > create mode 100644 tools/testing/selftests/core/Makefile > > create mode 100644 tools/testing/selftests/core/close_range_test.c > > > > diff --git a/tools/testing/selftests/core/.gitignore b/tools/testing/selftests/core/.gitignore > > new file mode 100644 > > index 000000000000..6e6712ce5817 > > --- /dev/null > > +++ b/tools/testing/selftests/core/.gitignore > > @@ -0,0 +1 @@ > > +close_range_test > > diff --git a/tools/testing/selftests/core/Makefile b/tools/testing/selftests/core/Makefile > > new file mode 100644 > > index 000000000000..de3ae68aa345 > > --- /dev/null > > +++ b/tools/testing/selftests/core/Makefile > > @@ -0,0 +1,6 @@ > > +CFLAGS += -g -I../../../../usr/include/ -I../../../../include > > Your second -I pulls the unexported kernel headers in, userspace > programs shouldn't include unexported kernel headers. > > It breaks the build on powerpc with eg: > > powerpc64le-linux-gnu-gcc -g -I../../../../usr/include/ -I../../../../include close_range_test.c -o /output/kselftest/core/close_range_test > In file included from /usr/powerpc64le-linux-gnu/include/bits/fcntl-linux.h:346, > from /usr/powerpc64le-linux-gnu/include/bits/fcntl.h:62, > from /usr/powerpc64le-linux-gnu/include/fcntl.h:35, > from close_range_test.c:5: > ../../../../include/linux/falloc.h:13:2: error: unknown type name '__s16' > __s16 l_type; > ^~~~~ > > > Did you do that on purpose or just copy it from one of the other > Makefiles? :) I originally did that on purpose because checkpatch was yammering on about me not having used ARRAY_SIZE(). But that include can go, you are right. Christian