[DTrace-devel] [PATCH] Impose temporary limit of 256 bytes on memcpy()

Eugene Loh eugene.loh at oracle.com
Thu Jun 17 09:45:47 PDT 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
... but just out of a sense of expediency, which seems to be the mood of 
the "temporary" nature of the patch.  This does not seem to be of the 
quality we would normally expect of a patch.  Like the "256" magic 
number.  Pushing a patch through that we would not (presumably) accept.

There is also a dt_memcpy call site in dt_cg_store_val.  E.g., consider:
         # dtrace -xstrsize=512 -n 'BEGIN { trace("...long string..."); 
exit(0) }'
Might as well do the same thing here?

Also, the line break should be between arguments rather than in the 
middle of an argument, especially when it is a grep-able string.

On 6/17/21 11:43 AM, Kris Van Hees wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   libdtrace/dt_cg.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index bd736e4b..3746ca74 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -680,6 +680,10 @@ dt_cg_memcpy(dt_irlist_t *dlp, dt_regset_t *drp, int dst, int src, size_t size)
>   {
>   	dt_ident_t	*idp = dt_dlib_get_func(yypcb->pcb_hdl, "dt_memcpy");
>   
> +	if (size > 256)
> +		xyerror(D_UNKNOWN, "memcpy() is temporarily limited to "
> +				   "256 bytes");
> +
>   	assert(idp != NULL);
>   	if (dt_regset_xalloc_args(drp) == -1)
>   		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);



More information about the DTrace-devel mailing list