Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21002774rwd; Thu, 29 Jun 2023 09:36:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7JCh9bevmQ/b+fr/ePvODyBLgC0PS8UdgqfaaULrPhngr8/ocM7JvC9dFTehsBUebEKUTt X-Received: by 2002:a17:902:d683:b0:1b7:eebc:884 with SMTP id v3-20020a170902d68300b001b7eebc0884mr9487275ply.64.1688056591729; Thu, 29 Jun 2023 09:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688056591; cv=none; d=google.com; s=arc-20160816; b=EoBxvApKmQDcF/TvuB+QUEPOZzCoRGZOcgwVK9cVY9hUujSKIWIvdh66gxYvPx2tUc VEW9aeBS31BjUWTBRWDQfs7rNh6RuWhGMe/CMPvlSbYq8mTmRobMcn1k1OI3mhypoguC my1/4Sa/4oSSfgKVD//xM/QmkDUkk/6qajKWk7igr4CFrttuGIEP3KWZEURWlbH+K0x6 RJTT7QT+NhgCw3S8YoHKvL+ksZm84Jovqml5gyyMlldU0FLi43EyXAw4Qm7RwE6HI88u 280yK/yS3js9+vL1bUG9uoni/LuqTff2R5GyxoAOOoB/ZnoeOGOMjcB6kDiW7AU3iVFg 88UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fYtHpMB2YVRuEyIhvxBCthJ2aioJZu40qi+vkGx0+yk=; fh=TRY8FwZvtnTPw1r6PXxfS664XgRZQhtksvRTZCxt3RA=; b=Tf6/DXcSokLn2LKsZc8F0DWwlA8Ph3RzC20cqpbS/9RdgL/BT97uOeolbGHHkF7FxC Jz5VKGyKYlNiWRNGCdEb/6uQnRLeOaN4ibkiH6o8S2aR4lVF3wJ1uzRCx5PUCNuf+2gK uzevWwfmD6/ar5zgSxzPBL1yAHQoTGPjlOSV0HQGR4DeASEPSUzGOT94iCS1fDhZOe92 wVUy+WTezhQiJ6MlFOoRNcK53jXrBnhF03KiDQxXKiQnr5r1K15oAAMBJIPh4XlqLfqW aFDZJmPRgU53Mya+cg6DkUac8vwyAfmJL7LD3Ctvm7MUibRkmGO5jQXgTyogTKNj9Lfn /nnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M6kZoAur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a170903230a00b001b3da77c1f1si11518485plh.194.2023.06.29.09.36.18; Thu, 29 Jun 2023 09:36:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M6kZoAur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232496AbjF2QXX (ORCPT + 99 others); Thu, 29 Jun 2023 12:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbjF2QXQ (ORCPT ); Thu, 29 Jun 2023 12:23:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB78ACF; Thu, 29 Jun 2023 09:23:15 -0700 (PDT) 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 7B56061574; 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?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Shuah Khan , linux-kselftest@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.39.2