[DTrace-devel] [PATCH 4/6] symbol: fix undefined, non-extern symbols

Nick Alcock nick.alcock at oracle.com
Wed Apr 19 15:41:29 UTC 2023


Undefined symbols are undefined symbols even if they are not marked as
extern: they shouldn't be returned as if they were validly resolved, but
with no definition.

(My bug, nearly a decade old. The code before my change acts this way.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 libdtrace/dt_module.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
index 7f3f1f50f34c8..ca816422d9196 100644
--- a/libdtrace/dt_module.c
+++ b/libdtrace/dt_module.c
@@ -1720,7 +1720,10 @@ dtrace_symbol_type(dtrace_hdl_t *dtp, const GElf_Sym *symp,
 		tip->dtt_type = DT_FPTR_TYPE(dtp);
 	}
 
-	if (undefined && dmp->dm_extern != NULL) {
+	if (undefined) {
+		if (dmp->dm_extern == NULL)
+			return dt_set_errno(dtp, EDT_NOSYM);
+
 		dt_ident_t *idp =
 		    dt_idhash_lookup(dmp->dm_extern, sip->name);
 
-- 
2.39.1.268.g9de2f9a303




More information about the DTrace-devel mailing list