From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86580 invoked by alias); 24 Aug 2017 14:53:34 -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 86556 invoked by uid 89); 24 Aug 2017 14:53:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Thu, 24 Aug 2017 14:53:32 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4362DC03BD73; Thu, 24 Aug 2017 14:53:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4362DC03BD73 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3EF96F441; Thu, 24 Aug 2017 14:53:29 +0000 (UTC) Subject: Re: [PATCH v2] gdbserver: linux_low: elf_64_file_p cache results To: Jon Ringle References: <1503549910-24770-1-git-send-email-jon@ringle.org> <402cb282-9cd1-2725-f6de-ec5f9eb15e0d@redhat.com> Cc: gdb-patches@sourceware.org, Jon Ringle From: Pedro Alves Message-ID: Date: Thu, 24 Aug 2017 14:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg00472.txt.bz2 On 08/24/2017 03:42 PM, Pedro Alves wrote: > I'm still mystified about why can't gdbserver read > the file after "droproot" has changed user. > I assume gdbserver is running as root? Why wouldn't > a gdbserver running as root be able to read "jringle"'s > /proc file? > > Does CAP_PTRACE make a difference? FAOD, I meant CAP_SYS_PTRACE. See for example here: http://man7.org/linux/man-pages/man5/proc.5.html ~~~ /proc/[pid]/exe ... Permission to dereference or read (readlink(2)) this symbolic link is governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see ptrace(2). ~~~ [and follow on to ptrace(2).] > > I have to wonder whether there's a better way to do this.. > gdbserver needs to read other /proc files, some not cacheable. > I fear that you may have run into just one case so far, and > that we may run into problems if we take this route. Thanks, Pedro Alves