]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/linux-nat.c
Delay checking whether /proc/pid/mem is writable (PR gdb/29907)
authorPedro Alves <pedro@palves.net>
Fri, 16 Dec 2022 12:04:54 +0000 (12:04 +0000)
committerPedro Alves <pedro@palves.net>
Fri, 16 Dec 2022 16:04:58 +0000 (16:04 +0000)
commit9dff6a5d54f212f875b6551444393691a2410f3e
tree98b168d754dc4df3fe31bd0c1aa8cd6a17556747
parentc7ce51d8c886cc4b34ccee30dd1e7add4058466f
Delay checking whether /proc/pid/mem is writable (PR gdb/29907)

As of 1bcb0708f229 ("gdb/linux-nat: Check whether /proc/pid/mem is
writable"), GDB checks if /proc/pid/mem is writable.  This is done
early at GDB startup, in order to get a consistent warning, instead of
a warning that depends on whenever GDB writes to inferior memory.

PR gdb/29907 points out that some build systems (like QEMU's,
apparently) may call 'gdb --version' to check GDB's presence & its
version on the system, and that Gentoo's build process has sandboxing
which blocks the /proc/pid/mem access and thus GDB warns, which
results in build fails.

To help with that, this patch delays the /proc/pid/mem check until we
start or attach to an inferior.  Ends up potentially emiting a warning
close where we already emit other ptrace- and /proc- related warnings,
which just Feels Right.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29907
Change-Id: I5537653ecfbbe76a04ab035e40e59d09b4980763
gdb/linux-nat.c