Skip to contentSkip to conversation

Fix: NULL pointer dereference of THIS_MODULE with built-in modules

PATCH Mathieu Desnoyers 1 participant 1 message May 17, 2017 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1495055352-6636-1-git-send-email-francis.deslauriers@efficios.com

Mathieu Desnoyers

author Applied
#1 lore raw

Merged into master, 2.10, 2.9, 2.8, thanks!

Mathieu

Quoted 50 lines · ----- On May 17, 2017, at 5:09 PM, Francis Deslauriers…

THIS MODULE is defined to 0 when a module is built-in the kernel [1]. This caused NULL pointer dereference when booting a kernel with the lttng-modules built-in.
To fix this issue, add #if guard around the wrapper_lttng_fixup_sig function checking if the MODULE macro is defined to confirm that this piece of code will end up in a module and not in the kernel itself.

[1]: linux/include/linux/export.h:32
Fixes: #1107

---
wrapper/tracepoint.h | 8 ++++++--

1 file changed, 6 insertions(+), 2 deletions(-)
wrapper/tracepoint.h +4 -0
index 367cdf4..780f9a8 100644
@@ -87,6 +87,10 @@ int wrapper_tracepoint_module_notify(struct notifier_block
 *nb,
 	}
 }
 
+#endif /* CONFIG_MODULE_SIG */
+
+#if defined(CONFIG_MODULE_SIG) && defined(MODULE)
+

static inline
int wrapper_lttng_fixup_sig(struct module *mod)
{

wrapper/tracepoint.h +1 -1
@@ -106,7 +110,7 @@ int wrapper_lttng_fixup_sig(struct module *mod)
 	return ret;
 }
 
-#else /* CONFIG_MODULE_SIG */
+#else /* #if defined(CONFIG_MODULE_SIG) && defined(MODULE) */
 

static inline
int wrapper_lttng_fixup_sig(struct module *mod)

wrapper/tracepoint.h +1 -2
@@ -114,6 +118,6 @@ int wrapper_lttng_fixup_sig(struct module *mod)
 	return 0;
 }
 
-#endif /* #else CONFIG_MODULE_SIG */
+#endif /*#else #if defined(CONFIG_MODULE_SIG) && defined(MODULE) */
 
 #endif /* _LTTNG_WRAPPER_TRACEPOINT_H */
--

2.7.4

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev