fuse: don't fill in.h.pid in case args->nocreds is set
PATCH 1/1 fuse: don't fill in.h.pid in case args->nocreds is set
Commit 794e811d1443 ("fuse: split out filesystem part of request sending") alters the pid sent on force && nocreds requests.
Previously these allocated a zeroed request and skipped fuse_force_creds(), so they went out with in.h.pid == 0.
In fuse_fill_creds(), args->pid is now set before the nocreds early return, and fuse_args_to_req() copies it unconditionally - so writeback, release, and DESTROY requests now report the triggering (often kernel-worker) pid instead of 0.
Move the nocreds check above setting args->pid. Also remove the WARN_ON(!args->nocreds) from the !args->force branch, since it's obviously not going to be triggered.
Reported-by David CARLIER <[email protected]>
Closes https://lore.kernel.org/all/CA+XhMqye_NBihcadRTU=w4xAfrdY9rsMB3oHF5+bwHukkjHMoQ@mail.gmail.com/ open here
Fixes 794e811d1443 ("fuse: split out filesystem part of request sending")
Signed-off-by Miklos Szeredi <[email protected]>
--- fs/fuse/req.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/fuse/req.c +3 -4
@@ -10,12 +10,12 @@ static int fuse_fill_creds(struct fuse_mount *fm, struct fuse_args *args, structkuid_t fsuid =mapped_fsuid (idmap, fc->user_ns);kgid_t fsgid =mapped_fsgid (idmap, fc->user_ns); +if (args->nocreds) +return 0 ; + args->pid =pid_nr_ns (task_pid (current), fc->pid_ns);if (args->force) { -if (args->nocreds) -return 0 ; -if (no_idmap) { args->uid =from_kuid_munged (fc->user_ns,current_fsuid ()); args->gid =from_kgid_munged (fc->user_ns,current_fsgid ());
@@ -26,7 +26,6 @@ static int fuse_fill_creds(struct fuse_mount *fm, struct fuse_args *args, structreturn 0 ; } -WARN_ON (args->nocreds);/* * Keep the old behavior when idmappings support was not * declared by a FUSE server.
Signature · 1 line
2.54.0