This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] [PR server/18976] fallback to open if multifs_open fails
- From: Josh Gao <jmgao at google dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 17 Sep 2015 11:09:09 -0700
- Subject: Re: [PATCH] [PR server/18976] fallback to open if multifs_open fails
- Authentication-results: sourceware.org; auth=none
- References: <CAAHfpN8Yi0=a=GsEPOAkZc3NWVQp4VGex04zpxrr9UEUu5k=SQ at mail dot gmail dot com> <20150917153351 dot GB3724 at blade dot nx>
Oops, I thought that gdbserver and the inferior were in the same mount
namespace, but I must have looked at the wrong PID. You're right,
closing the bug.
On Thu, Sep 17, 2015 at 8:33 AM, Gary Benson <email@example.com> wrote:
> Josh Gao wrote:
>> gdbserver on linux currently tries to open files from within the
>> target's mount namespace via setns in a helper process, but this
>> only works for users with CAP_SYS_CHROOT and CAP_SYS_ADMIN, which
>> regular users generally don't have (particularly on android).
>> This patch retries with a regular open if multifs_open reports
> If GDB/gdbserver got to the point that multifs_open was called then
> the inferior is in a different mount namespace and it's not ok to
> use regular open if multifs_open fails: you might open *something*,
> but it'll be in the wrong filesystem.
> If you're trying to debug an inferior in a different mount namespace
> then you have to have CAP_SYS_CHROOT and CAP_SYS_ADMIN to access its
> files directly. If you can't get these capabilities then you need to
> run gdbserver in the same container as the inferior and debug remotely
> via TCP or something. If you can't do that then you need to arrange
> a local copy of the files and use "set sysroot" to make GDB use those
> If your inferior *is* in the same mount namespace as GDB/gdbserver but
> GDB/gdbserver is trying to use multifs_open then there is a bug, but
> the bug is that linux_ns_same is not working correctly. If this is
> the case then let me know and I'll work with you to fix it.