Re: [PATCH V4 2/2] blktrace: allow access trace file in lockdown mode

From: Junxiao Bi
Date: Tue Apr 25 2023 - 14:01:27 EST


Any IO folks can help review this patch?

Paul needs a confirm from you that the information blktrace exporting to userspace through the relay files are safe, not leaking information that userspace shouldn't know in lockdown mode.

Thanks,

Junxiao.

On 4/20/23 2:53 PM, Junxiao Bi wrote:
blktrace trace files are per-cpu relay files that are used by kernel to
export IO metadata(IO events, type, target disk, offset and len etc.) to
userspace, no data from IO itself will be exported. Bypass lockdown for
these files will make blktrace work in lockdown mode.

Signed-off-by: Junxiao Bi <junxiao.bi@xxxxxxxxxx>
---
kernel/trace/blktrace.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d5d94510afd3..e1a9f8b7d710 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -490,10 +490,16 @@ static struct dentry *blk_create_buf_file_callback(const char *filename,
&relay_file_operations);
}
+static bool blk_bypass_lockdown(struct inode *inode)
+{
+ return true;
+}
+
static const struct rchan_callbacks blk_relay_callbacks = {
.subbuf_start = blk_subbuf_start_callback,
.create_buf_file = blk_create_buf_file_callback,
.remove_buf_file = blk_remove_buf_file_callback,
+ .bypass_lockdown = blk_bypass_lockdown,
};
static void blk_trace_setup_lba(struct blk_trace *bt,