* [PATCH] Fix for segmentation fault
@ 2008-04-24 15:18 Srinivasa D S
2008-04-24 16:01 ` Ananth N Mavinakayanahalli
2008-04-29 23:35 ` Roland McGrath
0 siblings, 2 replies; 3+ messages in thread
From: Srinivasa D S @ 2008-04-24 15:18 UTC (permalink / raw)
To: SystemTAP, Roland McGrath
Hi
When I executed latest systemtap on x86_64, I got segmentation
fault. On analysis, I found
........................................................
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `./stap -vvv -e probe kernel.function("sys_open")
"hi");}
'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f470e8a31c6 in report_kernel (dwfl=0xf5f3e0,
release=<value optimized out>, predicate=0)
at /home/systemtap/btils/elfutils-0.131/libdwfl/linux-kernel-module
197 mod->e_type = ET_DYN;
Attaching fix for the problem.
Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
---
libdwfl/linux-kernel-modules.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: elfutils-0.131/libdwfl/linux-kernel-modules.c
===================================================================
--- elfutils-0.131.orig/libdwfl/linux-kernel-modules.c
+++ elfutils-0.131/libdwfl/linux-kernel-modules.c
@@ -191,7 +191,7 @@ report_kernel (Dwfl *dwfl, const char **
Dwfl_Module *mod = INTUSE(dwfl_report_elf) (dwfl, KERNEL_MODNAME,
fname, fd, 0);
if (mod == NULL)
- result = -1;
+ return -1;
/* The kernel is ET_EXEC, but always treat it as relocatable. */
mod->e_type = ET_DYN;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for segmentation fault
2008-04-24 15:18 [PATCH] Fix for segmentation fault Srinivasa D S
@ 2008-04-24 16:01 ` Ananth N Mavinakayanahalli
2008-04-29 23:35 ` Roland McGrath
1 sibling, 0 replies; 3+ messages in thread
From: Ananth N Mavinakayanahalli @ 2008-04-24 16:01 UTC (permalink / raw)
To: Srinivasa D S; +Cc: SystemTAP, Roland McGrath
On Thu, Apr 24, 2008 at 12:18:22PM +0530, Srinivasa D S wrote:
> Hi
> When I executed latest systemtap on x86_64, I got segmentation
> fault. On analysis, I found
>
> ........................................................
> Loaded symbols for /lib64/libpthread.so.0
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Core was generated by `./stap -vvv -e probe kernel.function("sys_open")
> "hi");}
> '.
> Program terminated with signal 11, Segmentation fault.
> #0 0x00007f470e8a31c6 in report_kernel (dwfl=0xf5f3e0,
> release=<value optimized out>, predicate=0)
> at /home/systemtap/btils/elfutils-0.131/libdwfl/linux-kernel-module
> 197 mod->e_type = ET_DYN;
>
>
> Attaching fix for the problem.
>
> Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
>
>
> ---
> libdwfl/linux-kernel-modules.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: elfutils-0.131/libdwfl/linux-kernel-modules.c
> ===================================================================
> --- elfutils-0.131.orig/libdwfl/linux-kernel-modules.c
> +++ elfutils-0.131/libdwfl/linux-kernel-modules.c
> @@ -191,7 +191,7 @@ report_kernel (Dwfl *dwfl, const char **
> Dwfl_Module *mod = INTUSE(dwfl_report_elf) (dwfl, KERNEL_MODNAME,
> fname, fd, 0);
> if (mod == NULL)
> - result = -1;
> + return -1;
I guess this is incorrect as you skip the closing the file descriptor
and freeing fname even though result is -1. How about the following instead?
Don't dereference a NULL pointer when handling kernel modules
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
libdwfl/linux-kernel-modules.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: elfutils-0.131/libdwfl/linux-kernel-modules.c
===================================================================
--- elfutils-0.131.orig/libdwfl/linux-kernel-modules.c
+++ elfutils-0.131/libdwfl/linux-kernel-modules.c
@@ -192,9 +192,9 @@ report_kernel (Dwfl *dwfl, const char **
fname, fd, 0);
if (mod == NULL)
result = -1;
-
- /* The kernel is ET_EXEC, but always treat it as relocatable. */
- mod->e_type = ET_DYN;
+ else
+ /* The kernel is ET_EXEC, but always treat it as relocatable. */
+ mod->e_type = ET_DYN;
}
if (!report || result < 0)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for segmentation fault
2008-04-24 15:18 [PATCH] Fix for segmentation fault Srinivasa D S
2008-04-24 16:01 ` Ananth N Mavinakayanahalli
@ 2008-04-29 23:35 ` Roland McGrath
1 sibling, 0 replies; 3+ messages in thread
From: Roland McGrath @ 2008-04-29 23:35 UTC (permalink / raw)
To: Srinivasa D S; +Cc: SystemTAP
I put the correct fix in upstream. (It's the same as Ananth's fix, though
I committed before reading that message.) But AFAIK this could only come
up in a situation where it was going to fail with an error anyway, because
that case means the vmlinux file opened was unreadable or suchlike.
Thanks,
Roland
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-28 2:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-24 15:18 [PATCH] Fix for segmentation fault Srinivasa D S
2008-04-24 16:01 ` Ananth N Mavinakayanahalli
2008-04-29 23:35 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).