markup_oops: Use modinfo to avoid confusion with underscored module names
PATCH 1/1 markup_oops: Use modinfo to avoid confusion with underscored module names
When EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'.
Use modinfo to correctly get the full path to the module.
---
This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than searching through the filesystem but may not be desirable as it brings a dependency to module-init-tools. Replacing underscore occurences by '-' can be another solution.
scripts/markup_oops.pl | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
scripts/markup_oops.pl +1 -4
@@ -184,10 +184,7 @@ if ($target eq "0") { # if it's a module, we need to find the .ko file and calculate a load offset if ($module ne "") { - my $dir = dirname($filename); - $dir = $dir . "/"; - my $mod = $module . ".ko"; - my $modulefile = `find $dir -name $mod | head -1`; + my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`; chomp($modulefile); $filename = $modulefile; if ($filename eq "") {
Signature · 1 line
1.6.3.4
Quoted 7 lines · On Thu, 6 Aug 2009 15:21:55 +0300 Ozan Çağlayan <[email protected]> wrote:
When EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'.
Use modinfo to correctly get the full path to the module.
Signed-off-by Ozan Çağlayan <[email protected]>
I like it, it's simple.
I don't mind about the module-init-tools dependency, everyone will have that already.
Andrew: can you hover this one up and send to Linus when its time is due?
Quoted 25 lines
---
This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than searching through the filesystem but may not be desirable as it brings a dependency to module-init-tools. Replacing underscore occurences by '-' can be another solution.scripts/markup_oops.pl | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)scripts/markup_oops.pl +1
-4@@ -184,10 +184,7 @@ if ($target eq "0") { # if it's a module, we need to find the .ko file and calculate a load offset if ($module ne "") { - my $dir = dirname($filename); - $dir = $dir . "/"; - my $mod = $module . ".ko"; - my $modulefile = `find $dir -name $mod | head -1`; + my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`; chomp($modulefile); $filename = $modulefile; if ($filename eq "") {
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 8 lines · Arjan van de Ven
Quoted 4 lines · On Thu, 6 Aug 2009 15:21:55 +0300 Ozan Çağlayan <[email protected]> wrote:
When EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'.
Quoted 9 lines
Quoted 4 lines
Use modinfo to correctly get the full path to the module.
Signed-off-by Ozan Çağlayan <[email protected]>I like it, it's simple.
I don't mind about the module-init-tools dependency, everyone will have that already.
BTW, note that the old code was searching for *.ko files in dirname($vmlinux_name). Replacing it by modprobe will eventually always search for the modules in /lib/modules/KVER/.
Quoted 20 lines · Ozan Çağlayan
When EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'.
Use modinfo to correctly get the full path to the module.
Signed-off-by Ozan Çağlayan <[email protected]>---
This is just a trivial patch to pinpoint the problem. Usage of modinfo is faster than searching through the filesystem but may not be desirable as it brings a dependency to module-init-tools. Replacing underscore occurences by '-' can be another solution.
scripts/markup_oops.pl| 5 +----1 files changed, 1 insertions(+), 4 deletions(-)scripts/markup_oops.pl +0
-0
scripts/markup_oops.pl if ($target eq "0") { · line 187
Quoted 8 lines
scripts/markup_oops.pl +1
-4@@ -184,10 +184,7 @@ if ($target eq "0") { # if it's a module, we need to find the .ko file and calculate a load offset if ($module ne "") { - my $dir = dirname($filename); - $dir = $dir . "/"; - my $mod = $module . ".ko"; - my $modulefile = `find $dir -name $mod | head -1`; + my $modulefile = `modinfo $module | grep 'filename' | gawk '{ print \$2 }'`;
I know this works, but how about grep '^filename:' ? This is more strict.
Also, although on most Linux awk is just a symbol link to gawk, but it is still better to use awk instead of gawk for portability reason.
Quoted 3 lines
scripts/markup_oops.pl +0
-0chomp($modulefile); $filename = $modulefile; if ($filename eq "") {
PATCH v2 1/1 markup_oops: Use modinfo to avoid confusion with underscored module names
In reply to Ozan ÇağlayanWhen EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'. Use modinfo for a better path finding.
--- scripts/markup_oops.pl | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
scripts/markup_oops.pl +1 -4
@@ -184,10 +184,7 @@ if ($target eq "0") { # if it's a module, we need to find the .ko file and calculate a load offset if ($module ne "") { - my $dir = dirname($filename); - $dir = $dir . "/"; - my $mod = $module . ".ko"; - my $modulefile = `find $dir -name $mod | head -1`; + my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`; chomp($modulefile); $filename = $modulefile; if ($filename eq "") {
Signature · 1 line
1.6.3.4
Quoted 5 lines · Ozan Çağlayan
When EIP is at a module having an underscore in its name, the current code fails to find it because the module filenames has '-' instead of '_'. Use modinfo for a better path finding.
Signed-off-by Ozan Çağlayan <[email protected]>
Thanks!
Quoted 28 lines
---
scripts/markup_oops.pl| 5 +----1 files changed, 1 insertions(+), 4 deletions(-)scripts/markup_oops.pl +1
-4@@ -184,10 +184,7 @@ if ($target eq "0") { # if it's a module, we need to find the .ko file and calculate a load offset if ($module ne "") { - my $dir = dirname($filename); - $dir = $dir . "/"; - my $mod = $module . ".ko"; - my $modulefile = `find $dir -name $mod | head -1`; + my $modulefile = `modinfo $module | grep '^filename:' | awk '{ print \$2 }'`; chomp($modulefile); $filename = $modulefile; if ($filename eq "") {Signature · 7 lines
1.6.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
Live like a child, think like the god.