public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug threads/28014] gdb coredumps when remote+kgdbing a system that OOMs too hard
Date: Sun, 27 Jun 2021 05:27:49 +0000	[thread overview]
Message-ID: <bug-28014-4717-EllfTDsHI8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28014-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28014

--- Comment #8 from Simon Marchi <simark at simark dot ca> ---
I investigated a little bit why GDB fails to get the exec displacement for your
program, and found that program header validation here fails:

https://gitlab.com/gnutools/gdb/-/blob/f1fa7a3d88561cef54dd5cf9422c29a802af6ce3/gdb/solib-svr4.c#L2625-2628

The program headers read from the core is all zeroes.  The address of the PHDR
in your core is:

    $ eu-readelf -n qemu_gdb_20210625-192829_18450.core | grep PHDR
        PHDR: 0x4000000040

The corresponding LOAD in the core, for that address, is:

    $ eu-readelf -l qemu_gdb_20210625-192829_18450.core
      Type           Offset   VirtAddr           PhysAddr           FileSiz 
MemSiz   Flg Align
      LOAD           0x005000 0x0000004000000000 0x0000000000000000 0x000000
0xa04000 R E 0x1000

FileSiz == 0 hints that this section of memory was not dumped in the core.

I then found that bit 4 of /proc/$pid/coredump_filter controls that, as
documented in the core(5) man page.  I tried flipping that bit off, generated a
core, and also got a core with FileSiz == 0.  Is it possible that your system
does not include that information in the code dumps?

Simon

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-06-27  5:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 23:43 [Bug threads/28014] New: " rincebrain at gmail dot com
2021-06-26  1:20 ` [Bug threads/28014] " simark at simark dot ca
2021-06-26  2:15 ` rincebrain at gmail dot com
2021-06-26  2:29 ` simark at simark dot ca
2021-06-26  2:41 ` rincebrain at gmail dot com
2021-06-26  4:27 ` simark at simark dot ca
2021-06-26 10:55 ` rincebrain at gmail dot com
2021-06-26 13:04 ` simark at simark dot ca
2021-06-27  5:27 ` simark at simark dot ca [this message]
2021-06-27 12:24 ` rincebrain at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28014-4717-EllfTDsHI8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).