From: Michael H. <ho...@li...> - 2008-11-07 15:57:36
|
On systems, where pointer size is not equal to the size of an "unsigned int" (on most 64 bit systems), the lcrash function for reading the kernel symbol table fails. The problem is that the code assumes that the following members of struct module are of type kl_kaddr: struct module { ... unsigned int num_symtab; unsigned int init_text_size; unsigned int core_text_size; ... }; To fix the problem, we have to use the KL_UINT() function instead of the kl_kaddr() function to read in the members. If nobody objects, I will checkin the patch. Michael --- kl_new_module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -a -u -r1.2 kl_new_module.c --- kl_new_module.c 13 May 2005 14:05:13 -0000 1.2 +++ kl_new_module.c 7 Nov 2008 15:40:38 -0000 @@ -347,13 +347,13 @@ } - nsyms = kl_kaddr(dump_module, "module","num_symtab"); + nsyms = KL_UINT(dump_module, "module", "num_symtab"); sym_entry = kl_kaddr(dump_module,"module","symtab"); str_tab = kl_kaddr(dump_module,"module","strtab"); mod_init_start = kl_kaddr(dump_module,"module","module_init"); - mod_init_size = kl_kaddr(dump_module,"module","init_text_size"); + mod_init_size = KL_UINT(dump_module,"module","init_text_size"); mod_core_start = kl_kaddr(dump_module,"module","module_core"); - mod_core_size = kl_kaddr(dump_module,"module","core_text_size"); + mod_core_size = KL_UINT(dump_module,"module","core_text_size"); for(i=0; i<nsyms; i++){ if(kl_get_structure(sym_entry,elf_sym_type,&elf_sym_size,&elf_sym)){ |
From: Bernhard W. <bw...@su...> - 2008-11-07 16:00:56
|
Hi, * Michael Holzheu [2008-11-07 16:56]: > > On systems, where pointer size is not equal to the size of an "unsigned > int" (on most 64 bit systems), the lcrash function for reading the > kernel symbol table fails. > > The problem is that the code assumes that the following members of > struct module are of type kl_kaddr: > > struct module { > ... > unsigned int num_symtab; > unsigned int init_text_size; > unsigned int core_text_size; > ... > }; That has been changed for 2.6.27. It was unsigned long before. I sent a similar patch to the crash list. Please make that change conditionally for kernels greater equal 2.6.27 because otherwise you'll break old kernels and dumps. Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development |
From: Michael H. <ho...@li...> - 2008-11-07 20:00:16
|
Hallo Bernhard, > That has been changed for 2.6.27. It was unsigned long before. I sent a > similar patch to the crash list. Please make that change conditionally > for kernels greater equal 2.6.27 because otherwise you'll break old > kernels and dumps. Right... I will define LINUX_2_6_27 and add the kernel version check. What about the following? --- Index: kl_new_module.c =================================================================== RCS file: /home/cvs/lkcd/lkcdutils/libklib/kl_new_module.c,v retrieving revision 1.2 diff -a -u -r1.2 kl_new_module.c --- kl_new_module.c 13 May 2005 14:05:13 -0000 1.2 +++ kl_new_module.c 7 Nov 2008 16:53:52 -0000 @@ -1,5 +1,5 @@ /* - * $Id: kl_new_module.c,v 1.2 2005/05/13 14:05:13 holzheu Exp $ + * $Id: kl_new_module.c,v 1.3 2008/11/07 15:57:54 holzheu Exp $ * * This file is part of libklib. * A library which provides access to Linux system kernel dumps. @@ -347,13 +347,23 @@ } - nsyms = kl_kaddr(dump_module, "module","num_symtab"); + if (KL_LINUX_RELEASE < LINUX_2_6_27) { + nsyms = kl_kaddr(dump_module, "module","num_symtab"); + mod_init_size = kl_kaddr(dump_module, "module", + "init_text_size"); + mod_core_size = kl_kaddr(dump_module, "module", + "core_text_size"); + } else { + nsyms = KL_UINT(dump_module, "module", "num_symtab"); + mod_init_size = KL_UINT(dump_module, "module", + "init_text_size"); + mod_core_size = KL_UINT(dump_module, "module", + "core_text_size"); + } sym_entry = kl_kaddr(dump_module,"module","symtab"); str_tab = kl_kaddr(dump_module,"module","strtab"); mod_init_start = kl_kaddr(dump_module,"module","module_init"); - mod_init_size = kl_kaddr(dump_module,"module","init_text_size"); mod_core_start = kl_kaddr(dump_module,"module","module_core"); - mod_core_size = kl_kaddr(dump_module,"module","core_text_size"); for(i=0; i<nsyms; i++){ if(kl_get_structure(sym_entry,elf_sym_type,&elf_sym_size,&elf_sym)){ |
From: Bernhard W. <bw...@su...> - 2008-11-07 17:20:46
|
* Michael Holzheu [2008-11-07 17:58]: > > > That has been changed for 2.6.27. It was unsigned long before. I sent a > > similar patch to the crash list. Please make that change conditionally > > for kernels greater equal 2.6.27 because otherwise you'll break old > > kernels and dumps. > > Right... > > I will define LINUX_2_6_27 and add the kernel version check. What about > the following? That looks ok to me, thanks. Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development |