From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50057 invoked by alias); 24 Jul 2015 19:10:31 -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 50003 invoked by uid 89); 24 Jul 2015 19:10:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham 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; Fri, 24 Jul 2015 19:10:30 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 9693619EF37; Fri, 24 Jul 2015 19:10:28 +0000 (UTC) Received: from localhost (unused-10-15-17-51.yyz.redhat.com [10.15.17.51]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6OJARik015797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 24 Jul 2015 15:10:28 -0400 From: Sergio Durigan Junior To: Simon Marchi Cc: GDB Patches Subject: Re: [PATCH] Make sure GDB uses a valid shell when starting the inferior and to perform the "shell" command References: <1437761993-18758-1-git-send-email-sergiodj@redhat.com> <55B2850D.6030306@ericsson.com> X-URL: http://blog.sergiodj.net Date: Fri, 24 Jul 2015 19:10:00 -0000 In-Reply-To: <55B2850D.6030306@ericsson.com> (Simon Marchi's message of "Fri, 24 Jul 2015 14:33:49 -0400") Message-ID: <87k2tp5q3g.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00717.txt.bz2 On Friday, July 24 2015, Simon Marchi wrote: > On 15-07-24 02:19 PM, Sergio Durigan Junior wrote: >> It is known that GDB needs a valid shell to start the inferior and to >> offer the "shell" command to the user. This has recently been the >> cause of a problem on the MIPS buildslave, because $SHELL was set to >> /sbin/nologin and several tests were failing. The thread is here: >> >> >> >> However, I think we can do better than that. If 'startup-with-shell' >> is on, which is the default, we blindly trust that the user will >> provide a valid shell for us, and this may not be true all the time. >> So I am proposing a patch to increment the tests made by GDB before >> running the inferior to decide whether it will use $SHELL or not. >> Particularly, I created a new function, called "valid_shell", which >> defines the concept of a valid shell for GDB: >> >> - A file that exists and is executable by the user >> >> - A file that is not /sbin/nologin > > Note that on my Ubuntu 14.04: > > $ which nologin > /usr/sbin/nologin /sbin/nologin is probably a symlink to this file, isn't it? But yeah, the check could include /usr/sbin/nologin as well. > I think that /bin/false is also commonly specified as the default shell > for system users (at least according to my /etc/passwd). Indeed. I will include /bin/false as well. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/