From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9EE153857C45 for ; Mon, 24 Jul 2023 12:16:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9EE153857C45 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690200973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IaO3gKnjsmKVRJ4jMIbdwiSrEcNQUJkyh/ud17x8gf8=; b=SOM1OnfaljkkXKADDTXySyJgfRGg2GNWgH81uyJSaIfu1FxmE5wuUbSbZ6gUlRyCCG5Xgf +mEkLCP+jipCoBK6vHgsdWGNHB3RY1LH4OCe9xl1psH2AwbroQTzFCU7QDGHdZ4yunpl7N lPYndBNM1/UERMISTXAaEjsps8h38Yw= Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-Ub3S3zt_Ox2SrYWY1kZFHQ-1; Mon, 24 Jul 2023 08:16:12 -0400 X-MC-Unique: Ub3S3zt_Ox2SrYWY1kZFHQ-1 Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-583fe0f84a5so7313237b3.3 for ; Mon, 24 Jul 2023 05:16:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690200971; x=1690805771; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IaO3gKnjsmKVRJ4jMIbdwiSrEcNQUJkyh/ud17x8gf8=; b=T5Ggygk33sqJLLfSKzfXvwuFbUuekn17tyYxwOQw2uikOEux1OFzATXuPmRaAMsDBv qcqfCJs65Vy0xU2ZHAO60c4FjxK5IFVypjphghWk2MNuZ98triC7skLpfcC6Jx6ORSi+ m8zM/Unf5D2+fBu3Q0p3fhJ1M+eztUaGId4/VJxKusbAv+Kpl2LgSlaoBZ2cdCxsWzfA OYEBfbfDtXoPjFPLCB91ZDResNTf0WyXEj2WPz9OewaF2e0m+mNlHfJ3pkNJrkD0zLmp pGKj4mhq1+BdpAsr4768WSq8lDDvTmmcitH2z6Xram5inTU7Jmz+T1rU0K3eMjWTa92q 4SiA== X-Gm-Message-State: ABy/qLahDabzmy+JBjX8kYKPkuebIFyAqd80hwFdtquBwvr3MymbIybO 17ssSiQTQTU5oaWSX3Gso5OapnSAll8rH+3AW8dtsie+a+iY4KZpKyWhtT16SkuWerb+Nk1Csbc ZmERZUkq4dv6y+d0GcMCV29Udmx83 X-Received: by 2002:a81:8587:0:b0:583:7b49:15dd with SMTP id v129-20020a818587000000b005837b4915ddmr6941692ywf.48.1690200971184; Mon, 24 Jul 2023 05:16:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSw6zVO5jmCKxayA4IdJgTMLDE8ebVw8Gkq2w944nirjh0FgNGyJbn0r/SDgh+S1d98IDW+Q== X-Received: by 2002:a81:8587:0:b0:583:7b49:15dd with SMTP id v129-20020a818587000000b005837b4915ddmr6941678ywf.48.1690200970939; Mon, 24 Jul 2023 05:16:10 -0700 (PDT) Received: from [192.168.0.241] ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id w197-20020a0dd4ce000000b00583d67839fasm997149ywd.121.2023.07.24.05.16.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jul 2023 05:16:10 -0700 (PDT) Message-ID: <83c77f62-3f07-933d-f1ca-d408fec016e2@redhat.com> Date: Mon, 24 Jul 2023 08:16:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 1/3] posix: Fix test-errno build with fortify enable To: Adhemerval Zanella , libc-alpha@sourceware.org, Frederic Berat References: <20230721121817.1978446-1-adhemerval.zanella@linaro.org> <20230721121817.1978446-2-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <20230721121817.1978446-2-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 7/21/23 08:18, Adhemerval Zanella via Libc-alpha wrote: > With gcc 11.3.1, building with -D_FORTIFY_SOURCE=2 shows: > > In function ‘getgroups’, > inlined from ‘do_test’ at test-errno.c:129:12: > ../misc/sys/cdefs.h:195:6: error: argument 1 value -1 is negative > [-Werror=stringop-overflow=] > 195 | ? __ ## f ## _alias (__VA_ARGS__) > \ > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ../posix/bits/unistd.h:115:10: note: in expansion of macro > ‘__glibc_fortify’ > 115 | return __glibc_fortify (getgroups, __size, sizeof (__gid_t), > | ^~~~~~~~~~~~~~~ > ../posix/bits/unistd.h: In function ‘do_test’: > ../posix/bits/unistd-decl.h:135:28: note: in a call to function > ‘__getgroups_alias’ declared with attribute ‘access (write_only, 2, 1)’ > 135 | extern int __REDIRECT_NTH (__getgroups_alias, (int __size, > __gid_t __list[]), > | ^~~~~~~~~~~~~~~~~ > ../misc/sys/cdefs.h:264:6: note: in definition of macro ‘__REDIRECT_NTH’ > 264 | name proto __asm__ (__ASMNAME (#alias)) __THROW > > It builds fine with gcc 12 and gcc 13. > > Checked on x86_64-linux-gnu. > --- > posix/test-errno.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/posix/test-errno.c b/posix/test-errno.c > index 305bc42938..3ef711bb41 100644 > --- a/posix/test-errno.c > +++ b/posix/test-errno.c > @@ -17,6 +17,10 @@ > License along with the GNU C Library; if not, see > . */ > > +#include > +/* Triggered by getgroup fortify wrapper. */ > +DIAG_IGNORE_NEEDS_COMMENT (6, "-Wstringop-overflow"); Why "6"? This should be the most recent version of gcc which the warnings appears in. Shouldn't this be 11.3? We also have some of this logic: 124 #if __GNUC_PREREQ (7, 0) 125 DIAG_PUSH_NEEDS_COMMENT; 126 /* Avoid warnings about the second (size) argument being negative. */ 127 DIAG_IGNORE_NEEDS_COMMENT (10.1, "-Wstringop-overflow"); 128 #endif 129 fails |= test_wrp (EINVAL, getgroups, -1, 0); 130 #if __GNUC_PREREQ (7, 0) 131 DIAG_POP_NEEDS_COMMENT; 132 #endif Is it the same code triggering? > + > #include > #include > #include > @@ -34,7 +38,6 @@ > #include > #include > #include > -#include > > /* This is not an exhaustive test: only system calls that can be > persuaded to fail with a consistent error code and no side effects -- Cheers, Carlos.