[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169811742.1426244.10176905147897769604.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 17:55:38 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, miklos@...redi.hu
Cc: joannelkoong@...il.com, bernd@...ernd.com, neal@...pa.dev,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 7/9] fuse_trace: let the kernel handle KILL_SUID/KILL_SGID for
iomap filesystems
From: Darrick J. Wong <djwong@...nel.org>
Add tracepoints for the previous patch.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
fs/fuse/fuse_trace.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
fs/fuse/dir.c | 5 ++++
2 files changed, 63 insertions(+)
diff --git a/fs/fuse/fuse_trace.h b/fs/fuse/fuse_trace.h
index 817bb6a5d3a961..c4bf5a70594cf6 100644
--- a/fs/fuse/fuse_trace.h
+++ b/fs/fuse/fuse_trace.h
@@ -205,6 +205,64 @@ DEFINE_EVENT(fuse_fileattr_class, name, \
DEFINE_FUSE_FILEATTR_EVENT(fuse_fileattr_update_inode);
DEFINE_FUSE_FILEATTR_EVENT(fuse_fileattr_init);
+TRACE_EVENT(fuse_setattr_fill,
+ TP_PROTO(const struct inode *inode,
+ const struct fuse_setattr_in *inarg),
+ TP_ARGS(inode, inarg),
+
+ TP_STRUCT__entry(
+ FUSE_INODE_FIELDS
+ __field(umode_t, mode)
+ __field(uint32_t, valid)
+ __field(umode_t, new_mode)
+ __field(uint64_t, new_size)
+ ),
+
+ TP_fast_assign(
+ FUSE_INODE_ASSIGN(inode, fi, fm);
+ __entry->mode = inode->i_mode;
+ __entry->valid = inarg->valid;
+ __entry->new_mode = inarg->mode;
+ __entry->new_size = inarg->size;
+ ),
+
+ TP_printk(FUSE_INODE_FMT " mode 0%o valid 0x%x new_mode 0%o new_size 0x%llx",
+ FUSE_INODE_PRINTK_ARGS,
+ __entry->mode,
+ __entry->valid,
+ __entry->new_mode,
+ __entry->new_size)
+);
+
+TRACE_EVENT(fuse_setattr,
+ TP_PROTO(const struct inode *inode,
+ const struct iattr *inarg),
+ TP_ARGS(inode, inarg),
+
+ TP_STRUCT__entry(
+ FUSE_INODE_FIELDS
+ __field(umode_t, mode)
+ __field(uint32_t, valid)
+ __field(umode_t, new_mode)
+ __field(uint64_t, new_size)
+ ),
+
+ TP_fast_assign(
+ FUSE_INODE_ASSIGN(inode, fi, fm);
+ __entry->mode = inode->i_mode;
+ __entry->valid = inarg->ia_valid;
+ __entry->new_mode = inarg->ia_mode;
+ __entry->new_size = inarg->ia_size;
+ ),
+
+ TP_printk(FUSE_INODE_FMT " mode 0%o valid 0x%x new_mode 0%o new_size 0x%llx",
+ FUSE_INODE_PRINTK_ARGS,
+ __entry->mode,
+ __entry->valid,
+ __entry->new_mode,
+ __entry->new_size)
+);
+
#ifdef CONFIG_FUSE_BACKING
#define FUSE_BACKING_FLAG_STRINGS \
{ FUSE_BACKING_TYPE_PASSTHROUGH, "pass" }, \
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 9435d6b8d14ea4..4fc66ff0231089 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -7,6 +7,7 @@
*/
#include "fuse_i.h"
+#include "fuse_trace.h"
#include <linux/pagemap.h>
#include <linux/file.h>
@@ -1995,6 +1996,8 @@ static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_args *args,
struct fuse_setattr_in *inarg_p,
struct fuse_attr_out *outarg_p)
{
+ trace_fuse_setattr_fill(inode, inarg_p);
+
args->opcode = FUSE_SETATTR;
args->nodeid = get_node_id(inode);
args->in_numargs = 1;
@@ -2270,6 +2273,8 @@ static int fuse_setattr(struct mnt_idmap *idmap, struct dentry *entry,
if (!fuse_allow_current_process(get_fuse_conn(inode)))
return -EACCES;
+ trace_fuse_setattr(inode, attr);
+
if (!is_iomap &&
(attr->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))) {
attr->ia_valid &= ~(ATTR_KILL_SUID | ATTR_KILL_SGID |
Powered by blists - more mailing lists