[PATCH 1/6] dtprobed: reject oversized DOF consistently
Kris Van Hees <[email protected]> Fri, 12 Jun 2026 16:20:18 +0000
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
The dtprobed ioctl handler warned when helper DOF exceeded the parser limit, but still attempted to allocate and copy it. Share DOF_MAXSZ with the parser and fail the ioctl when dofh_loadsz is too large, so both paths enforce the same 256MB limit. Orabug: 39351859 Signed-off-by: Kris Van Hees <[email protected]> --- dtprobed/dtprobed.c | 8 ++++---- libcommon/usdt_parser.c | 7 +++---- libcommon/usdt_parser.h | 2 ++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dtprobed/dtprobed.c b/dtprobed/dtprobed.c index 37d615bb..81b28e6d 100644 --- a/dtprobed/dtprobed.c +++ b/dtprobed/dtprobed.c @@ -69,7 +69,6 @@ #include "seccomp-assistance.h" -#define DOF_MAXSZ 512 * 1024 * 1024 #define DOF_CHUNKSZ 64 * 1024 static struct fuse_session *cuse_session; @@ -769,11 +768,12 @@ helper_ioctl(fuse_req_t req, int cmd, void *arg, } memcpy(&userdata->dof_hdr, in_buf, sizeof(dof_hdr_t)); - if (userdata->dof_hdr.dofh_loadsz > DOF_MAXSZ) - fuse_log(FUSE_LOG_WARNING, "%i: dtprobed: DOF size of %zi longer than is sane\n", + if (userdata->dof_hdr.dofh_loadsz > DOF_MAXSZ) { + fuse_log(FUSE_LOG_ERR, "%i: dtprobed: DOF size of %zi longer than is sane\n", pid, userdata->dof_hdr.dofh_loadsz); - /* Fall through. */ + goto fuse_err; + } } /* diff --git a/libcommon/usdt_parser.c b/libcommon/usdt_parser.c index 86419809..1dc2fffb 100644 --- a/libcommon/usdt_parser.c +++ b/libcommon/usdt_parser.c @@ -19,7 +19,6 @@ #include "usdt_parser.h" size_t usdt_maxcount = 2; -size_t usdt_maxsize = 256 * 1024 * 1024; _dt_printflike_(3, 4) void @@ -131,9 +130,9 @@ usdt_copyin_block(int in, int out, int *ok) abort(); /* Validate the data size. */ - if (data->size >= usdt_maxsize) { - usdt_error(out, E2BIG, "data size %zi exceeds maximum %zi", - data->size, usdt_maxsize); + if (data->size > DOF_MAXSZ) { + usdt_error(out, E2BIG, "data size %zi exceeds maximum %i", + data->size, DOF_MAXSZ); return NULL; } diff --git a/libcommon/usdt_parser.h b/libcommon/usdt_parser.h index d33370e4..b11207d1 100644 --- a/libcommon/usdt_parser.h +++ b/libcommon/usdt_parser.h @@ -15,6 +15,8 @@ #include <dtrace/dof.h> #include <dtrace/helpers.h> +#define DOF_MAXSZ (256 * 1024 * 1024) + /* * Data transfer unit for the DOF parser. */ -- 2.47.3