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: Gary Benson <gbenson at redhat dot com>
- To: Josh Gao <jmgao at google dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 18 Sep 2015 16:15:03 +0100
- 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> <CAAHfpN-fv7U1jc2e7K-CddxaV-mfU_VfKsBM6pJx9uAJh0081g at mail dot gmail dot com>
Josh Gao wrote:
> 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
> > > failure.
> > No.
> > 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
> > instead.
> > 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.
> > Thanks,
> > Gary
> > --
> > http://gbenson.net/