Message ID | 20241125-work-cred-v2-0-68b9d38bb5b2@kernel.org |
---|---|
Headers | show |
Series | cred: rework {override,revert}_creds() | expand |
On Mon, Nov 25, 2024 at 03:09:56PM +0100, Christian Brauner wrote: > For the v6.13 cycle we switched overlayfs to a variant of > override_creds() that doesn't take an extra reference. To this end I > suggested introducing {override,revert}_creds_light() which overlayfs > could use. > > This seems to work rather well. This series follow Linus advice and > unifies the separate helpers and simply makes {override,revert}_creds() > do what {override,revert}_creds_light() currently does. Caller's that > really need the extra reference count can take it manually. > > --- > Changes in v2: > - Remove confusion around dangling pointer. > - Use the revert_creds(old) + put_cred(new) pattern instead of > put_cred(revert_creds(old)). > - Fill in missing justifications in various commit message why not using > a separate reference count is safe. > - Make get_new_cred() argument const to easily use it during the > conversion. > - Get rid of get_new_cred() completely at the end of the series. > - Link to v1: https://lore.kernel.org/r/20241124-work-cred-v1-0-f352241c3970@kernel.org > > --- > Christian Brauner (29): > tree-wide: s/override_creds()/override_creds_light(get_new_cred())/g > cred: return old creds from revert_creds_light() > tree-wide: s/revert_creds()/put_cred(revert_creds_light())/g > cred: remove old {override,revert}_creds() helpers > tree-wide: s/override_creds_light()/override_creds()/g > tree-wide: s/revert_creds_light()/revert_creds()/g > firmware: avoid pointless reference count bump > sev-dev: avoid pointless cred reference count bump > target_core_configfs: avoid pointless cred reference count bump > aio: avoid pointless cred reference count bump > binfmt_misc: avoid pointless cred reference count bump > coredump: avoid pointless cred reference count bump > nfs/localio: avoid pointless cred reference count bumps > nfs/nfs4idmap: avoid pointless reference count bump > nfs/nfs4recover: avoid pointless cred reference count bump > nfsfh: avoid pointless cred reference count bump > open: avoid pointless cred reference count bump > ovl: avoid pointless cred reference count bump > cifs: avoid pointless cred reference count bump > cifs: avoid pointless cred reference count bump > smb: avoid pointless cred reference count bump > io_uring: avoid pointless cred reference count bump > acct: avoid pointless reference count bump > cgroup: avoid pointless cred reference count bump > trace: avoid pointless cred reference count bump > dns_resolver: avoid pointless cred reference count bump > cachefiles: avoid pointless cred reference count bump > nfsd: avoid pointless cred reference count bump > cred: remove unused get_new_cred() > > Documentation/security/credentials.rst | 5 ---- > drivers/crypto/ccp/sev-dev.c | 2 +- > fs/backing-file.c | 20 +++++++------- > fs/nfsd/auth.c | 3 +- > fs/nfsd/filecache.c | 2 +- > fs/nfsd/nfs4recover.c | 3 +- > fs/nfsd/nfsfh.c | 1 - > fs/open.c | 11 ++------ > fs/overlayfs/dir.c | 4 +-- > fs/overlayfs/util.c | 4 +-- > fs/smb/server/smb_common.c | 10 ++----- > include/linux/cred.h | 26 ++++-------------- > kernel/cred.c | 50 ---------------------------------- > 13 files changed, 27 insertions(+), 114 deletions(-) > --- > base-commit: e7675238b9bf4db0b872d5dbcd53efa31914c98f > change-id: 20241124-work-cred-349b65450082 > > For the patches that touch fs/nfsd/*: Acked-by: Chuck Lever <chuck.lever@oracle.com>
On Mon, 25 Nov 2024 at 06:10, Christian Brauner <brauner@kernel.org> wrote: > > Changes in v2: Thanks, everything looks really good to me, this is much better than our old refcount thing. Linus
On Mon, 25 Nov 2024 15:09:56 +0100, Christian Brauner wrote: > For the v6.13 cycle we switched overlayfs to a variant of > override_creds() that doesn't take an extra reference. To this end I > suggested introducing {override,revert}_creds_light() which overlayfs > could use. > > This seems to work rather well. This series follow Linus advice and > unifies the separate helpers and simply makes {override,revert}_creds() > do what {override,revert}_creds_light() currently does. Caller's that > really need the extra reference count can take it manually. > > [...] Applied to the kernel.cred branch of the vfs/vfs.git tree. Patches in the kernel.cred branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: kernel.cred [01/29] tree-wide: s/override_creds()/override_creds_light(get_new_cred())/g https://git.kernel.org/vfs/vfs/c/166096e12ea2 [02/29] cred: return old creds from revert_creds_light() https://git.kernel.org/vfs/vfs/c/0f8b3bd1b3cc [03/29] tree-wide: s/revert_creds()/put_cred(revert_creds_light())/g https://git.kernel.org/vfs/vfs/c/eb194f385c7a [04/29] cred: remove old {override,revert}_creds() helpers https://git.kernel.org/vfs/vfs/c/eeb9c41696a9 [05/29] tree-wide: s/override_creds_light()/override_creds()/g https://git.kernel.org/vfs/vfs/c/8b9b75bc7a7f [06/29] tree-wide: s/revert_creds_light()/revert_creds()/g https://git.kernel.org/vfs/vfs/c/5e0c1ca92141 [07/29] firmware: avoid pointless reference count bump https://git.kernel.org/vfs/vfs/c/0fc8b46c9698 [08/29] sev-dev: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/6fb26cb0712b [09/29] target_core_configfs: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/2a7cf8f44396 [10/29] aio: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/01d3402ff15e [11/29] binfmt_misc: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/0d80b0eeca95 [12/29] coredump: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/1c51da6bee5b [13/29] nfs/localio: avoid pointless cred reference count bumps https://git.kernel.org/vfs/vfs/c/b5c4d8852ca4 [14/29] nfs/nfs4idmap: avoid pointless reference count bump https://git.kernel.org/vfs/vfs/c/5549222d7969 [15/29] nfs/nfs4recover: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/95c7b08dc110 [16/29] nfsfh: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/9b7d4076e164 [17/29] open: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/a58084535085 [18/29] ovl: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/70545c2bb39e [19/29] cifs: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/2225ba3d36a0 [20/29] cifs: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/2225ba3d36a0 [21/29] smb: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/55545232890f [22/29] io_uring: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/bf8820866809 [23/29] acct: avoid pointless reference count bump https://git.kernel.org/vfs/vfs/c/11c99d734a22 [24/29] cgroup: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/f9844cf85703 [25/29] trace: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/5f10fe797c1d [26/29] dns_resolver: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/97f0beb2aa35 [27/29] cachefiles: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/b25b2b31265a [28/29] nfsd: avoid pointless cred reference count bump https://git.kernel.org/vfs/vfs/c/c45990a2e032 [29/29] cred: remove unused get_new_cred() https://git.kernel.org/vfs/vfs/c/d9bf032c76d9
On 11/25/24 7:09 AM, Christian Brauner wrote: > For the v6.13 cycle we switched overlayfs to a variant of > override_creds() that doesn't take an extra reference. To this end I > suggested introducing {override,revert}_creds_light() which overlayfs > could use. > > This seems to work rather well. This series follow Linus advice and > unifies the separate helpers and simply makes {override,revert}_creds() > do what {override,revert}_creds_light() currently does. Caller's that > really need the extra reference count can take it manually. Nice cleanup, looks good to me: Reviewed-by: Jens Axboe <axboe@kernel.dk>