This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [PR server/18976] fallback to open if multifs_open fails


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.

Thanks,
Josh

On Thu, Sep 17, 2015 at 8:33 AM, Gary Benson <gbenson@redhat.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]