blktrace: gate the blktrace interface behind CAP_SYS_ADMIN
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 0 repliesNew
- v11 patch 1 replySuperseded
Changes in v2 from the cover letter
- also gate the sysfs trace attribute group, which reached the same tracing state without any check (found in follow-up review)
- document the sysfs trace group in Documentation/ABI, where it has been missing since 2009
- gate the sg passthrough commands in a new patch; the v1 commit message mentioned the sg path but gated only blk_trace_ioctl() (flagged by sashiko's review of the first posting)
- commit messages now claim only what each patch covers
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | blktrace: require CAP_SYS_ADMIN for the blktrace interfaceDocumentation/ kernel/ | +24 | 0 replies | |
| 2/2 | scsi: sg: Require CAP_SYS_ADMIN for BLKTRACE passthrough ioctlsdrivers/ | +10 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] blktrace: gate the blktrace interface behind CAP_SYS_ADMIN
From: Tao Cui <[email protected]>
hello,
This series gates the blktrace interface behind CAP_SYS_ADMIN. BLKTRACESETUP allocates user-sized relay buffers and sets up traces that outlive the creating fd, but holding the block device node, an sg node, or write access to the sysfs trace attributes is the only requirement to drive that state today. Split by tree so each patch stays in one subsystem: patch 1 gates the block side (the ioctl dispatch and the sysfs store) and documents the sysfs attributes, patch 2 gates the sg passthrough. The two are independent and can be applied in any order; patch 1 should go through the block tree, patch 2 needs a SCSI Ack (taking both through block with the Ack works too).
Unprivileged callers get a single answer (-EPERM for the ioctls, -EACCES for the sysfs store) instead of values that revealed whether a trace existed and was running. With CONFIG_BLK_DEV_IO_TRACE=n the sg passthrough still returns -ENOTTY, as before. Privileged callers behave identically with and without the series.
Verified on next-20261104 under qemu: with the series applied, BLKTRACESETUP with all capabilities dropped is rejected with -EPERM through both /dev/sda and /dev/sg0, and a dropped-privilege write to the sysfs enable attribute is rejected with -EACCES; without the series the unprivileged ioctl and the sysfs write both succeed.
Base: next-20261104.
Changes since v1:
- also gate the sysfs trace attribute group, which reached the same tracing state without any check (found in follow-up review)
- document the sysfs trace group in Documentation/ABI, where it has been missing since 2009
- gate the sg passthrough commands in a new patch; the v1 commit message mentioned the sg path but gated only blk_trace_ioctl() (flagged by sashiko's review of the first posting)
- commit messages now claim only what each patch covers
Tao Cui (2):
blktrace: require CAP_SYS_ADMIN for the blktrace interface
scsi: sg: Require CAP_SYS_ADMIN for BLKTRACE passthrough ioctls
Documentation/ABI/stable/sysfs-block | 18 ++++++++++++++++++ drivers/scsi/sg.c | 10 ++++++++++ kernel/trace/blktrace.c | 6 ++++++ 3 files changed, 34 insertions(+)
Signature · 1 line
2.53.0