oracle / dtrace-utils

DTrace-utils contains the DTrace port to Linux
Other
151 stars 20 forks source link

Unfriendly assertion on invalid/missing kernel configuration #74

Open thesamesam opened 3 months ago

thesamesam commented 3 months ago

On a machine with incorrect kernel configuration, we get:

# dtrace -v
dtrace: libdtrace/dt_module.c:844: dt_kern_module_ctf_from_btf: Assertion `dmp->dm_btf != NULL' failed.
Aborted (core dumped)

The assertion is right to fire, but we should give a nicer error message before getting there, especially as people (like me there!) default to -v instead of -V for version information. (-V does work OK).

kvanhees commented 2 months ago

Yes, good point. I assume this was a kernel that did not have BPF enabled?

thesamesam commented 2 months ago

In this case, the diff was:

@@ -10902,11 +10872,23 @@ CONFIG_DEBUG_KERNEL=y
 #
 # Compile-time checks and compiler options
 #
+CONFIG_DEBUG_INFO=y
 CONFIG_AS_HAS_NON_CONST_ULEB128=y
-CONFIG_DEBUG_INFO_NONE=y
+# CONFIG_DEBUG_INFO_NONE is not set
 # CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-# CONFIG_DEBUG_INFO_DWARF5 is not set
+CONFIG_DEBUG_INFO_DWARF5=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_INFO_COMPRESSED_NONE is not set
+CONFIG_DEBUG_INFO_COMPRESSED_ZLIB=y
+# CONFIG_DEBUG_INFO_COMPRESSED_ZSTD is not set
+# CONFIG_DEBUG_INFO_SPLIT is not set
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_PAHOLE_HAS_SPLIT_BTF=y
+CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
+CONFIG_DEBUG_INFO_BTF_MODULES=y
+# CONFIG_MODULE_ALLOW_BTF_MISMATCH is not set
+# CONFIG_GDB_SCRIPTS is not set
 CONFIG_FRAME_WARN=2048
 CONFIG_STRIP_ASM_SYMS=y
 # CONFIG_READABLE_ASM is not set
@@ -11155,6 +11137,7 @@ CONFIG_BRANCH_PROFILE_NONE=y
 # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
 CONFIG_BLK_DEV_IO_TRACE=y
 CONFIG_FPROBE_EVENTS=y
+CONFIG_PROBE_EVENTS_BTF_ARGS=y
 CONFIG_KPROBE_EVENTS=y
 # CONFIG_KPROBE_EVENTS_ON_NOTRACE is not set
 CONFIG_UPROBE_EVENTS=y

... so I think it was missing BTF.