From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 877ED3954457 for ; Wed, 6 May 2020 21:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 877ED3954457 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-_xSu7bYqMGex6Of9Foh9Ig-1; Wed, 06 May 2020 17:08:12 -0400 X-MC-Unique: _xSu7bYqMGex6Of9Foh9Ig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3FB7F1895A29; Wed, 6 May 2020 21:08:11 +0000 (UTC) Received: from greed.delorie.com (ovpn-112-52.phx2.redhat.com [10.3.112.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09DCC5F7E2; Wed, 6 May 2020 21:08:10 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.14.7/8.14.7) with ESMTP id 046L89GM031566; Wed, 6 May 2020 17:08:09 -0400 From: DJ Delorie To: Joseph Myers Cc: msebor@gmail.com, libc-alpha@sourceware.org Subject: Re: [PATCH] improve out-of-bounds checking with GCC 10 attribute access [BZ #25219] In-Reply-To: (message from Joseph Myers on Wed, 6 May 2020 20:44:38 +0000) Date: Wed, 06 May 2020 17:08:09 -0400 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Wed, 06 May 2020 21:08:15 -0000 Joseph Myers writes: > test-errno.c:122:30: error: argument 1 value -1 is negative [-Werror=3Dst= ringop-overflow=3D] "size" is "int" but passing a negative buffer size? If gcc knows that the size is a count of elements, a warning (or error, if -Werror) seems appropriate (if annoying ;). However, I can see we're now in the "how do I dumb down gcc so I can test things I know it knows are errors?" territory. Probably a #pramga GCC warning no-stringop-overflow or equivalent for that whole test. > test-errno.c:137:30: error: 'readlink' specified size 1844674407370955161= 5 exceeds maximum object size 9223372036854775807 [-Werror=3Dstringop-overf= low=3D] Here you're passing -1 to a size_t argument, I think that test needs tweaking anyway. > 137 | fails |=3D test_wrp (EINVAL, readlink, "/", buf, -1);