This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: vvar, gup && coredump
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Oleg Nesterov <oleg at redhat dot com>
- Cc: Andy Lutomirski <luto at amacapital dot net>, Jan Kratochvil <jan dot kratochvil at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>, Pedro Alves <palves at redhat dot com>, "linux-kernel\ at vger dot kernel dot org" <linux-kernel at vger dot kernel dot org>
- Date: Fri, 13 Mar 2015 00:50:48 -0400
- Subject: Re: vvar, gup && coredump
- Authentication-results: sourceware.org; auth=none
- References: <20150305154827 dot GA9441 at host1 dot jankratochvil dot net> <87zj7r5fpz dot fsf at redhat dot com> <20150305205744 dot GA13165 at host1 dot jankratochvil dot net> <20150311200052 dot GA22654 at redhat dot com> <20150312143438 dot GA4338 at redhat dot com> <CALCETrW5rmAHutzm_OwK2LTd_J0XByV3pvWGyW=AmC=v7rLfhQ at mail dot gmail dot com> <20150312165423 dot GA10073 at redhat dot com> <CALCETrUGu5Wc7BbbQ4_tn29JGbyotUJay67EHBEgSa8-bz01Jg at mail dot gmail dot com> <20150312173901 dot GA12225 at redhat dot com> <874mpqp0sm dot fsf at redhat dot com> <20150312180229 dot GA13711 at redhat dot com>
On Thursday, March 12 2015, Oleg Nesterov wrote:
>> If I understood this discussion correctly (and thanks Andy and Oleg for,
>> *ahem*, dumping all this useful information for us!), GDB will not need
>> modifications in the Linux kernel in this area. In fact, my patch
>> already implements the "ignore VM_DONTDUMP mappings" part, so we're
>> pretty much covered.
>
> OK, thanks.
>
> And it seems that we all agree that the kernel should not dump this vma
> too. Could you confirm that this is fine from gdb pov just in case?
Yes, this is what we expect from the GDB side. This mapping is marked
as "dd", so it does not make sense to dump it.
While I have you guys, would it be possible for the Linux kernel to
include a new flag on VmFlags to uniquely identify an anonymous mapping?
Currently, there is no easy way to do that from userspace. My patch
implements the following heuristic on GDB:
if (pathname == "/dev/zero (deleted)"
|| pathname == "/SYSV%08x (deleted)"
|| pathname == "<file> (deleted)"
|| "Anonymous:" field is > 0 kB
|| "AnonHugePages:" field is > 0 kB)
mapping is anonymous;
However, this can be fragile. The Linux kernel checks for i_nlink == 0,
but there is no easy way for GDB to check this on userspace (as Jan
mentioned, one could look at /proc/PID/map_files/, but they are only
accessible by root). That's why I think it would be good to provide
this info right away in /proc/PID/smaps...
Thanks,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/