Re: [PATCH kdumpid 0/3] Prevent segfault on missing disassembler

Petr Tesařík <[email protected]>
Newsgroups org.kernel.vger.linux-debuggers
Message-ID <[email protected]>
On Wed, 28 Jun 2023 14:03:41 -0700
Stephen Brennan <[email protected]> wrote:

> Hi Petr,
> 
> I didn't know quite where to send patches for kdumpid, so I elected to
> send direct to you, and CC the linux-debuggers list. Hope that's ok!


Yes, absolutely! Thank you for the fixes, they are much appreciated.

I should move this project to a better place. In my defense I should
say that the code predates GitHub, and there weren't many options back
then. ;-)

Petr T

> I encountered a segmentation fault of kdumpid (master branch):
> 
> #0  0x0000000000000000 in ?? ()
> #1  0x0000000000406aa9 in disas_at (dd=0x7fffffffde70, info=0x7fffffffdc80, pc=0) at ppc64.c:112
> #2  0x0000000000406d42 in looks_like_kcode_ppc64 (dd=0x7fffffffde70, addr=0) at ppc64.c:174
> #3  0x0000000000405616 in explore_kernel (dd=0x7fffffffde70, fn=0x405880 <explore_utsname>) at util.c:269
> #4  0x0000000000405d3f in explore_raw_data (dd=0x7fffffffde70) at util.c:465
> #5  0x0000000000404c98 in main (argc=2, argv=0x7fffffffe168) at main.c:248
> 
> The print_insn function pointer was NULL and calling it resulted in the
> segfault. So I've included a patch to check the return value of
> disassembler() and avoid calling print_insn in those cases.
> 
> I also added some fixes to build issues I encountered - hopefully to
> help you avoid autotools for even longer :P
> 
> Thanks,
> Stephen
> 
> Stephen Brennan (3):
>   cdefs.sh: require bash
>   Use -lz unconditionally
>   Gracefully handle missing dissasembler function
> 
>  Makefile | 2 +-
>  cdefs.sh | 2 +-
>  libs.sh  | 3 ---
>  ppc.c    | 2 ++
>  ppc64.c  | 2 ++
>  s390.c   | 2 ++
>  x86.c    | 2 ++
>  7 files changed, 10 insertions(+), 5 deletions(-)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.