Build systems (like QEMU's, apparently) may call 'gdb --version' to check gdb's presence & its version on the system. As of 1bcb0708f22956d5128a2e75df6eba5a18327892, gdb will check if /proc/pid/mem is writable, including for 'gdb --version' calls. Gentoo's build process has sandboxing which blocks this access and then as a result the build fails. Is it possible to skip this the /proc/pid/mem check for simple --version invocations? Thanks.
Fix posted here: [PATCH] Delay checking whether /proc/pid/mem is writable (PR gdb/29907) https://sourceware.org/pipermail/gdb-patches/2022-December/194817.html
The master branch has been updated by Pedro Alves <palves@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9dff6a5d54f212f875b6551444393691a2410f3e commit 9dff6a5d54f212f875b6551444393691a2410f3e Author: Pedro Alves <pedro@palves.net> Date: Fri Dec 16 12:04:54 2022 +0000 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
Fixed.
Many thanks for the speedy resolution!