[DTrace-devel] [PATCH v2 05/17] alloca: new bad-size fault

Eugene Loh eugene.loh at oracle.com
Tue Mar 15 20:54:42 UTC 2022


The files need copyright years updated.

Should DTRACEFLT_BADSIZE be listed in libdtrace/unistd.d ?

Should there be a test?  E.g. checking arg4 to ERROR?  Or is there one 
in a subsequent patch?  Something like 
test/unittest/error/tst.DTRACEFLT_BADSIZE.d .

How does any corresponding documentation change need to be tracked?  
E.g. adding this new fault to
https://docs.oracle.com/en/operating-systems/oracle-linux/dtrace-guide/dt_prov.html#dt_error_prov

On 3/14/22 5:30 PM, Nick Alcock wrote:
> We'll use DTRACEFLT_BADSIZE to distinguish in error messages between
> out-of-bounds errors in bcopy and the like, and size-too-large errors.
> (Without this, it's hard to tell if a, say, 0x12 in the fault value
> is a nearly-NULL pointer or a wrong size.)
>
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>   include/dtrace/faults_defines.h | 1 +
>   libdtrace/dt_error.c            | 1 +
>   libdtrace/dt_handle.c           | 1 +
>   3 files changed, 3 insertions(+)
>
> diff --git a/include/dtrace/faults_defines.h b/include/dtrace/faults_defines.h
> index 20c57ad77499..3bef92d251ca 100644
> --- a/include/dtrace/faults_defines.h
> +++ b/include/dtrace/faults_defines.h
> @@ -32,6 +32,7 @@
>   #define DTRACEFLT_UPRIV			7	/* Illegal user access */
>   #define DTRACEFLT_TUPOFLOW		8	/* Tuple stack overflow */
>   #define DTRACEFLT_BADSTACK		9	/* Bad stack */
> +#define DTRACEFLT_BADSIZE		10	/* Bad size */
>   
>   #define DTRACEFLT_LIBRARY		1000	/* Library-level fault */
>   
> diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
> index 50229d271425..13713acb5f23 100644
> --- a/libdtrace/dt_error.c
> +++ b/libdtrace/dt_error.c
> @@ -206,6 +206,7 @@ dtrace_faultstr(dtrace_hdl_t *dtp, int fault)
>   		{ DTRACEFLT_UPRIV,	"invalid user access" },
>   		{ DTRACEFLT_TUPOFLOW,	"tuple stack overflow" },
>   		{ DTRACEFLT_BADSTACK,	"bad stack" },
> +		{ DTRACEFLT_BADSIZE,	"invalid size" },
>   		{ DTRACEFLT_LIBRARY,	"library-level fault" },
>   		{ 0,			NULL }
>   	};
> diff --git a/libdtrace/dt_handle.c b/libdtrace/dt_handle.c
> index 6968b05200b1..ba598cb7861d 100644
> --- a/libdtrace/dt_handle.c
> +++ b/libdtrace/dt_handle.c
> @@ -181,6 +181,7 @@ dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data)
>   	case DTRACEFLT_BADADDR:
>   	case DTRACEFLT_BADALIGN:
>   	case DTRACEFLT_BADSTACK:
> +	case DTRACEFLT_BADSIZE:
>   		sprintf(details, " (0x%llx)", (u_longlong_t)err.dteda_addr);
>   		break;
>   



More information about the DTrace-devel mailing list