[DTrace-devel] [PATCH 1/2] Add DTRACEFLT_BADINDEX fault

Elena Zannoni elena.zannoni at oracle.com
Fri Feb 24 18:04:10 UTC 2023


Ok, together with the 2/2 patch: [DTrace-devel] [PATCH 2/2 REVIEWED] Add run-time checks on bounds for scalar-array access

it makes perfect sense.

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


On 2/24/23 09:45, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees 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 3cefb0ee..4642a43a 100644
> --- a/include/dtrace/faults_defines.h
> +++ b/include/dtrace/faults_defines.h
> @@ -33,6 +33,7 @@
>  #define DTRACEFLT_TUPOFLOW		8	/* Tuple stack overflow */
>  #define DTRACEFLT_BADSTACK		9	/* Bad stack */
>  #define DTRACEFLT_BADSIZE		10	/* Bad size */
> +#define DTRACEFLT_BADINDEX		11	/* Index out of bounds */
>  
>  #define DTRACEFLT_LIBRARY		1000	/* Library-level fault */
>  
> diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
> index 383e0cde..fecb4f3b 100644
> --- a/libdtrace/dt_error.c
> +++ b/libdtrace/dt_error.c
> @@ -208,6 +208,7 @@ dtrace_faultstr(dtrace_hdl_t *dtp, int fault)
>  		{ DTRACEFLT_TUPOFLOW,	"tuple stack overflow" },
>  		{ DTRACEFLT_BADSTACK,	"bad stack" },
>  		{ DTRACEFLT_BADSIZE,	"invalid size" },
> +		{ DTRACEFLT_BADINDEX,	"index out of bounds" },
>  		{ DTRACEFLT_LIBRARY,	"library-level fault" },
>  		{ 0,			NULL }
>  	};
> diff --git a/libdtrace/dt_handle.c b/libdtrace/dt_handle.c
> index e7dda959..14e15134 100644
> --- a/libdtrace/dt_handle.c
> +++ b/libdtrace/dt_handle.c
> @@ -182,6 +182,7 @@ dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data)
>  		if ((int64_t)err.dteda_addr == -1)
>  			goto no_addr;
>  	case DTRACEFLT_BADALIGN:
> +	case DTRACEFLT_BADINDEX:
>  	case DTRACEFLT_BADSTACK:
>  	case DTRACEFLT_BADSIZE:
>  		sprintf(details, " (0x%llx)", (unsigned long long)err.dteda_addr);




More information about the DTrace-devel mailing list