Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 1/6] dtprobed: reject oversized DOF consistently
Date: Fri, 12 Jun 2026 16:20:18 +0000	[thread overview]
Message-ID: <6a4ed09d8c3ecde2a214c5dc73c76781@oracle.com> (raw)

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 <kris.van.hees@oracle.com>
---
 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


                 reply	other threads:[~2026-06-12 16:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a4ed09d8c3ecde2a214c5dc73c76781@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox