From patchwork Fri Mar 24 14:40:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 66854 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 9584C388217F for ; Fri, 24 Mar 2023 14:40:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9584C388217F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679668845; bh=gde/+gDWdBa4Mk2t4x6NOYbafdJt0oVFIid5RX+gL9Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Sz91DcUFz6QY/t3HE3UW3PgAE+wKh79E2K/USGTGVUtedmAsTiLbXmB8zGcK5vL1p M/c1GndAddrOmmJQlaI83JGesXWj7LUATaZdwPB6iGYRp7LDQZy1Iyc9alQYCoPCP9 N6PdnPqc6J4Zubm1MN9MS1aa1q/OxzNm3j7JHVWA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from purple.birch.relay.mailchannels.net (purple.birch.relay.mailchannels.net [23.83.209.150]) by sourceware.org (Postfix) with ESMTPS id 4EB253858D35 for ; Fri, 24 Mar 2023 14:40:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EB253858D35 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 EC1B94155F for ; Fri, 24 Mar 2023 14:40:20 +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 9012C42376 for ; Fri, 24 Mar 2023 14:40:20 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1679668820; a=rsa-sha256; cv=none; b=V0dN27jsvVSlAK/+TvZGOM23G+AfH9xG9T/INM7vY1sP/xwUzxwVr8m8fxXat3HaGvFm0F OJpyA7y4aaENj3RXtyAlf2WUfGDNTcsgYRb2mUYq4S/wWHp6fTR3xP2bHcGZpH9YI1buWQ 0E6jEyQwZaAKOsKf7yNPOvBxsVQZBAH1yv+X1b1IschG0w1rdALCz5qwbFS7yBxvbNc8Ew FjEwTlikSbW/wuA07AvaIOaenwEk3QvWACThgjIqF3IV4OHvQj8gTfpZQhFGu9kkh6qfCI 90V21zuoGL/NG12xO28e+1zCaWk+oQI+SqEmYwLDv7Sb7MXTBwvzTe+nbkr1Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1679668820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gde/+gDWdBa4Mk2t4x6NOYbafdJt0oVFIid5RX+gL9Y=; b=SJKsjIvhNhqnGMhrY03qurtBrhIB2SoeivveBFO7+Berqj7mg0Ty5Lnh+NFqX4XHoqEiT5 ahmSVxxUAAD2nd1Vi5e2+OuAEdqsIgTDy3gvSRsM15OcrzPiwrYU4b5+IyR2xsfqNdNP4I eh4VtnNu19mI2Ufkdlj9GHZ0oJ4nRNz05gm+YSFb57ibzzRax+NSS8qu6H+Nb3T0PSwD7F z1Byxx2fDtka+IOcvZS/OSz5/7m8nhzbtX41udGymoYTEXhwyzHu9qacYOv1QoA6F9yxJU AZDRhR3FgB7sgPYfnz2Yu6WfOwn0G3iySuF+QGarkn3l2BQxXCEXi3CeH5Hq/w== ARC-Authentication-Results: i=1; rspamd-c98fcbcd4-n598t; 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-Squirrel-Interest: 4241a86636a337b8_1679668820795_2899802917 X-MC-Loop-Signature: 1679668820795:1524340872 X-MC-Ingress-Time: 1679668820795 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.102.66.37 (trex/6.7.2); Fri, 24 Mar 2023 14:40:20 +0000 Received: from fedora.redhat.com (bras-vprn-toroon4834w-lp130-09-174-91-45-153.dsl.bell.ca [174.91.45.153]) (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 4PjlHS1NYhz1Y for ; Fri, 24 Mar 2023 07:40:20 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] manual: Document __wur usage under _FORTIFY_SOURCE Date: Fri, 24 Mar 2023 10:40:05 -0400 Message-Id: <20230324144005.26782-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1172.7 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 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: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The __warn_unused_result__ attribute is only enabled when fortification is enabled. Mention that in the document. The rationale for this is essentially to mitigate against CWE-252: [1] https://cwe.mitre.org/data/definitions/252.html Signed-off-by: Siddhesh Poyarekar --- manual/maint.texi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manual/maint.texi b/manual/maint.texi index 76d4a1a147..ae651c2a4a 100644 --- a/manual/maint.texi +++ b/manual/maint.texi @@ -206,7 +206,10 @@ to the function call are safe, the call may be replaced by a call to its hardened variant that does additional safety checks at runtime. Some hardened variants need the size of the buffer to perform access validation and this is provided by the @code{__builtin_object_size} or -the @code{__builtin_dynamic_object_size} builtin functions. +the @code{__builtin_dynamic_object_size} builtin functions. The macro +also enables additional compile time diagnostics, such as unchecked +return values from some functions, to encourage developers to add error +checking for those functions. At runtime, if any of those safety checks fail, the program will terminate with a @code{SIGABRT} signal. @code{_FORTIFY_SOURCE} may be