From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C47BC4361B for ; Mon, 7 Dec 2020 23:37:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04A6423998 for ; Mon, 7 Dec 2020 23:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727893AbgLGXgq (ORCPT ); Mon, 7 Dec 2020 18:36:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbgLGXgq (ORCPT ); Mon, 7 Dec 2020 18:36:46 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3009C061793; Mon, 7 Dec 2020 15:36:05 -0800 (PST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmQ2w-00HHlG-RR; Mon, 07 Dec 2020 23:35:58 +0000 Date: Mon, 7 Dec 2020 23:35:58 +0000 From: Al Viro To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, criu@openvz.org, bpf@vger.kernel.org, Linus Torvalds , Christian Brauner , Oleg Nesterov , Cyrill Gorcunov , Jann Horn , Kees Cook , Daniel P =?iso-8859-1?Q?=2E_Berrang=E9?= , Jeff Layton , Miklos Szeredi , Matthew Wilcox , "J. Bruce Fields" , Trond Myklebust , Chris Wright , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh Subject: Re: [PATCH v2 01/24] exec: Move unshare_files to fix posix file locking during exec Message-ID: <20201207233558.GE3579531@ZenIV.linux.org.uk> References: <87r1on1v62.fsf@x220.int.ebiederm.org> <20201120231441.29911-1-ebiederm@xmission.com> <20201207222214.GA4115853@ZenIV.linux.org.uk> <87zh2pusdw.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zh2pusdw.fsf@x220.int.ebiederm.org> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Dec 07, 2020 at 05:07:55PM -0600, Eric W. Biederman wrote: > My mistake. I missed that the actual code was highly optimized and only > safe in the presence of an unshared files struct. That's a polite way to spell "overoptimized for no good reason" ;-) > What I saw and what I thought the comment was talking about was that the > result of the test isn't guaranteed to be stable without having an > exclusive access to the files. I figured and if something changes later > and it becomes safe to pass the file name to a script later we don't > really care. > > In any event thank you for the review. I will queue up a follow on > patch that makes this use get_close_on_exec. I would rather put that switch to get_close_on_exec() first in the queue (or fold it into this patch)...