From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from caracal.birch.relay.mailchannels.net (caracal.birch.relay.mailchannels.net [23.83.209.30]) by sourceware.org (Postfix) with ESMTPS id 5C00F3854803 for ; Fri, 8 Jan 2021 04:31:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C00F3854803 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 5EAB8104A01; Fri, 8 Jan 2021 04:31:50 +0000 (UTC) Received: from pdx1-sub0-mail-a10.g.dreamhost.com (100-96-1-8.trex.outbound.svc.cluster.local [100.96.1.8]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E864C10436A; Fri, 8 Jan 2021 04:31:49 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a10.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.11); Fri, 08 Jan 2021 04:31:50 +0000 X-MC-Relay: Junk X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Share-Wide-Eyed: 68424df721c22b51_1610080310171_1284301104 X-MC-Loop-Signature: 1610080310171:1266031031 X-MC-Ingress-Time: 1610080310171 Received: from pdx1-sub0-mail-a10.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a10.g.dreamhost.com (Postfix) with ESMTP id AE2BB7ED5E; Thu, 7 Jan 2021 20:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=d1WsKL +fzaOiDXp7MA78NLe0eJM=; b=PXNT5AUyNUE2Uiq99rbYlsIHcHCQCJnZvv/6yW GT+ERdRk3G2/Gj1P0llsEi5tDdiR67HzhDcXs1TJpAWvbjjUmzHAWwR/EfDHuQZC 4Y4ZIChVJ4eLcFS36elKESi3SvhTarMvODaJdedFM4Xzvx6wJr0ZkIzaxJq8L1Ws Y+3BM= Received: from [192.168.86.152] (unknown [103.199.172.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a10.g.dreamhost.com (Postfix) with ESMTPSA id 3D1077F012; Thu, 7 Jan 2021 20:31:47 -0800 (PST) Subject: Re: [PATCH] correct readlinkat attribute access (BZ #27024) To: Martin Sebor , GNU C Library References: X-DH-BACKEND: pdx1-sub0-mail-a10 From: Siddhesh Poyarekar Message-ID: <42f6934f-da58-0d1c-d953-4504ba240a42@gotplt.org> Date: Fri, 8 Jan 2021 10:01:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 04:31:53 -0000 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.=C2=A0 The mode should be > write_only. >=20 > The trivial patch below corrects this mistake.=C2=A0 Unless there > are objections I'll go ahead and commit it in the next few days. >=20 > Martin >=20 > 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 __tof= d, > =C2=A0/* Like readlink but a relative PATH is interpreted relative to = FD.=C2=A0 */ > =C2=A0extern ssize_t readlinkat (int __fd, const char *__restrict __pa= th, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 char *__restrict __buf, size_t __len) > -=C2=A0=C2=A0=C2=A0=C2=A0 __THROW __nonnull ((2, 3)) __wur __attr_acces= s ((__read_only__, 3,=20 > 4)); > +=C2=A0=C2=A0=C2=A0=C2=A0 __THROW __nonnull ((2, 3)) __wur __attr_acces= s ((__write_only__,=20 > 3, 4)); > =C2=A0#endif Why do we need an access attribute at all for __len, let alone a=20 __write_only__ one? Siddhesh