Message ID | b39497cd-12ae-981c-73d4-22e99d57ba77@gmail.com |
---|---|
State | Committed |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A77F43971C08; Fri, 8 Jan 2021 00:49:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A77F43971C08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610066951; bh=C4XKaJRxFwGQIV6yxfndN+YQNGkkfqRoVniCLRnoSQo=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Pmsr8rOxwlgZoXD0zcuupHCL/jZjsfVw2y84PIMeOONwHq32rCIy4YUXbzm648YfW X/ELN3NE/GJT48A6plTY/qcTYOSaqtNvTaK1+KApeKWhzsg+eJH6dwXJhTRZGK0mpk ymSITwAYJpuyq/gS/VqRZ9LPGBNPCAfLEnW7EZ6A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 471193971836 for <libc-alpha@sourceware.org>; Fri, 8 Jan 2021 00:49:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 471193971836 Received: by mail-il1-x12d.google.com with SMTP id q1so8641224ilt.6 for <libc-alpha@sourceware.org>; Thu, 07 Jan 2021 16:49:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=C4XKaJRxFwGQIV6yxfndN+YQNGkkfqRoVniCLRnoSQo=; b=M81QVr7NZvP1h5mQBKhO8gf2prfSUdkusQdBQi1gPDSfe6GKixpHB+m/L7XrufFeAN f0pAEKh3hW2z4Olrj4F+hU4cx1oDplMOmg0AEt8/BMg8T5vJGgRg6lm2vDiH2A6nTm2/ EAKy93g2S0R8jzxBuCZTuRDOyk0xi1bG8FQFQIlXU8qdY24A+QKqfiv7TS9riSCMmITg ywz9aeXtLuvoXDqSAw4eU7FOefq2b5wzDCeJ9FFkMNhBbtja4o6rIUScrGrwzPtoPAn4 MzFOxBbdE1WCNYiEK0g/SKN8hIbJ/m5aBWPTgWfFOq6tbmwVQ4Ct6SNFeYKRqU3hHqhH tYUQ== X-Gm-Message-State: AOAM530sEaF36IqHgxGigL2SiWx/Xb6y4jhLJQg4qFNB3GmKNhWrH/VO d6sr51VoMY4yBuXj9SswCU+uMEI75kc= X-Google-Smtp-Source: ABdhPJyOEm8SWRCMBRIfBAIR/yiRH+9OqAwptoXE2KuYey16gDB3rfLYqQXy5zK9UwiYe3CsO7TGxA== X-Received: by 2002:a92:418d:: with SMTP id o135mr1520881ila.213.1610066949670; Thu, 07 Jan 2021 16:49:09 -0800 (PST) Received: from [192.168.0.41] (75-166-96-128.hlrn.qwest.net. [75.166.96.128]) by smtp.gmail.com with ESMTPSA id t21sm6000134ild.86.2021.01.07.16.49.07 for <libc-alpha@sourceware.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 16:49:07 -0800 (PST) Subject: [PATCH] correct readlinkat attribute access (BZ #27024) To: GNU C Library <libc-alpha@sourceware.org> Message-ID: <b39497cd-12ae-981c-73d4-22e99d57ba77@gmail.com> Date: Thu, 7 Jan 2021 17:49:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Martin Sebor via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Martin Sebor <msebor@gmail.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
correct readlinkat attribute access (BZ #27024)
|
|
Commit Message
Martin Sebor
Jan. 8, 2021, 12:49 a.m. UTC
The mode in the new attribute access added in g:06febd8c670 to readlinkat() for the third argument is wrong: it's read_only but the function writes into the object. The mode should be write_only. The trivial patch below corrects this mistake. Unless there are objections I'll go ahead and commit it in the next few days. Martin /* Remove the link NAME. */
Comments
On 1/8/21 6:19 AM, Martin Sebor via Libc-alpha wrote: > The mode in the new attribute access added in g:06febd8c670 > to readlinkat() for the third argument is wrong: it's read_only > but the function writes into the object. The mode should be > write_only. > > The trivial patch below corrects this mistake. Unless there > are objections I'll go ahead and commit it in the next few days. > > Martin > > diff --git a/posix/unistd.h b/posix/unistd.h > index 1306aded46..3f22763379 100644 > --- a/posix/unistd.h > +++ b/posix/unistd.h > @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd, > /* Like readlink but a relative PATH is interpreted relative to FD. */ > extern ssize_t readlinkat (int __fd, const char *__restrict __path, > char *__restrict __buf, size_t __len) > - __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, > 4)); > + __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, > 3, 4)); > #endif Why do we need an access attribute at all for __len, let alone a __write_only__ one? Siddhesh
Siddhesh Poyarekar, le ven. 08 janv. 2021 10:01:22 +0530, a ecrit: > On 1/8/21 6:19 AM, Martin Sebor via Libc-alpha wrote: > > @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd, > > /* Like readlink but a relative PATH is interpreted relative to FD. */ > > extern ssize_t readlinkat (int __fd, const char *__restrict __path, > > char *__restrict __buf, size_t __len) > > - __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, > > 4)); > > + __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, > > 3, 4)); > > #endif > > Why do we need an access attribute at all for __len, let alone a > __write_only__ one? ? This is not on __len, this is on __buf (arg 3) for __len bytes (arg 4) Samuel
On 1/8/21 2:36 PM, Samuel Thibault wrote: >> Why do we need an access attribute at all for __len, let alone a >> __write_only__ one? > > ? This is not on __len, this is on __buf (arg 3) for __len bytes (arg 4) > Ugh, sorry I misread that. Siddhesh
I committed & pushed this in g:2cd361b511. Martin On 1/7/21 5:49 PM, Martin Sebor wrote: > The mode in the new attribute access added in g:06febd8c670 > to readlinkat() for the third argument is wrong: it's read_only > but the function writes into the object. The mode should be > write_only. > > The trivial patch below corrects this mistake. Unless there > are objections I'll go ahead and commit it in the next few days. > > Martin > > diff --git a/posix/unistd.h b/posix/unistd.h > index 1306aded46..3f22763379 100644 > --- a/posix/unistd.h > +++ b/posix/unistd.h > @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd, > /* Like readlink but a relative PATH is interpreted relative to FD. */ > extern ssize_t readlinkat (int __fd, const char *__restrict __path, > char *__restrict __buf, size_t __len) > - __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, > 4)); > + __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, > 3, 4)); > #endif > > /* Remove the link NAME. */
diff --git a/posix/unistd.h b/posix/unistd.h index 1306aded46..3f22763379 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -831,7 +831,7 @@ extern int symlinkat (const char *__from, int __tofd, /* Like readlink but a relative PATH is interpreted relative to FD. */ extern ssize_t readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) - __THROW __nonnull ((2, 3)) __wur __attr_access ((__read_only__, 3, 4)); + __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4)); #endif