From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79999 invoked by alias); 30 Apr 2015 12:05:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 79961 invoked by uid 89); 30 Apr 2015 12:05:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 30 Apr 2015 12:05:56 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3UC5nkw010352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 Apr 2015 08:05:50 -0400 Received: from blade.nx (ovpn-116-76.ams2.redhat.com [10.36.116.76]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3UC5ltp032755; Thu, 30 Apr 2015 08:05:48 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 4D82D263E15; Thu, 30 Apr 2015 13:05:47 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: Eli Zaretskii , Pedro Alves , Doug Evans , =?UTF-8?q?Iago=20L=C3=B3pez=20Galeiras?= Subject: [PATCH 0/9 v2] GNU/Linux mount namespace support Date: Thu, 30 Apr 2015 12:06:00 -0000 Message-Id: <1430395542-16017-1-git-send-email-gbenson@redhat.com> In-Reply-To: <1429186791-6867-1-git-send-email-gbenson@redhat.com> References: <1429186791-6867-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01100.txt.bz2 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/