Skip to contentSkip to conversation

Add ability to override kernel release check

PATCH In review Nikolay Borisov 1 participant 2 messages Sep 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add ability to override kernel release check

From: Nikolay Borisov <[email protected]>

In some situation it might be useful to disable checking the kernel release. This happens when a kernel module is being rebuilt and then probed. Without this override one has to reboot the machine with the new kernel (and module) and then use systemtap.

To rectify the situation add a new define STP_NO_VERREL_CHECK, which disables the relevant code in the resulting systemtap module.

This can be used with the following syntax:
stap -DSTP_NO_VERREL_CHECK script.stp

---
 translate.cxx | 2 ++
 1 file changed, 2 insertions(+)
translate.cxx +2 -0
index 489bd2e2de1a..f792343e0cae 100644
@@ -1728,6 +1728,7 @@ c_unparser::emit_module_init ()
       // run a probe compiled for a different version.  Catch this early,
       // just in case modversions didn't.
       o->newline() << "{";
+      o->newline() << "#ifndef STP_NO_VERREL_CHECK";
       o->newline(1) << "const char* release = UTS_RELEASE;";
       o->newline() << "#ifdef STAPCONF_GENERATED_COMPILE";
       o->newline() << "const char* version = UTS_VERSION;";
@@ -1762,6 +1763,7 @@ c_unparser::emit_module_init ()
       o->newline() << "rc = -EINVAL;";
       o->newline(-1) << "}";
       o->newline() << "#endif";
+      o->newline() << "#endif";
 
       // perform buildid-based checking if able
       o->newline() << "if (_stp_module_check()) rc = -EINVAL;";
Signature · 1 line
2.5.0
#1 lore raw
Quoted 32 lines · Nikolay Borisov

From: Nikolay Borisov <[email protected]>

In some situation it might be useful to disable checking the kernel release. This happens when a kernel module is being rebuilt and then probed. Without this override one has to reboot the machine with the new kernel (and module) and then use systemtap.

To rectify the situation add a new define STP_NO_VERREL_CHECK, which disables the relevant code in the resulting systemtap module.

This can be used with the following syntax:
stap -DSTP_NO_VERREL_CHECK script.stp

---
 translate.cxx | 2 ++
 1 file changed, 2 insertions(+)
translate.cxx +1 -0
index 489bd2e2de1a..f792343e0cae 100644
@@ -1728,6 +1728,7 @@ c_unparser::emit_module_init ()
       // run a probe compiled for a different version.  Catch this early,
       // just in case modversions didn't.
       o->newline() << "{";
+      o->newline() << "#ifndef STP_NO_VERREL_CHECK";
       o->newline(1) << "const char* release = UTS_RELEASE;";
       o->newline() << "#ifdef STAPCONF_GENERATED_COMPILE";
       o->newline() << "const char* version = UTS_VERSION;";

translate.cxx c_unparser::emit_module_init () · line 1769

Quoted 7 lines
translate.cxx +1 -0
@@ -1762,6 +1763,7 @@ c_unparser::emit_module_init ()
       o->newline() << "rc = -EINVAL;";
       o->newline(-1) << "}";
       o->newline() << "#endif";
+      o->newline() << "#endif";
 
       // perform buildid-based checking if able
       o->newline() << "if (_stp_module_check()) rc = -EINVAL;";

Please ignore, that was clearly an error... silly me :(