From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14140 invoked by alias); 16 Apr 2015 12:19: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 14117 invoked by uid 89); 16 Apr 2015 12:19:57 -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, 16 Apr 2015 12:19: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 (Postfix) with ESMTPS id 505AFCA642 for ; Thu, 16 Apr 2015 12:19:55 +0000 (UTC) Received: from blade.nx (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3GCJsU3021139 for ; Thu, 16 Apr 2015 08:19:54 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id B2CD7264011 for ; Thu, 16 Apr 2015 13:19:53 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 0/7] GNU/Linux mount namespace support Date: Thu, 16 Apr 2015 12:19:00 -0000 Message-Id: <1429186791-6867-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00608.txt.bz2 Hi all, This series allows GDB and gdbserver on GNU/Linux systems to attach to processes in mount namespaces other than the debugger's own when invoked with the appropriate permissions. This allows an application running in a container to be debugged by running GDB or gdbserver on the host, or by running GDB or gdbserver from within another container that shares the host's PID namespace. This series builds on the 'Do not require "file" commands for remote targets' series that is currently under review: https://sourceware.org/ml/gdb-patches/2015-04/msg00015.html It also requires the 'Do not manipulate "target:" filenames as local paths' patch to function correctly: https://sourceware.org/ml/gdb-patches/2015-04/msg00547.html A tree with the latest versions of all these patches applied is available here: https://github.com/gbenson/binutils-gdb/tree/namespaces The patches in this series are as follows: - Patch 1 (Move make_cleanup_close to common code) is a minor refactoring required for patch 3. - Patch 2 (Introduce target_fileio_set_fs) adds target-layer support for systems where different processes can have different views of the filesystem. The new function target_fileio_set_fs sets the context in which target_filesystem_is_local and the other target_fileio_* functions operate, and can be called to select the filesystem of a specific inferior or the filesystem of the debugger (GDB or gdbserver). The default implementation of target_fileio_set_fs does nothing, which means that targets where inferiors and the debugger share the same filesystem will work without modification. - Patch 3 (Introduce nat/linux-namespaces.[ch]) introduces some shared code that GDB and gdbserver can use to query and enter Linux namespaces. - GDB contained a small amount of namespace-aware code used to display a warning. Patch 4 (Remove linux_proc_pid_get_ns) replaces the querying part of this code with a call to the new code introduced by patch 3. - Patch 5 (Implement multiple-filesystem support for Linux targets) does exactly what it says on the tin. With this patch you can attach to processes in containers using the native Linux target using, e.g., "gdb -p PID". - Patch 6 (Implement multiple-filesystem support for remote targets) adds remote protocol support for remote targets where different processes can have different views of the filesystem. A new vFile:setfs packet is introduced that passes the context set using target_fileio_set_fs to the remote target. Caching is used to avoid sending unnecessary vFile:setfs packets. - Patch 7 (Implement vFile:setfs in gdbserver) implements the vFile:setfs packet in gdbserver. Currently only GNU/Linux systems support this; gdbserver on other systems will return empty responses in reply to vFile:setfs packets. Built and regtested on RHEL 6.6 x86_64. Ok to commit? Thanks, Gary -- http://gbenson.net/