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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 EA9C5C433ED for ; Sat, 17 Apr 2021 04:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5D806108F for ; Sat, 17 Apr 2021 04:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbhDQEFD (ORCPT ); Sat, 17 Apr 2021 00:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhDQEFD (ORCPT ); Sat, 17 Apr 2021 00:05:03 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 021F5C061574; Fri, 16 Apr 2021 21:04:37 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lXcC4-005wRq-R6; Sat, 17 Apr 2021 04:04:29 +0000 Date: Sat, 17 Apr 2021 04:04:28 +0000 From: Al Viro To: Alexei Starovoitov Cc: "David S. Miller" , Daniel Borkmann , Andrii Nakryiko , Network Development , bpf , Kernel Team Subject: Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper. Message-ID: References: <20210417033224.8063-1-alexei.starovoitov@gmail.com> <20210417033224.8063-12-alexei.starovoitov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, Apr 16, 2021 at 08:46:05PM -0700, Alexei Starovoitov wrote: > On Fri, Apr 16, 2021 at 8:42 PM Al Viro wrote: > > > > On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > > > From: Alexei Starovoitov > > > > > > Add bpf_sys_close() helper to be used by the syscall/loader program to close > > > intermediate FDs and other cleanup. > > > > Conditional NAK. In a lot of contexts close_fd() is very much unsafe. > > In particular, anything that might call it between fdget() and fdput() > > is Right Fucking Out(tm). > > In which contexts can that thing be executed? > > user context only. > It's not for all of bpf _obviously_. Let me restate the question: what call chains could lead to bpf_sys_close()?