Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4900117ybi; Tue, 28 May 2019 04:29:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHOCOlmz1Q64jEgqanlaKE6fx06+6j68whm1hAOakgZ2sfZe7kRKvndOpBbUd8BHclCpK5 X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr25840035plb.150.1559042963853; Tue, 28 May 2019 04:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559042963; cv=none; d=google.com; s=arc-20160816; b=MONyDSJp2/m5mQdWdKJ0ed0nYFp7L7Lv1OHBRQL18J8ERzjX68qmCQLec6eDc8MArI J40+VbwVVc7kEGmjnNH3E3zq+4hiPSj503YV8CLImW0yQgMM13PdmpGJRX+Zi66WzZeR iTPYz6fD2rcEXEY0LAsIa27fMYraRb3Fu8eeIAsaFoIOlmNpAonsnaGor2lqGj0aM6QA LZRYJN4es9jE37BDtq249LBzte+Q8xGtNel9kv4w4kNngs1iegKLODfREOAIKED3uZRu mmC6+7fOIdHKB69whxhD5X4cLwEd2Z0GCvulcAlv0+XCltlcU03rBmhZ/KOeFOe5H1s9 zxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=n8mEOfFlOrFfQ5ADoq5IltTLDgmtoxRa6B+153SpHAE=; b=c55lPD32tb5YW8jy9EVsiI9swJrTSqw4q0SB59M2FLeBbtp0odBj1etUsCHftG8rnC THrUcdupuyBk/PEe9B6UgRq3Z/hS+D8b2yv8MYmWEzfRNi+b9dxrH8dfnuk0Lzbp45EN +r1lqmceaNKQBdk+iLD3Mvk8ydXD9N3iANi+WvljmbwgvV0HnmCh4cedPiIvU/1ym9uM LEz87nfw3lh6mnLy2/2bPNwR4FG8RNw8J9PF0PAs9Bua67Zk2qHMurPYqzT/fLR1avHS YNjjpPRq/1yAV7M58aWMlYlU3xSrfydJyvBAP617zAJi1tX5HsMWNMhqN9N+WZc1rS33 PQsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=cpeK2skt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si23268300plb.30.2019.05.28.04.29.07; Tue, 28 May 2019 04:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=cpeK2skt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfE1J6K (ORCPT + 99 others); Tue, 28 May 2019 05:58:10 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37609 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbfE1J6J (ORCPT ); Tue, 28 May 2019 05:58:09 -0400 Received: by mail-ot1-f67.google.com with SMTP id r10so17183208otd.4 for ; Tue, 28 May 2019 02:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=n8mEOfFlOrFfQ5ADoq5IltTLDgmtoxRa6B+153SpHAE=; b=cpeK2sktn7NMSf704YRsePZcwMV5rEfvSYWLdkbE0oo7SEPsGyf2Sg/RoHTcSoQfPd wKUtklR660LzAKMlYxgcivpoPmw+LSf5RppXvWNS6o1G0soFTMAvZUcbgBxvK2BECrI0 Rle3mXgyvD783k6/0SbYAStUQCihPJGyFt818iQ5hLWys0KtqDqC6rX9cnEeWCbwKNG0 tdk47Ttoh8A9F1CCaGanOIYDEl/ZdHErWc8Wv5KldYhEb6ofWf7dsBtFYzjTibWrsdhA MZ+zwyNHz+uR8reJwzBhLz8RLg8uhrkcEzyfZuKsJUXFqTqSWw3bOPqffMHHTUaHwhxW 1OcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=n8mEOfFlOrFfQ5ADoq5IltTLDgmtoxRa6B+153SpHAE=; b=W6XAbQtHubYwt7LkdVw3cwgdAg6TAwlDv6j9mT2Z6vlwFmb0+ADs9Co0O+IvdOCGCH wAm+1VT9uMqG4bEIFbT34auXsJvMyxqQrjocpb6C1b5J61m2D6Zx3Vk5wkrzaM1UWoxE vkLDiXnr2NfiVTtOq01+NIryR8jg1LozicL0sbL5NVn/3nzgc9CAYIIoCxaVKUbeVui8 TM4VdTzsaykXcF7ofk1PdiRMn/MzyntcoOsngK19f1v32v5EmLu82CjPss9KVOB4Wviz 2o9t2R8rPwH8JM8ooKDU74lA5GmJJnu7Nhu31lMH1OHK5/pR4TLWbEpqv4gNICktdF3x d0oA== X-Gm-Message-State: APjAAAVnvI3hJiL6mZVWUrOTvpud2tdNA+IzFUv4lm94pd256xZTwUIn RoA3ytLkU2ZYxE2XL/eEIGQoVQ== X-Received: by 2002:a05:6830:214f:: with SMTP id r15mr4126904otd.143.1559037489020; Tue, 28 May 2019 02:58:09 -0700 (PDT) Received: from brauner.io ([172.56.7.242]) by smtp.gmail.com with ESMTPSA id n187sm2440013oif.25.2019.05.28.02.57.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 28 May 2019 02:58:08 -0700 (PDT) Date: Tue, 28 May 2019 11:57:56 +0200 From: Christian Brauner 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 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> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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