From patchwork Mon Jul 24 19:38:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 73134 Return-Path: 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 8CF563857835 for ; Mon, 24 Jul 2023 19:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CF563857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690227538; bh=AuPuPd5U4cqNtqTQTiSW5YLlhHzt7iNGl2YK8juGBx0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=dO0/99IP9wbYb7T89X9a1SvjtzFBYItbe0lmLw1brFvxWv+kJusWE8390Om1HCQ85 8DPk+uHrYYrJuQvZ7hbd8Fyt+EKPxsEaxjRTC4QQ2L7jdDAjmlXInSVqMVZqa1PaG+ 7p47qIAv8Xj8X4iOMOUA6appABoX1uMVJfTGL3qk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by sourceware.org (Postfix) with ESMTPS id C72F33858C5F for ; Mon, 24 Jul 2023 19:38:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C72F33858C5F Received: by mail-oo1-xc32.google.com with SMTP id 006d021491bc7-56352146799so3334384eaf.3 for ; Mon, 24 Jul 2023 12:38:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690227503; x=1690832303; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AuPuPd5U4cqNtqTQTiSW5YLlhHzt7iNGl2YK8juGBx0=; b=W+VXQipUhfY+8HtLgGo9JSaG0diEjY8e2B64wOKenTaF9ZykzSeiJdfhKgPssj3Plg UFUUGHJenBFwMmIt5LMDDaoOca07XxLv0QqoW339kXkvmXvtn+guiF70r/0FKks99iKz cf8lr13B6R/9ke2YKVdcgZ9LtAmqyKpJeEFsM9HLoyvftIKW0Rw6MOJwP6WuSWqlOdHn ci3uA+h1A/rRbRWUP5pTGZZWSol0SJTdBmr2Kkw5LvYgcRIig6n9TEn48XjbNunefk2O PXoFhZB6XPJIsV4Ro7fasMko3hh48N9A+WrQODHTFszdTMW1TmbiACOt6GVI/DSdAK9k 2QXw== X-Gm-Message-State: ABy/qLaUGPCsTEMva9X9ii1r01eGOyb73tjNrl9QXrn3+0cwROp8ISyg TAY9qpYvTv4CzkuYD148P4IDZFKDVf/+xkcuYN42Xw== X-Google-Smtp-Source: APBJJlEqovtNeUDyKNQsIkkvlJC0SNsuD/4SSy1pGKeIygl0mP7czmx3xQu/sXZfvwI+gjgXI71dUQ== X-Received: by 2002:a05:6808:14d0:b0:3a1:a57d:fa71 with SMTP id f16-20020a05680814d000b003a1a57dfa71mr13622879oiw.32.1690227503278; Mon, 24 Jul 2023 12:38:23 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d4d2:46e0:428c:6669:da90]) by smtp.gmail.com with ESMTPSA id bd3-20020a056808220300b003a3600182f8sm4385643oib.57.2023.07.24.12.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 12:38:22 -0700 (PDT) To: libc-alpha@sourceware.org, Carlos O'Donell , Frederic Berat Subject: [PATCH v2] posix: Fix test-errno build with fortify enable Date: Mon, 24 Jul 2023 16:38:17 -0300 Message-Id: <20230724193817.510337-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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. Reviewed-by: Carlos O'Donell --- posix/test-errno.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/posix/test-errno.c b/posix/test-errno.c index 305bc42938..3685fd1555 100644 --- a/posix/test-errno.c +++ b/posix/test-errno.c @@ -17,6 +17,13 @@ License along with the GNU C Library; if not, see . */ +#include +#include +#if __GNUC_PREREQ (7, 0) +/* Triggered by getgroup fortify wrapper. */ +DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow"); +#endif + #include #include #include @@ -34,7 +41,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