From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12559 invoked by alias); 20 Apr 2015 16:49:46 -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 12541 invoked by uid 89); 20 Apr 2015 16:49:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f169.google.com Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 20 Apr 2015 16:49:43 +0000 Received: by wizk4 with SMTP id k4so107219754wiz.1 for ; Mon, 20 Apr 2015 09:49:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=WU8pY6p/BAFK8o7PO7SneYo2nkkoLG+z8temdXkDnCg=; b=dcmxf8Mhv3SL9pUyOcHiCKnFV1iGSp9+qQdHCL/GuL99TPMKOO9g5XBfmXs9AwiTvD /K3cLX3fRqRY5PyilqmkOCYV1hAQCbRylMPDLaOyi/6rHudUECO7lNEGMOBCQXinOEUm 7+Ouxyg5w0DvGsE0ztuKIW+kA4rSefQpzQQrrZdVLHcvF+9DSiRcJarI0AmuYZHj85R2 K7Cadt1tHrzU5+/QSocSFwFaO04dd9IrFjCcMQtieRX1EDP4dm3oKf+cdnuVLal7EIBu jzbxj4bC1qX/xAMh0/imlGqXuMq1gAk550ODaAYqwfXb0QeqgzxDptiWJkOXIU0EdNx1 wvBQ== X-Gm-Message-State: ALoCoQkcFliF7P2BTOsM8/DolM48oZMxCCbGUiPcdkL5Y2S+X15YcUrfiwAuFeQwxGFqUDF8Q8IM X-Received: by 10.194.59.79 with SMTP id x15mr8262914wjq.81.1429548581028; Mon, 20 Apr 2015 09:49:41 -0700 (PDT) Received: from [192.168.178.80] (p4FFA421A.dip0.t-ipconnect.de. [79.250.66.26]) by mx.google.com with ESMTPSA id eu3sm28011999wjb.16.2015.04.20.09.49.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 09:49:40 -0700 (PDT) Message-ID: <55352E23.40303@endocode.com> Date: Mon, 20 Apr 2015 16:49:00 -0000 From: =?UTF-8?B?SWFnbyBMw7NwZXogR2FsZWlyYXM=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [PATCH 0/7] GNU/Linux mount namespace support References: <1429186791-6867-1-git-send-email-gbenson@redhat.com> In-Reply-To: <1429186791-6867-1-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00747.txt.bz2 Thanks a lot for the patches! I've got a small feature request. If the process inside the mount namespace is running on a chroot I believe it won't work (I couldn't test it because the patches don't work for me[1]). The reason I want this feature is that rkt[2] runs several apps in a container, each one on its own chroot and I'd like to debug programs running there. Maybe you could detect if it's runinng on a chroot by reading /proc/$PID/root, comparing it to / and, if they're different, use the former to get the binary. What do you think about it? Thanks again. Cheers. [1]: Context from an IRC conversation with gbenson: My gdb is multi-threaded and multi-threaded programs can't change mount namespaces, he is already working on a fix. [2]: https://github.com/coreos/rkt On 04/16/2015 02:19 PM, Gary Benson wrote: > 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/ > -- Iago López Galeiras Software developer @ Endocode AG iago@endocode.com ------ Endocode AG, Johannisstrasse 20, 10117 Berlin info@endocode.com | www.endocode.com Vorstandsvorsitzender: Mirko Boehm Vorstände: Dr. Karl Beecher, Chris Kühl, Sebastian Sucker Aufsichtsratsvorsitzende: Jennifer Beecher Registergericht: Amtsgericht Charlottenburg - HRB 150748 B