[DTrace-devel] [PATCH 5/6] speculations, bpf: check for nonexistent CTF before using it
Nick Alcock
nick.alcock at oracle.com
Wed Mar 2 13:44:35 UTC 2022
This turns coredumps into a not-all-that-much-more-helpful "no such file
or directory" error (but turning DT_DEBUG on at least tells you which
file is missing, i.e. some ctfa file)
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
libdtrace/dt_bpf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
index 8b5513547d85..9b7344d02221 100644
--- a/libdtrace/dt_bpf.c
+++ b/libdtrace/dt_bpf.c
@@ -141,6 +141,9 @@ set_task_offsets(dtrace_hdl_t *dtp)
ctf_membinfo_t ctm;
ctf_file_t *cfp = dtp->dt_shared_ctf;
+ if (!cfp)
+ return dt_set_errno(dtp, EDT_NOCTF);
+
type = ctf_lookup_by_name(cfp, "struct task_struct");
if (type == CTF_ERR)
return -1;
--
2.35.0.260.gb82b153193.dirty
More information about the DTrace-devel
mailing list