Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30107696rwd; Thu, 6 Jul 2023 00:38:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxGOt1ZFcNqVOQoV4ebOgxprilQNoo4dzA9hV5+HGxphr6J/by+WgjNBaKxnkfbe/57nel X-Received: by 2002:a05:6a00:1390:b0:66a:5466:25b9 with SMTP id t16-20020a056a00139000b0066a546625b9mr1317963pfg.29.1688629122245; Thu, 06 Jul 2023 00:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688629122; cv=none; d=google.com; s=arc-20160816; b=w97Sy9Ux55bPppVlsk9s7Qj6FYNsgw3PHnJaXwxHdBHnkwnYPaAsPwzO/UTicENx8p hVzvhPrmROwc80hU8P0livIl83RFdM2OYn3HraM1Lc/LSa0Kya+bCw7mSfbeKjfbOPhj QJUldQegsv+56F0ojPzj5Kb/AxgD4g1YFSWwMU5e62N2Qfu8N0okMxaSwcpaQ6p28n7O Pe3DrgWLgGzkuQ07mcXz2yo1xaGvp5KYGKoFo/Ss9MWzgOdIsLa2EkSh/aFkfwh7pSHY MIMutEZ7ENXt/gU7zsDySssk50vSDhQ+hMrW1wGi0nlM4e0Rw1h7/tl855pdI6hac/r4 1YPg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aNtJ8EO6tgEourZrqW7hBHwB8NV3+0y9dkTPGDv1WMM=; fh=KZqTmVw0SQ//VT3OecTEC6u3B+2QqtV0JMvrj7BT3oE=; b=PWpRAlMuPJ1dZKaMo/23KAZXsO+j0JJUN/qpYLZu+w2V6McbxSRDjyjGoqQ9ZwWRR8 NcKhetrbTZ3PJcrIXHl7TwNX/6b1OP5dIIV+Kopv0Xd2hJtdAosWhr2byAIdCgKrQnq+ HmmSXHpUbaj564JIFvQdY+C509fKnTo4FiF1klosvE9fqw2jYqMaWk4EJcl4Icv1C8NV DNzyHM6MjLzAOxfsG65er5EA650jHXVpbasRjAMYiDkjqUnm/uUhLiG6DE4dCsA8AoVC 1hH/JmSFMLfp3KNSDFfavxTAwvHYpXGRYaSPBfieZ3lElkjEIt2gzSpxjl+o6+G0hGiC x/8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MAmbIVET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q25-20020a631f59000000b00557888b4eb9si936527pgm.622.2023.07.06.00.38.28; Thu, 06 Jul 2023 00:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MAmbIVET; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231706AbjGFHW5 (ORCPT + 99 others); Thu, 6 Jul 2023 03:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbjGFHWw (ORCPT ); Thu, 6 Jul 2023 03:22:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282451BDB; Thu, 6 Jul 2023 00:22:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EE6A618A2; Thu, 6 Jul 2023 07:22:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E585FC433C8; Thu, 6 Jul 2023 07:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688628145; bh=mTqcntv6zliRak8f606XrB+nqmgw/ljWWCMvyQDtXvY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MAmbIVETUw0vOf692rxyFJfdGnrGpcWcxdSoW0r9DoulOPBGqrh62lAt6ICkg5mkG YJ0+2FzdZTOv0qewcd64QRKEaoCVCmzy0P15ObXBGToG2a8Lt1Eg3SO7GCaVtr4g1r WiEf11Zqz/nB5kgOx+G8FHCSDpN8MDeRhsbgxjksisbxDMYGCQU5Srm14lbeuVKLs/ g2fv+8yYApJnVcBZK8AIG80F3SmOa7kz7AsNBGBxllGjfGTfFczSQWXPDI/y78+APW njQCKej9nbugXPCr/3tDJufqbHogE6sdalPYxyvK0xNhwMtvHCtmqL9Uf60/tbH/zO DKaXAwOtel/2g== Date: Thu, 6 Jul 2023 09:22:20 +0200 From: Christian Brauner To: Alexei Starovoitov Cc: Hou Tao , Alexey Gladkov , bpf , Linux-Fsdevel , LKML , Alexander Viro Subject: Re: [PATCH v1] fs: Add kfuncs to handle idmapped mounts Message-ID: <20230706-raffgierig-geeilt-7cea6d731194@brauner> References: <20230704-anrollen-beenden-9187c7b1b570@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 05, 2023 at 06:10:32PM -0700, Alexei Starovoitov wrote: > On Tue, Jul 4, 2023 at 6:01 AM Christian Brauner wrote: > > > > > > +/** > > > > + * bpf_is_idmapped_mnt - check whether a mount is idmapped > > > > + * @mnt: the mount to check > > > > + * > > > > + * Return: true if mount is mapped, false if not. > > > > + */ > > > > +__bpf_kfunc bool bpf_is_idmapped_mnt(struct vfsmount *mnt) > > > > +{ > > > > + return is_idmapped_mnt(mnt); > > > > +} > ... > > > > I don't want any of these helpers as kfuncs as they are peeking deeply > > into implementation details that we reserve to change. Specifically in > > the light of: > > > > 3. kfunc lifecycle expectations part b): > > > > "Unlike with regular kernel symbols, this is expected behavior for BPF > > symbols, and out-of-tree BPF programs that use kfuncs should be considered > > relevant to discussions and decisions around modifying and removing those > > kfuncs. The BPF community will take an active role in participating in > > upstream discussions when necessary to ensure that the perspectives of such > > users are taken into account." > > > > That's too much stability for my taste for these helpers. The helpers > > here exposed have been modified multiple times and once we wean off > > idmapped mounts from user namespaces completely they will change again. > > So I'm fine if they're traceable but not as kfuncs with any - even > > minimal - stability guarantees. > > Christian, > That quote is taken out of context. > In the first place the Documentation/bpf/kfuncs.rst says: > " > kfuncs provide a kernel <-> kernel API, and thus are not bound by any of the > strict stability restrictions associated with kernel <-> user UAPIs. This means > they can be thought of as similar to EXPORT_SYMBOL_GPL, and can therefore be > modified or removed by a maintainer of the subsystem they're defined in when > it's deemed necessary. > " > > bpf_get_file_vfs_ids is vfs related, so you guys decide when and how > to add/remove them. It's ok that you don't want this particular one > for whatever reason, but that reason shouldn't be 'stability guarantees'. > There are really none. The kernel kfuncs can change at any time. > There are plenty of examples in git log where we added and then > tweaked/removed kfuncs. > > The doc also says: > " > As described above, while sometimes a maintainer may find that a kfunc must be > changed or removed immediately to accommodate some changes in their subsystem, > " > and git log of such cases proves the point. > > The quote about out-of-tree bpf progs is necessary today, since > very few bpf progs are in-tree, so when maintainers of a subsystem > want to remove kfunc the program authors need something in the doc > to point to and explain why and how they use the kfunc otherwise > maintainers will just say 'go away. you're out-of-tree'. > The users need their voice to be heard. Even if the result is the same. > In other words the part you quoted is needed to make kfuncs usable. > Otherwise 'kfunc is 100% unstable and maintainers can rename it > every release just to make life of bpf prog writers harder' > becomes a real possibility in the minds of bpf users. > The kfunc doc makes it 100% clear that there are no stability guarantees. > So please don't say 'minimal stability'. > > In your other reply: > > > we can look at the in-kernel users of is_idmapped_mnt(), > > convert them and then kill this thing off if we wanted to. > > you can absolutely do that even if is_idmapped_mnt() is exposed as a kfunc. > You'll just delete it with zero notice if you like. > Just like what you would do with a normal export_symbol. > The doc is pretty clear about it and there are examples where we did > such things. I think I said it somewhere else: I'm not opposing your position on kfruncs in a sense I understand that's kinda the model that you have to push for. But you have to admit that this out-of-tree portion is very hard to swallow if you've been hit by out of tree modules and their complaints about removed EXPORT_SYMBOL*()s. I'm still rather hesitant about this because I find it hard to figure out how this will go down in practice. But, especially with the internal idmapped mount api. This is a very hidden and abstracted away implementation around an opaque type and I'm not yet ready to let modules or bpf programs peek into it's implementation details. I hope that's understandable.