Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp296817pxu; Fri, 4 Dec 2020 03:38:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVHR2i/CAMowfRtTAm1ebt8DZJzSn7ddKgCVCDQLj+YwgoZC1HS2PLrKo0lbHMHGc4j+/v X-Received: by 2002:a05:6402:8d9:: with SMTP id d25mr6933785edz.278.1607081886850; Fri, 04 Dec 2020 03:38:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607081886; cv=none; d=google.com; s=arc-20160816; b=tEo4i7M5ak0vmWIwb7CwVxoo8BeyV9MEvpC9t8ADA00C0rKDAqn5F2sg4OJTsyvnAQ R4UrvGMhi+jU4ycxuJLn9o1iaFTQv/PNHop970YHFQy9Wp80lUE0h78V8OJ8ZbDnAEGp bs+elrv9iT5a3vzZEVwAw9tZvjG/YSZIhm5Qcp311muQ8beAr+eNbLdja2vDquEnTRuu 5iguraiuNN9K1zgDX3mXkco7UONyPX41cCTlg8/oo+6q4N8EhUzY6cx1m/r6LKAi7nIc Xx3aSLiMSR3ipXaijIeI/Auy/M0W4qeadmMN/HJSCdgRM3yLDWCxjA9/t9IsrbuE6F3H 2Umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vIGRGaqzDW7ClA3aSoEbiP9gK8Hn6CuCHeGJqvTzqGc=; b=MA1FrXD4uCRkZkoc6ZCmifi1zwkxjXpa65k9wXoKARyXJzAJXq1iehFzFcEhCaBl7w w3ZYvUKuxHkLDIl0yo+NEbjyh51+KqgycYCGMt1LcTEShVTISHuIMujVdNdRsV0n/zF9 JIVv8183le6BJAwvdXHCoLihhcI+4O7uJ8mn2lxl0+4rWtO1iIVzpu3ywQlB4rMInSxI oJXBlXWLcKNq+NK4p/4Fq/rnpn2ntFIaCGPOCsq9DNWqXLBlxh3s9XDUPYSNBlB2doS/ Sj2BLeusOk0HxOtloWeY+kkHXyAY7yycSqXN6U0fbpUwzOyjCN3emmr2phWXp0jEu0YQ aBjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si689292edw.349.2020.12.04.03.37.35; Fri, 04 Dec 2020 03:38:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387809AbgLDLdW (ORCPT + 99 others); Fri, 4 Dec 2020 06:33:22 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60892 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgLDLdV (ORCPT ); Fri, 4 Dec 2020 06:33:21 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kl9KJ-0007oZ-7k; Fri, 04 Dec 2020 11:32:39 +0000 Date: Fri, 4 Dec 2020 12:32:38 +0100 From: Christian Brauner To: Giuseppe Scrivano Cc: linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org Subject: Re: [PATCH v3 0/2] fs, close_range: add flag CLOSE_RANGE_CLOEXEC Message-ID: <20201204113238.bazik6j3p7v5g2ak@wittgenstein> References: <20201118104746.873084-1-gscrivan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201118104746.873084-1-gscrivan@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 18, 2020 at 11:47:44AM +0100, Giuseppe Scrivano wrote: > When the new flag is used, close_range will set the close-on-exec bit > for the file descriptors instead of close()-ing them. > > It is useful for e.g. container runtimes that want to minimize the > number of syscalls used after a seccomp profile is installed but want > to keep some fds open until the container process is executed. > > v3: > - fixed indentation > - selftests: use ASSERT_EQ instead of EXPECT_EQ for hard failures > > v2: https://lkml.kernel.org/lkml/20201019102654.16642-1-gscrivan@redhat.com/ > - move close_range(..., CLOSE_RANGE_CLOEXEC) implementation to a separate function. > - use bitmap_set() to set the close-on-exec bits in the bitmap. > - add test with rlimit(RLIMIT_NOFILE) in place. > - use "cur_max" that is already used by close_range(..., 0). > > v1: https://lkml.kernel.org/lkml/20201013140609.2269319-1-gscrivan@redhat.com/ > > Giuseppe Scrivano (2): > fs, close_range: add flag CLOSE_RANGE_CLOEXEC > selftests: core: add tests for CLOSE_RANGE_CLOEXEC > > fs/file.c | 44 ++++++++--- > include/uapi/linux/close_range.h | 3 + > .../testing/selftests/core/close_range_test.c | 74 +++++++++++++++++++ > 3 files changed, 111 insertions(+), 10 deletions(-) I've picked this up and stuffed it into -next. This solves a real problem and I don't want it to sit around another merge window. (If you pick it up later I'll simply drop it, Al.) Christian