[DTrace-devel] [PATCH 05/14] alloca: new faults
Kris Van Hees
kris.van.hees at oracle.com
Mon Mar 7 21:07:01 UTC 2022
On Wed, Mar 02, 2022 at 01:44:58PM +0000, Nick Alcock via DTrace-devel 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.)
Makes sense.
> We'll use DTRACEFLT_INTERR to indicate can-never-happen errors where we
> have tested the actual condition already (and emitted a proper error)
> followed by a check to placate the verifier (which will always succeed
> if the actual condition check failed). The latter failure happening at
> runtime always indicates a bug in DTrace, not in the user's code, so
> indicate as much.
Here I am confused. If this is a fault that can never happen, why do we
even generate code to report such a non-existant fault? Based on your
description this would be used in cases where the condition has already
been tested and a proper error has emitted. Since a probe error results
in an immediate return from the clause function (after reporting the
fault by means of the ERROR probe clauses), the following code will never
execute.
So, I really do not see the need for this new fault that can never happen.
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
> include/dtrace/faults_defines.h | 2 ++
> libdtrace/dt_error.c | 2 ++
> libdtrace/dt_handle.c | 1 +
> 3 files changed, 5 insertions(+)
>
> diff --git a/include/dtrace/faults_defines.h b/include/dtrace/faults_defines.h
> index 20c57ad77499..977db5e57817 100644
> --- a/include/dtrace/faults_defines.h
> +++ b/include/dtrace/faults_defines.h
> @@ -32,6 +32,8 @@
> #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_INTERR 11 /* Internal error */
>
> #define DTRACEFLT_LIBRARY 1000 /* Library-level fault */
>
> diff --git a/libdtrace/dt_error.c b/libdtrace/dt_error.c
> index 50229d271425..5267d23d856b 100644
> --- a/libdtrace/dt_error.c
> +++ b/libdtrace/dt_error.c
> @@ -206,6 +206,8 @@ 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_INTERR, "internal error" },
> { 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;
>
> --
> 2.35.0.260.gb82b153193.dirty
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list