From patchwork Thu Jun 29 16:22:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 13297148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F29DC001B0 for ; Thu, 29 Jun 2023 16:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S2aaSmEe/+9zQQT4QzniuIcRohK6F/komIlS/PR/Dwc=; b=DaY9OSs2vQuS/8 h0TF640JHDcpFOgQpBFzCAe0cv+P74Hs2tf55i/aydrR8QdF4I2hBe8ThG/KO7OVvMdD0AJlecFyn 56oJvTNdoUPxviKlkR4if7GTlldBi5pLglBRv2Ia8VJ3eHoV8oSHri6OPN31Jvh3pD6aLecPt+27z htWAdy8nwiWgd4Iw5GzPTQM9parIfrXd0OzTw9aBp+OUGC6D5En70+tgktDVkhpnkMnKn3vAasTiB Jdo0dY39XHsYNEPtb2hU/TqPDjlleP7psuQ/hDL2T3qhvEkD8yTgddgObkzam2keyRTOL6snn1WjN 7Ixg6FHlKhrMl3OMpvBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qEuQS-001WOU-1E; Thu, 29 Jun 2023 16:23:20 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qEuQN-001WMS-31 for linux-riscv@lists.infradead.org; Thu, 29 Jun 2023 16:23:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B39D61572; Thu, 29 Jun 2023 16:23:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C17D3C433CA; Thu, 29 Jun 2023 16:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688055794; bh=XKHVV9536ZEIq0lSPWe7Ma20H9zvrB69ScTYKRNgSug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6kZoAurVeEfkpLZfC9kxcAJWpzl/UUi+VNi5k1i3Dndk9Pb9ABQQu6Vuhx4/V8Ym eYeawEma6ZTO9P034Brnv+y+iANOqT7owHEUXd79yDDf0EE8zQV1kg/E+13nQfIehy bi2qq9G/sfCXcpXVSG8tsSx3dd5zLBJmJSYNixYZ0JRhsNYKQ1jnxQoBwfzM4lNxHs XLxAFCeETZrWAqGnxg/3yTeN0voW/UL/EQ+m1SxkxBivGz2Q16XKHs34qfHrcfA1nh qjGGdKBBR6AiJjCflcdzAfy8xLzozEfx/hq89IOm3E6G8GxRGM7Qjgvb2HRl/t4C0H XezKnlpSIying== From: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= To: Shuah Khan , linux-kselftest@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Alexey Dobriyan , linux-fsdevel@vger.kernel.org, Anders Roxell Subject: [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined Date: Thu, 29 Jun 2023 18:22:59 +0200 Message-Id: <20230629162301.1234157-2-bjorn@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230629162301.1234157-1-bjorn@kernel.org> References: <20230629162301.1234157-1-bjorn@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230629_092316_016566_8E92AC0D X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Björn Töpel Some architectures, e.g. riscv, does not have support for the GCC option '-fsanitize=undefined'. Check for '-fsanitize=undefined' support, and only add it to CFLAGS if supported. Signed-off-by: Björn Töpel --- tools/testing/selftests/openat2/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/openat2/Makefile b/tools/testing/selftests/openat2/Makefile index 843ba56d8e49..f13ad02a18ea 100644 --- a/tools/testing/selftests/openat2/Makefile +++ b/tools/testing/selftests/openat2/Makefile @@ -1,6 +1,13 @@ # SPDX-License-Identifier: GPL-2.0-or-later -CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined +# We need this for the "try-run" macro. +include ../../../build/Build.include + +CFLAGS += -Wall -O2 -g -fsanitize=address +CFLAGS += $(call try-run, \ + echo 'int main() {}' | $(CC) -fsanitize=undefined -x c - -o /dev/null, \ + -fsanitize=undefined,) + TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test include ../lib.mk