From patchwork Wed Jun 13 03:35:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 928637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-93127-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="vGmPe8KU"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 415C8002PHz9s1B for ; Wed, 13 Jun 2018 13:35:43 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=fAp 0f/C37KmjCmogG9BONP8tXBum9s1UiTo3Zvpu5ehqBm9TndpkahPX2QKWZ7PLi8q SMK4wuln+KOPzMtLNCk99b2vgqXlSujU7aU1bmQsbdi4KJwLnBteVA3pt4GkKv0S Kr+qfwLiAKs7DvEIUaF9Phv0IZH2aar/BfttD9WQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=TPG4GO5X9 riGkO5jQ5BiznBGeaE=; b=vGmPe8KUjh5O9hZIaf1U/957IN3EaPg2hCd518dCg IxIwghSXLbY3Ba4G4ZjDAPRc99Nf9giUgrLhU30B6uwgz1T+iyJsJ15ImxFrsCLE 8a/fmEpMwhpc3QmI/dTw4usTDYbSq9Sb+LoaxNGNIaDaYHEDcEsUwvV9rngt9GV/ OA= Received: (qmail 23016 invoked by alias); 13 Jun 2018 03:35:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23005 invoked by uid 89); 13 Jun 2018 03:35:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=HTo:U*dj X-HELO: mail-qt0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=7qv+uwtGTYpQfG8OkuS2dZsbVNFJnNbLlRwQYTos4o0=; b=aN0tjZoJt+Uygk0eJnz/kkkvHCPtXtSDQJ9J0TvNsF2d1aT+nECiQPUvqLBUg7qACT fZCr4uri2RzbkVTyGFTSxH12qJF6ryVhQrpE7FsrLxMnHn0fJrq3ZYLKggAWQ5NMEhKO Uw2qC3m7CacWcQ54VkAEiKd1pNswy5jKN7W8uy/Ev0Aqpz8ucOFV006xNR8UtqKM3cM0 6MTedqTJ0kDEEeuhLCrtYXh+BjsWs0emvllPZD4wV0D1egQv5yWjgFlgfhw1kUP5ynfw by69gJmMeV76ey6uJM0Mq0YioJS4LuvrzvW1AvffoTHzd5tlalR6Wwx6o1cKa+LC6zXO pRHg== X-Gm-Message-State: APt69E0xkNUVgtFafTr/6JVz/q+i409I+yNvXVv+coUTH9MWyyHQzpGb VmUcjFvxqOXxT98x+FWi9I40Iw== X-Google-Smtp-Source: ADUXVKLF/g3pLB8OG6bLqiUPK+BxOQEyCDQdiTcvLYlgBTb1gRMT1KqvqPb8T8TYaTsylpw366/nfg== X-Received: by 2002:ac8:3578:: with SMTP id z53-v6mr2988816qtb.323.1528860934074; Tue, 12 Jun 2018 20:35:34 -0700 (PDT) To: GNU C Library , DJ Delorie From: Carlos O'Donell Subject: [COMMITTED] Fix comments in _dl_dst_count and _dl_dst_substitute. Message-ID: <990e2361-a990-e674-248c-7113f68a5b0f@redhat.com> Date: Tue, 12 Jun 2018 23:35:31 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 DJ Delorie pointed out some obvious comment mistakes in the DST changes. Thanks DJ! --- The comments in _dl_dst_count is adjusted to match what the code does which is count DSTs from the start of the string. With the removal of DL_DST_COUNT we no longer accept an input that starts at the first $. In _dl_dst_substitute we adjust the comment to indicate that both conditions must be true for the SUID/SGID $ORIGIN exception. --- ChangeLog | 3 +++ elf/dl-load.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3ba045896..9fbd48d848 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-12 Carlos O'Donell + * elf/dl-load (_dl_dst_substitute): Correct comment. + (_dl_dst_count): Likewise. + * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Call lll_futex_timed_wait. diff --git a/elf/dl-load.c b/elf/dl-load.c index e81601f36d..09185ab68d 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -219,11 +219,11 @@ is_dst (const char *input, const char *ref) return rlen; } -/* INPUT is the start of a DST sequence at the first '$' occurrence. - If there is a DST we call into _dl_dst_count to count the number of - DSTs. We count all known DSTs regardless of __libc_enable_secure; - the caller is responsible for enforcing the security of the - substitution rules (usually _dl_dst_substitute). */ +/* INPUT should be the start of a path e.g DT_RPATH or name e.g. + DT_NEEDED. The return value is the number of known DSTs found. We + count all known DSTs regardless of __libc_enable_secure; the caller + is responsible for enforcing the security of the substitution rules + (usually _dl_dst_substitute). */ size_t _dl_dst_count (const char *input) { @@ -292,7 +292,9 @@ _dl_dst_substitute (struct link_map *l, const char *input, char *result) * $ORIGIN appears as the first path element, and is the only string in the path or is immediately followed by a path separator and the rest of the - path. + path, + + and ... * The path is rooted in a trusted directory.