Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH 1/6] dtprobed: reject oversized DOF consistently
@ 2026-06-12 16:20 Kris Van Hees
  0 siblings, 0 replies; 3+ messages in thread
From: Kris Van Hees @ 2026-06-12 16:20 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/6] dtprobed: reject oversized DOF consistently
@ 2026-08-28 19:09 Kris Van Hees
  2026-08-28 21:58 ` [DTrace-devel] " Elena Zannoni
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Van Hees @ 2026-08-28 19:09 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [DTrace-devel] [PATCH 1/6] dtprobed: reject oversized DOF consistently
  2026-08-28 19:09 [PATCH 1/6] dtprobed: reject oversized DOF consistently Kris Van Hees
@ 2026-08-28 21:58 ` Elena Zannoni
  0 siblings, 0 replies; 3+ messages in thread
From: Elena Zannoni @ 2026-08-28 21:58 UTC (permalink / raw)
  To: Kris Van Hees, dtrace, dtrace-devel


Reviewed-by: Elena Zannoni <elena.zannoni@oracle.com>

On 8/28/26 1:09 PM, Kris Van Hees via DTrace-devel wrote:

> 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.52.0
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-28 21:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 19:09 [PATCH 1/6] dtprobed: reject oversized DOF consistently Kris Van Hees
2026-08-28 21:58 ` [DTrace-devel] " Elena Zannoni
  -- strict thread matches above, loose matches on Subject: below --
2026-06-12 16:20 Kris Van Hees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox