From patchwork Tue Jul 25 15:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 73163 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 780403865460 for ; Tue, 25 Jul 2023 15:17:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 780403865460 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690298236; bh=rj14Vb2k65By0dmFKdCGrEncMPSUUU+xAIDkjGKYGRg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EzFmDg8MWyfCmcZJBg8fwONIvyFdgt9Wdcnwp9sUb3wT47a2uit74hU3sVEunccbr 4KvFhr3At69dfk2eP73EMy4gbTncJ/+Q+G17rEgxGmqpIuhVZhGl15PvzYcMOOcdT5 xaYH9I7puTpVKy3f/HgbFK6U8VCcwGIMq8ThnVWg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by sourceware.org (Postfix) with ESMTPS id 532143857711 for ; Tue, 25 Jul 2023 15:16:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 532143857711 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1bbafe6fd8fso4993fac.3 for ; Tue, 25 Jul 2023 08:16:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690298209; x=1690903009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rj14Vb2k65By0dmFKdCGrEncMPSUUU+xAIDkjGKYGRg=; b=SpWxuZZjwvkU9PXrbUzDHd0U+u/0M0Zmh3Gt6J++z7siBKyoJGov+uFt0KUrXPgwlR f/zolbE5+Fr04ykNFA6NOx02Jv1mkxSUuXl9uXxxqJfbVKWn9c0iOthhZCkNigTr4R5C uINCr8aJRpxIbhh+LtdTiWoj5aBbSxPEt8K/KptkbUqdSAd2r6PyLjIhZZULqRYuwJ41 EBaHlTNW2HWD0LtHWsFaVN0//ic+8sHGPIS+Ws87pri+0sdsbiz60MBo6xCPuaPUmSxw WZR1b54Xw0KmnT2CPVkJ8YVUsRx33i3VM5JUVz3vHCQ8fi8arW1rUdvEd3xT2g3RigyX dSIg== X-Gm-Message-State: ABy/qLaQ+7FVhkxT6RV9q6fqgI9j+Z6MCWESqsIUtnv5BdlNCJtmQica ZMW6fwCDGXw9qeX/SJIJ7cifEIHkcAGwGFYhn6HV2A== X-Google-Smtp-Source: APBJJlHoJ8zfGZi+sN65p0V5u37LgMdUCmG+dplgdpNXSu/JqCHsAWZvkJzD+BhK2yGhIxwq1tSu2Q== X-Received: by 2002:a05:6871:5cc:b0:1ba:bb13:d008 with SMTP id v12-20020a05687105cc00b001babb13d008mr15412225oan.33.1690298208680; Tue, 25 Jul 2023 08:16:48 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d4d2:3277:e224:7a6f:4feb]) by smtp.gmail.com with ESMTPSA id ea3-20020a056870070300b001bb9d01fe3dsm525439oab.5.2023.07.25.08.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 08:16:48 -0700 (PDT) To: libc-alpha@sourceware.org, Frederic Berat Subject: [PATCH 1/4] i386: Fix build with --enable-fortify=3 Date: Tue, 25 Jul 2023 12:16:38 -0300 Message-Id: <20230725151641.923083-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725151641.923083-1-adhemerval.zanella@linaro.org> References: <20230725151641.923083-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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" The i386 string routines provide multiple internal definitions for memcpy, memmove, and mempcpy chk routines: $ objdump -t libc.a | grep __memcpy_chk 00000000 g F .text 0000000e __memcpy_chk 00000000 g F .text 00000013 __memcpy_chk $ objdump -t libc.a | grep __mempcpy_chk 00000000 g F .text 0000000e __mempcpy_chk 00000000 g F .text 00000013 __mempcpy_chk $ objdump -t libc.a | grep __memmove_chk 00000000 g F .text 0000000e __memmove_chk 00000000 g F .text 00000013 __memmove_chk Although is not an issue for normal static builds, with fortify=3 glibc itself might use the fortify chk functions and thus static build might fail with multiple definitions. For instance: x86_64-glibc-linux-gnu-gcc -m32 -march=i686 -o [...]math/test-signgam-uchar-static -nostdlib -nostartfiles -static -static-pie [...] x86_64-glibc-linux-gnu/bin/ld: [...]/libc.a(mempcpy-ia32.o): in function `__mempcpy_chk': [...]/glibc-git/string/../sysdeps/i386/i686/mempcpy.S:32: multiple definition of `__mempcpy_chk'; [...]/libc.a(mempcpy_chk-nonshared.o):[...]/debug/../sysdeps/i386/mempcpy_chk.S:28: first defined here collect2: error: ld returned 1 exit status make[2]: *** [../Rules:298: There is no need for mem*-nonshared.S, the __mem*_chk routines are already provided by the assembly routines. Checked on i686-linux-gnu with gcc 13 built with fortify=1,2,3 and without fortify. Reviewed-by: Carlos O'Donell --- sysdeps/i386/i686/multiarch/Makefile | 3 +-- .../i686/multiarch/memcpy_chk-nonshared.S | 21 ------------------- .../i686/multiarch/memmove_chk-nonshared.S | 21 ------------------- .../i686/multiarch/mempcpy_chk-nonshared.S | 21 ------------------- 4 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S delete mode 100644 sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S delete mode 100644 sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index 9fe5ea8639..f48b06741f 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -46,6 +46,5 @@ CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse endif ifeq ($(subdir),debug) -sysdep_routines += memcpy_chk-nonshared mempcpy_chk-nonshared \ - memmove_chk-nonshared memset_chk-nonshared +sysdep_routines += memset_chk-nonshared endif diff --git a/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S deleted file mode 100644 index 6801893b72..0000000000 --- a/sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S +++ /dev/null @@ -1,21 +0,0 @@ -/* Non-shared version of memcpy_chk for i686. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if IS_IN (libc) && !defined SHARED -# include -#endif diff --git a/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S deleted file mode 100644 index c5de28d4a8..0000000000 --- a/sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S +++ /dev/null @@ -1,21 +0,0 @@ -/* Non-shared version of memmmove_chk for i686. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if IS_IN (libc) && !defined SHARED -# include -#endif diff --git a/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S b/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S deleted file mode 100644 index c4f89e156b..0000000000 --- a/sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S +++ /dev/null @@ -1,21 +0,0 @@ -/* Non-shared version of mempcpy_chk for i686. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if IS_IN (libc) && !defined SHARED -# include -#endif From patchwork Tue Jul 25 15:16:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 73164 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 9E21938432C4 for ; Tue, 25 Jul 2023 15:17:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E21938432C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690298239; bh=ekuKqRI0bWSr4cdKmY+dSE4tPkjwOxCiIyG+mIOYjOA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=mzwfM7t4pDh8zySZ4XpQteGCFQhVJpwIx0O5ARvmC1dJ7hQ5hu1nfrZC0auPBiXSQ aOgDRv3wZv/pUGeX41kQjJrtzeoCBnWAGdqP2yRcSHZAx0ouSnzl+gNauby1EtNYHk NbdIBB+y5KoYDwrbKYjMFsvDsrnQLKhnLhJyztbA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by sourceware.org (Postfix) with ESMTPS id 03411385771D for ; Tue, 25 Jul 2023 15:16:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 03411385771D Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1bba1816960so385551fac.3 for ; Tue, 25 Jul 2023 08:16:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690298210; x=1690903010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekuKqRI0bWSr4cdKmY+dSE4tPkjwOxCiIyG+mIOYjOA=; b=HE2N1MAZDlXj6RpOonps1gzo7wy0lLSm1gL6vTZHXVH6uv9JXB+KUcWtPSQA1sdN9n KNosAfadV5HI23All4mg128yzlqs3E/aB98l+3HecXrh6fFAhsYy6JwghoqEGHFZ72Mp fSDMPHcsTOcYIX+3sL00h9SYtsoiqeVzMTnIzcjycxiMNiGg6vs55hij/ULdaoG1qftH wrdr8HFcYv9nM5oZjNtkGvL/CO/HkM5HXcbAbeDDr78txGAfa3YTGeKcok5/QoGp9lEG vsU0/wp9vo6/5fbQ9yk7S2ww7HlYr7yxcjdyJFukNKO2C5UxthT70C/NKQfW9VMMD+X7 L+VQ== X-Gm-Message-State: ABy/qLbbuP+bec/p+TtlSBsdvumHoOolFt7v2A5Y1CWLsi2Y6iRh2DBX H3X+LB4hGOX8nntgLj2aKhVI9/6nhWt2j++iVhSNRQ== X-Google-Smtp-Source: APBJJlHAVvvjpHuZv/wfjAYglfx3YjjOxD8BkTf6LRSLSioaBlX0Cfet5iF1cnfBWm6K05GP7UfRRg== X-Received: by 2002:a05:6870:6112:b0:1b4:60b3:98bc with SMTP id s18-20020a056870611200b001b460b398bcmr15182667oae.2.1690298210418; Tue, 25 Jul 2023 08:16:50 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d4d2:3277:e224:7a6f:4feb]) by smtp.gmail.com with ESMTPSA id ea3-20020a056870070300b001bb9d01fe3dsm525439oab.5.2023.07.25.08.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 08:16:49 -0700 (PDT) To: libc-alpha@sourceware.org, Frederic Berat Subject: [PATCH 2/4] i386: Remove memset_chk-nonshared.S Date: Tue, 25 Jul 2023 12:16:39 -0300 Message-Id: <20230725151641.923083-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725151641.923083-1-adhemerval.zanella@linaro.org> References: <20230725151641.923083-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 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" Similar to memcpy, mempcpy, and memmove there is no need for an specific memset_chk-nonshared.S. It can be provided by memset-ia32.S itself for static library. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell --- sysdeps/i386/i686/memset.S | 2 +- sysdeps/i386/i686/multiarch/Makefile | 4 ---- sysdeps/i386/i686/multiarch/memset-ia32.S | 9 ++++---- .../i686/multiarch/memset_chk-nonshared.S | 21 ------------------- 4 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 sysdeps/i386/i686/multiarch/memset_chk-nonshared.S diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 0b5e671d83..b84dc3fbe9 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -27,7 +27,7 @@ #define LEN CHR+4 .text -#if defined SHARED && IS_IN (libc) +#if defined PIC && IS_IN (libc) ENTRY_CHK (__memset_chk) movl 12(%esp), %eax cmpl %eax, 16(%esp) diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index f48b06741f..f86e69de55 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -44,7 +44,3 @@ libm-sysdep_routines += s_fma-fma s_fmaf-fma CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse endif - -ifeq ($(subdir),debug) -sysdep_routines += memset_chk-nonshared -endif diff --git a/sysdeps/i386/i686/multiarch/memset-ia32.S b/sysdeps/i386/i686/multiarch/memset-ia32.S index ac57e456d4..a1b3919a19 100644 --- a/sysdeps/i386/i686/multiarch/memset-ia32.S +++ b/sysdeps/i386/i686/multiarch/memset-ia32.S @@ -18,16 +18,17 @@ #if IS_IN (libc) # define memset __memset_ia32 -# define __memset_chk __memset_chk_ia32 # ifdef SHARED -# undef libc_hidden_builtin_def +# define __memset_chk __memset_chk_ia32 +# endif + +# undef libc_hidden_builtin_def /* IFUNC doesn't work with the hidden functions in shared library since they will be called without setting up EBX needed for PLT which is used by IFUNC. */ -# define libc_hidden_builtin_def(name) \ +# define libc_hidden_builtin_def(name) \ .globl __GI_memset; __GI_memset = memset -# endif #endif #include diff --git a/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S b/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S deleted file mode 100644 index e68c6e43b3..0000000000 --- a/sysdeps/i386/i686/multiarch/memset_chk-nonshared.S +++ /dev/null @@ -1,21 +0,0 @@ -/* Non-shared version of memset_chk for i686. - Copyright (C) 2017-2023 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if IS_IN (libc) && !defined SHARED -# include -#endif From patchwork Tue Jul 25 15:16:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 73165 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 071983870897 for ; Tue, 25 Jul 2023 15:17:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 071983870897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690298244; bh=DgJ6I3dc3z2MUek6sIZJn5wSYmQl6Rm26C+SFS7Ffp8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PE72GkmxXOMREaGmYoBSJ4OjVKX6LYfFD8qUgO7I1bWc9rwIimI63P2s89cXLWrBx rNZEwYtl+701iYJr1mKVPFGaSdWkk2MWVgpfyPKq9afaD7EThjSJvoQ2SFE5V9Vwzo fYEYTSDfrXJZEjXPAJJvMreC7PAaqaqC6GQH7w8o= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x29.google.com (mail-oa1-x29.google.com [IPv6:2001:4860:4864:20::29]) by sourceware.org (Postfix) with ESMTPS id ECF17385AF94 for ; Tue, 25 Jul 2023 15:16:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECF17385AF94 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-1bb5ce75e43so1312322fac.3 for ; Tue, 25 Jul 2023 08:16:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690298212; x=1690903012; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DgJ6I3dc3z2MUek6sIZJn5wSYmQl6Rm26C+SFS7Ffp8=; b=O1k5otr4grF5ZqqZWz2F1j5NGLFOEpbvn4fsDigSpOOds4CRFXDC/58g0LsGNvOPNs mWeBhMEle7SgMSxTj1iMXoRMGcQG2+X9L8rCP1DACia3Ql0fKCNtt3WHHdYvKt3jkfyp Kw5Z9FjKhyVFRnFA7CbLd998NS55M4CnpE4iSy4mkqx10ehxrkj2R1UthDmYPEX1/4iM 3SJJ7qkjKtikSmYcD5BlrFU/eKGxnRZ/gOLifQPsEE2+Rw2GYEeRcp1Q5znancjErxbh NwZT1yZwRIMVKLF0LIw2f2lnVW3filoMFQxpaBUiIX4y9uNxL7WP+rwFJAHyGoGTlv1v 47wA== X-Gm-Message-State: ABy/qLaK5PIVpXdvuoWJr/xmoTnxlrVnUau5NrXR6GOdx3MF9O/IcuOR DwbKV0Yn7I4//GW1zfFGly0ta7UepFAYIT8R9pXTtA== X-Google-Smtp-Source: APBJJlH44p1rGvbdLc2dOXa0ZWILjCsb52LAe+JFKZr4V6SGYcfun5tjZoBjP7q0CMFaAuFt3AnI/Q== X-Received: by 2002:a05:6870:82a3:b0:1b0:18e8:9535 with SMTP id q35-20020a05687082a300b001b018e89535mr12532476oae.56.1690298212530; Tue, 25 Jul 2023 08:16:52 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d4d2:3277:e224:7a6f:4feb]) by smtp.gmail.com with ESMTPSA id ea3-20020a056870070300b001bb9d01fe3dsm525439oab.5.2023.07.25.08.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 08:16:51 -0700 (PDT) To: libc-alpha@sourceware.org, Frederic Berat Subject: [PATCH 3/4] linux: Fix i686 with gcc6 Date: Tue, 25 Jul 2023 12:16:40 -0300 Message-Id: <20230725151641.923083-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725151641.923083-1-adhemerval.zanella@linaro.org> References: <20230725151641.923083-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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" On __convert_scm_timestamps GCC 6 issues an warning that tvts[0]/tvts[1] maybe be used uninitialized, however it would be used if type is set to a value different than 0 (done by either COMPAT_SO_TIMESTAMP_OLD or COMPAT_SO_TIMESTAMPNS_OLD) which will fallthrough to 'common' label. It does not show with gcc 7 or more recent versions. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/convert_scm_timestamps.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c index 42f9613416..06c8adeee1 100644 --- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c +++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c @@ -23,6 +23,7 @@ # include # include # include +# include /* It converts the first SO_TIMESTAMP or SO_TIMESTAMPNS with 32-bit time and appends it to the control buffer. The 32-bit time field is kept as-is. @@ -44,7 +45,15 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize) 'struct __kernel_sock_timeval' while for SO_TIMESTAMPNS_NEW is a 'struct __kernel_timespec'. In either case it is two uint64_t members. */ + + /* GCC 6 issues an warning that tvts[0]/tvts[1] maybe be used uninitialized, + however it would be used if type is set to a value different than 0 + (done by either COMPAT_SO_TIMESTAMP_OLD or COMPAT_SO_TIMESTAMPNS_OLD) + which will fallthrough to 'common' label. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized"); int64_t tvts[2]; + DIAG_POP_NEEDS_COMMENT; int32_t tmp[2]; struct cmsghdr *cmsg, *last = NULL; From patchwork Tue Jul 25 15:16:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 73166 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 489B7385AFA2 for ; Tue, 25 Jul 2023 15:17:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 489B7385AFA2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690298279; bh=e4ibtImdR3M6FkFeEcuzMp4XHBv/txEg8FqC6BJAzh0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=cRRtqyKZ0qduYGW9I7L9aUQlQ84WzKRSk7iXle+tL93m5jyezgPcIptUXTgOQS0Hd TkKk+IJX0G7cKUYwT2kloXRx2HHOYM97ahqyl1CGthWT4YOmAW5uBx2r0e7YKDxo2w tCOyDEvVR1CYNEs8gNVuyC4Y5wdKUDQ+oSzZZQJY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by sourceware.org (Postfix) with ESMTPS id 90A06385AFA2 for ; Tue, 25 Jul 2023 15:16:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 90A06385AFA2 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-1bb29ae5975so2748609fac.2 for ; Tue, 25 Jul 2023 08:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690298214; x=1690903014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e4ibtImdR3M6FkFeEcuzMp4XHBv/txEg8FqC6BJAzh0=; b=K7D9balQ9LB1Tf+B7AVhQlLOkbRhhEURER8td8XkecTC3AJADrBa0DwNPESkPOtumf TziXNzXQDK8kC7Gb5LjL4qnV1vAnIcgLfc6rBVGm4xzaB5jP8lx785sVWEvzbfHviOzS vFUnptJzT82jXYZq29VatWAyOSYVwvF+5dnFLW33Qma8Qz4hwalLDYXWOgusz31fwmxq E7sCjLQPv11gmGq+eMkAWfuK6ylk76fm/O8HH5Dl9i/JxK641D9e1N1rsS5wFV/cgVMR u26OQ1KDclzOkpnZGrV5ZOTFkefd48GNSpq9oywiPO5wC1nWkxN7qW48sNC1PfOklMNn qa8A== X-Gm-Message-State: ABy/qLawhP9CYF5wW1gwNAScpeNuKr0glq8dqggs7mEB8L/ei+wArupn rtRhFr6diXjhUISARkiye/3K0dxKUv5XBWLiR9aWwg== X-Google-Smtp-Source: APBJJlGw+K49a7vF9NMyK6v+9zoxLyyZkfPcBIQ6kV+r9pYxKVdBd1DzpOzM2j7b/aSlAtzOVshxJQ== X-Received: by 2002:a05:6870:c110:b0:1a6:4f6a:8a72 with SMTP id f16-20020a056870c11000b001a64f6a8a72mr17109732oad.37.1690298214162; Tue, 25 Jul 2023 08:16:54 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d4d2:3277:e224:7a6f:4feb]) by smtp.gmail.com with ESMTPSA id ea3-20020a056870070300b001bb9d01fe3dsm525439oab.5.2023.07.25.08.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 08:16:53 -0700 (PDT) To: libc-alpha@sourceware.org, Frederic Berat Subject: [PATCH 4/4] string: Fix tester build with fortify enable with gcc 6 Date: Tue, 25 Jul 2023 12:16:41 -0300 Message-Id: <20230725151641.923083-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230725151641.923083-1-adhemerval.zanella@linaro.org> References: <20230725151641.923083-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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" When building with fortify enabled, GCC 6 issues an warning the fortify wrapper might overflow the destination buffer. However, GCC does not provide a specific flag to disable the warning (the failure is tied to -Werror). So to avoid disable all errors, only enable the check for GCC 7 or newer. Checked on i686-linux-gnu. Reviewed-by: Carlos O'Donell --- string/tester.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/string/tester.c b/string/tester.c index da42c72141..f7d4bac5a8 100644 --- a/string/tester.c +++ b/string/tester.c @@ -385,8 +385,17 @@ test_strncat (void) (void) strcpy (one, "gh"); (void) strcpy (two, "ef"); + /* When building with fortify enabled, GCC 6 issues an warning the fortify + wrapper might overflow the destination buffer. However, GCC does not + provide a specific flag to disable the warning (the failure is tied to + -Werror). So to avoid disable all errors, only enable the check for + GCC 7 or newer. */ +#if __GNUC_PREREQ (7, 0) (void) strncat (one, two, 99); equal (one, "ghef", 5); /* Basic test encore. */ +#else + equal (one, "gh", 2); +#endif equal (two, "ef", 6); /* Stomped on source? */ (void) strcpy (one, "");