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]

[PATCH 0/9 v2] GNU/Linux mount namespace support


Hi all,

This series allows GDB and gdbserver on GNU/Linux systems to access
executable and shared library files from mount namespaces other than
the debugger's own without requiring "set sysroot" commands.  This
makes attaching to processes in containers as simple as "gdb -p PID"
or "gdbserver --attach PID".

This requires the "move vgdb special case" patch I posted the other
day to fail correctly when built on a system without kernel support
for mount namespaces and then run on a system with support.  It's
kind of an edge case, but it's there :)  A tree with that patch and
this series is here:

  https://github.com/gbenson/binutils-gdb/tree/namespaces

The major change from the first version of this series is that setns
calls are made from a single-threaded helper process that is forked
the first time a setns is required.  This should fix the issue that
Iago with multithreaded GDB.  (I'd thought I was building with Guile,
but it turns out my system Guile is too old).  I used the same code
for both GDB and gdbserver, so Doug your multithreaded gdbserver
should work fine with this code.

Other changes: I removed target_fileio_set_fs and added inferior
arguments to all target fileio functions with filename arguments.
All of the closure-style programming is gone.  I used pid_t and
mode_t everywhere I could.  I've rewritten and expanded the NEWS
and docs (I'm still not sure they're great, but...)

The patches in this series are as follows:

  - Patch 1 (Move make_cleanup_close to common code) is a minor
    refactoring required for patch 2.  Unchanged from version 1.

  - Patch 2 (Introduce nat/linux-namespaces.[ch]) is the actual
    namespace entering code, and has been almost completely
    rewritten from its equivalent in version 1 of this series.

  - Patch 3 (Remove linux_proc_pid_get_ns) replaces the little
    bit of namespace-aware code already in GDB with calls to
    the new code.  Pretty much the same as patch 4 from version
    1 of this series.

  - Patch 4 (Comment and whitespace changes) is a new patch.
    Comments on the various implementations of target fileio
    functions duplicated information documented in target.h.
    The next patch changes a ton of signatures, so rather than
    update comments everywhere this patch replaces all the
    duplicated comments with pointers back to the canonical
    version.

  - Patch 5 (Add "inferior" argument to some target fileio
    functions) is a new patch that does exactly what it says.

  - Patch 6 (Implement mount namespace support for native Linux
    targets) also does exactly what it says.  This patch is
    almost completely rewritten from its equivalent in version
    1 of this series.

  - Patch 7 (Implement multiple-filesystem support for remote
    targets) implements the vFile:setfs packet in GDB.  This
    patch is somewhat rewritten from its equivalent in version
    1 of this series: the actual remote protocol is the same,
    but the implementation is different, passing the inferior
    as an argument rather than using target_fileio_set_fs to
    set global context.  I also added code to handle error
    responses from vFile:setfs packets, the lack of which in
    version 1 of this series was an oversight on my part; the
    GNU/Linux gdbserver implementation never fails, but of
    course some other implementation might!

  - Patch 8 (Implement vFile:setfs in gdbserver) is also somewhat
    rewritten from its equivalent in version 1 of this series: the
    remote protocol is the same, but the new linux-namespaces.[ch]
    has very a different interface so all that is rewritten.

  - Patch 9 (Announce new container-awareness features for GNU/Linux
    systems) is a new patch with the main NEWS file entry pulled out
    of whatever patch it was in before.

Built and regtested on RHEL 6.6 x86_64.

Ok to commit?

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]