From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from quail.birch.relay.mailchannels.net (quail.birch.relay.mailchannels.net [23.83.209.151]) by sourceware.org (Postfix) with ESMTPS id 5A714385B507 for ; Thu, 2 Feb 2023 14:37:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A714385B507 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=sourceware.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7D65A8C12FE; Thu, 2 Feb 2023 14:37:12 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C640A8C1370; Thu, 2 Feb 2023 14:37:11 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1675348631; a=rsa-sha256; cv=none; b=NezQpvKjEZqQAnxn4kM8dJDdb9ZXZ9oSZ6Dutqh/8iMItbr+NAd3aGJCWcqtrWV6vJmMTs 0aQpGKRGNztBUxlaWPN5XTu7bFu/hOhMEMFUDE91wadnaC2jNCZgUUyIMJ5reKe8YpJ8KZ xT3PEx1M4wpijv3yPTHRk8Z727ZYwuYb/MZvEf0oX0NzNDO5wJz6YvS9mx5Z2lHbqEACoH OdqokNgrkIPTdkTbS+YVgYwEsgRISKl6TRUhkpfyInVeD7QdbzriTRyx/BNPhTfi0zORgM 2hWXR2z9Trs5oWRLqt3jWrjzr/rR5/Gk5LRGG8g1YETbGGBcJx4k5GUFfXNnkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1675348631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MCBjST00n0Fe32dGUjIJ3grXL7vaz/e7EMz1Yzk22mc=; b=j227CkNgtEJOv9ClSpCxVXJ4cy5TaH7Is+iwrkOr+fg1sp57Y5WEoBC03ygEufeQgq0Zbo WPpdDLdRL3T/KRoq1nXc0D9djVQxyzno3z468At1XgsoRpk+fWWflIK7FuNBGFPIBB65QV 7A5fZedBIuF+/seLeuA8UpUgHJXuWK38ACPFQlsZSDrCwoHgnr5YngicM1ahc7r6klmQAE kMjhqor2rUSI9Lj2uDO1hqn6LCgnUdTwpNRooCCeR3FSAfXTX2UvsbAm2sUNZQGbIWPZgg nByAgXYqwKKnGvRmzgt2KPs6lNfks6W0XaYz6K8gj21k5rleXZcUD8GgYi5IqQ== ARC-Authentication-Results: i=1; rspamd-5fb8f68d88-xjnrh; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Drop-Plucky: 2c6b8bc90c25230e_1675348632050_2633664042 X-MC-Loop-Signature: 1675348632050:3242875290 X-MC-Ingress-Time: 1675348632050 Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.97.74.12 (trex/6.7.1); Thu, 02 Feb 2023 14:37:12 +0000 Received: from fedora.redhat.com (bras-vprn-toroon4834w-lp130-07-174-93-43-36.dsl.bell.ca [174.93.43.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4P71Zv1z7XzHC; Thu, 2 Feb 2023 06:37:11 -0800 (PST) From: Siddhesh Poyarekar To: libc-stable@sourceware.org Cc: Florian Weimer Subject: [committed 2.34,2.35,2.36,2.37] cdefs: Limit definition of fortification macros Date: Thu, 2 Feb 2023 09:33:36 -0500 Message-Id: <20230202143336.764189-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1173.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP 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: Define the __glibc_fortify and other macros only when __FORTIFY_LEVEL > 0. This has the effect of not defining these macros on older C90 compilers that do not have support for variable length argument lists. Also trim off the trailing backslashes from the definition of __glibc_fortify and __glibc_fortify_n macros. Signed-off-by: Siddhesh Poyarekar Reviewed-by: Florian Weimer (cherry picked from commit 2337e04e21ba6040926ec871e403533f77043c40) --- misc/sys/cdefs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 66d6702123..c37a3ff637 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -152,6 +152,7 @@ # define __glibc_objsize(__o) __bos (__o) #endif +#if __USE_FORTIFY_LEVEL > 0 /* Compile time conditions to choose between the regular, _chk and _chk_warn variants. These conditions should get evaluated to constant and optimized away. */ @@ -187,7 +188,7 @@ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ - : __ ## f ## _chk (__VA_ARGS__, __osz))) \ + : __ ## f ## _chk (__VA_ARGS__, __osz))) /* Fortify function f, where object size argument passed to f is the number of elements and not total size. */ @@ -197,7 +198,8 @@ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ - : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ + : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) +#endif #if __GNUC_PREREQ (4,3) # define __warnattr(msg) __attribute__((__warning__ (msg))) -- 2.38.1