Skip to content

Commit

Permalink
alloca: new bad-size fault
Browse files Browse the repository at this point in the history
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@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock committed Apr 19, 2022
1 parent 19ce450 commit 7a4b783
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/dtrace/faults_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
*/

/*
Expand Down Expand Up @@ -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 */

Expand Down
3 changes: 2 additions & 1 deletion libdtrace/dt_error.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand Down Expand Up @@ -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 }
};
Expand Down
1 change: 1 addition & 0 deletions libdtrace/dt_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data)
goto no_addr;
case DTRACEFLT_BADALIGN:
case DTRACEFLT_BADSTACK:
case DTRACEFLT_BADSIZE:
sprintf(details, " (0x%llx)", (u_longlong_t)err.dteda_addr);
break;

Expand Down

0 comments on commit 7a4b783

Please sign in to comment.