From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 9A9EA389365C for ; Thu, 30 Apr 2020 22:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9A9EA389365C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 6F6A072CCED for ; Fri, 1 May 2020 01:37:42 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 5B6677CF5AE; Fri, 1 May 2020 01:37:42 +0300 (MSK) Date: Fri, 1 May 2020 01:37:42 +0300 From: "Dmitry V. Levin" To: libc-alpha@sourceware.org Subject: Re: [PATCH] improve out-of-bounds checking with GCC 10 attribute access [BZ #25219] Message-ID: <20200430223742.GA24169@altlinux.org> References: <1b67cd2a-3254-fbd4-4345-7bc282f7cdd0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1b67cd2a-3254-fbd4-4345-7bc282f7cdd0@gmail.com> X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 22:37:45 -0000 On Thu, Apr 30, 2020 at 04:12:32PM -0600, Martin Sebor via Libc-alpha wrote: [...] > --- a/libio/bits/stdio2.h > +++ b/libio/bits/stdio2.h > @@ -241,7 +241,8 @@ gets (char *__str) > #endif > > extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, > - FILE *__restrict __stream) __wur; > + FILE *__restrict __stream) > + __wur __attr_access ((__read_only__, 1, 2)); This has to be __write_only__, i.e. the same attribute that is being added to __fgets_unlocked_chk below. > extern char *__REDIRECT (__fgets_alias, > (char *__restrict __s, int __n, > FILE *__restrict __stream), fgets) __wur; > @@ -299,7 +300,8 @@ fread (void *__restrict __ptr, size_t __size, size_t __n, > > #ifdef __USE_GNU > extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, > - int __n, FILE *__restrict __stream) __wur; > + int __n, FILE *__restrict __stream) > + __wur __attr_access ((__write_only__, 1, 2)); > extern char *__REDIRECT (__fgets_unlocked_alias, > (char *__restrict __s, int __n, > FILE *__restrict __stream), fgets_unlocked) __wur; -- ldv