From patchwork Sun Jul 7 16:23:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ingo Blechschmidt X-Patchwork-Id: 1957724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=speicherleck.de header.i=@speicherleck.de header.a=rsa-sha256 header.s=201902 header.b=fz/XBRvh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WHCH30Jy6z1xr9 for ; Mon, 8 Jul 2024 02:23:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 41FB7384A4BE for ; Sun, 7 Jul 2024 16:23:25 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from speicherleck.de (speicherleck.de [173.249.60.202]) by sourceware.org (Postfix) with ESMTPS id 513CC385DDF9 for ; Sun, 7 Jul 2024 16:23:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 513CC385DDF9 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=speicherleck.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=speicherleck.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 513CC385DDF9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=173.249.60.202 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720369393; cv=none; b=pQxUhefkJOSp7v3P55+j6Od8BbyGper7j/nAa7bsApSZY+k3K1uw9pAh3Zu3uhvhUU+ivozkjUvEpFD0djb9PSvp36sCSZ9UpDupbXPmK9OVTdmPRre9VUOEm2gfBDjCIwkJoTG3Dg/c3hcp1Zkf6+YYZcro4pBYPMu5Ud+0mv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720369393; c=relaxed/simple; bh=4DW1kAkFxoGo4vg8akDzG4N4pWSrxtTGkBKe8hlAccE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=LDAowYsYL1VlBwG8ZOo4Cor1CXndJnRHJDYXw295OYPquvxOuUm5UDginS4f2/JZmAPi1v+IpMWM5lYWHPR0/ivK1hNsakqe9U3drRct95BJN7C2QqdVz+bs2QusvUY6LUMZUFvGBgXvqDyaYF1VxnERw7TEk0xageQoVGx/5Es= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from quasitopos (agdapad.quasicoherent.io [62.171.174.139]) by speicherleck.de (Postfix) with ESMTPSA id B36E225E18CC for ; Sun, 7 Jul 2024 18:23:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=speicherleck.de; s=201902; t=1720369389; bh=4DW1kAkFxoGo4vg8akDzG4N4pWSrxtTGkBKe8hlAccE=; h=Date:From:To:Subject:From; b=fz/XBRvhet2Ffyy6lv2PJUHH9wS5LwnDcSk5emrWLBcH945Ek9dcgmTE6jjIYpBvV RZ7V0RHPwb/wjHxmGw2vC+G1TFUrV5sf8MbzXGA2ON95/8jrY+x1HCjTj9FnCM3mRN FAkFsOviEgnrm2rVPfkMBex5ZzfV7G54JXDM9ZFEHDepyiFZpumSxKERpsVidBhLhS czSxmjbItyPMZp33+JKBwGdfNsE9m9kAP5s1z31ET7zGfL2aeQRqbgSi6VburbdNcY GcFF/+ShxA6jq7K0/E1CnCDF0tRaSJWmVTYH1Acp5SWW9yZDluL8DWPH+WvAmYNHEn yGPUIOIuzIhMA== Date: Sun, 7 Jul 2024 18:23:09 +0200 From: Ingo Blechschmidt To: libc-alpha@sourceware.org Subject: [PATCH] debug: State buffer overflow message more precisely Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Registered-Linux-user: 232173 http://counter.li.org/ X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS 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.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This patch contributes to our source fortification endeavors by slightly rewording the error message on detecting a probable buffer overflow. The new error message adds a bit of nuance, helping to demarcate the efforts of source fortification from an unmitigated actual buffer overflow, thereby describing the situation more precisely, preventing misunderstandings and highlighting source fortification. I ran into this issue when debugging a problem with Privoxy (https://github.com/NixOS/nixpkgs/issues/265654). Source fortification correctly identified a libc call which was potentially problematic and (in my view) misleading, but actually safe. A more precise error message, as proposed by this patch, would have sped up the diagnosis. --- debug/chk_fail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/chk_fail.c b/debug/chk_fail.c index 77d54c6706..44f367deec 100644 --- a/debug/chk_fail.c +++ b/debug/chk_fail.c @@ -25,6 +25,6 @@ void __attribute__ ((noreturn)) __chk_fail (void) { - __fortify_fail ("buffer overflow detected"); + __fortify_fail ("probable buffer overflow detected"); } libc_hidden_def (__chk_fail)