Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3932003rdg; Wed, 18 Oct 2023 09:52:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHX3BBSfydtOfjzlGBf9q3kl5SEX2DAjkAfYeiVpOyrUYUv8NN/3PhXbZJQw3ke6hDPXOqE X-Received: by 2002:a17:902:f545:b0:1c5:c546:fece with SMTP id h5-20020a170902f54500b001c5c546fecemr7135790plf.34.1697647948325; Wed, 18 Oct 2023 09:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697647948; cv=none; d=google.com; s=arc-20160816; b=Yvq5c84SN4ACUGRgxEYZHD4RvXloWF8gY6u2iTq2PTuTg+5ijX8boQsbRZoewyRdTK Zypl1qQ1SEcCvHD/CcxcRGQhHeIFjfTj0K2dPKnXMexWR5QhAGuD+52zppqp5JhNK1XX aN3baVuir7Alb9VprZD6YUzwg7js6IPvGqz1t5OVJohbUGdAZm0PcLZNqxF1SIgIiU2b QUvr+YHvj/UdFDGnNId3xEAZSK/FtwpG8UXISpNl1hVUQg2OGb4e85cF0/B24/D3btJ3 VKVBMJr1mycoJgh3gLqUVMMQbQw5ezr5UTrrfcE9qOBX/x5jghaORh/QLUQHeGC254L1 e1ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/pMxszsWHDpKedI/5pITYv9bsseXhLI86JME0Jv0Euc=; fh=iavFEGiaH83Lc5aDzeABOQpyXUB7IiGge6GRfnQJa9w=; b=H6NsU4Be86eo56xDYkT5Q84rLgED4caee2JdKs8oCPjr9IuDzvr45DnP2EYkYjGNxh CYsuTYmY9T9dVx7boWIjDS5BD0PUHjdUKDbND/3VfOJdmbdTSED/ln+DCoq8LvkkgNbs QW7Kf+veQnXRomkFiL2LFi7J3XTloaYKo21Z5FMQp1fTWhpJTLswBKXySpZA0fThWv5l 4/EgBYgc8VRq0/UK/8RA+hfHlvMFcIjERRSlmiNaH/mu+OtIKolxcn5EOyLAQMzvQmtY HVK8R31KHxa2zv508A0WftredF/Imsu5yc9Pg7ELlw0r0OotkeuCvZ8/s2EOgGyeK+Ve QBjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZBMMfY2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c4-20020a170902d90400b001bda57935fasi235769plz.64.2023.10.18.09.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZBMMfY2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A1C48803B50B; Wed, 18 Oct 2023 09:52:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbjJRQwN (ORCPT + 99 others); Wed, 18 Oct 2023 12:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjJRQwM (ORCPT ); Wed, 18 Oct 2023 12:52:12 -0400 Received: from mail-vs1-xe2c.google.com (mail-vs1-xe2c.google.com [IPv6:2607:f8b0:4864:20::e2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 791D1F7 for ; Wed, 18 Oct 2023 09:52:10 -0700 (PDT) Received: by mail-vs1-xe2c.google.com with SMTP id ada2fe7eead31-457e36dcab6so2392859137.0 for ; Wed, 18 Oct 2023 09:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697647929; x=1698252729; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/pMxszsWHDpKedI/5pITYv9bsseXhLI86JME0Jv0Euc=; b=ZBMMfY2jFP7F7aN6RT8iOcjNfR1drIBqlUMiHw/IpaeGyyF3fdpYbUndQDcfOMl1Ct hSXDiIyiXTj9t/43OfRgvVADRI72sRYSIyIdkQ2ECmh4oNUbEJXvWaqTFdeRBn+16vc7 jfsjXp/JmIeZOKtVppmR2lxLoveFmEnV7XW61v3JYr3VgYco4VVzOV8PE58Uc3CCZvq9 tDOtccuZJdV6rQyuUFVkdNnRJCn3SPvcJ5Rr/qwRzb1NtHLWF9RLMs4abD/l40hQPIRA uIRhfUdl8jeWvACArlCQhPinPQEZ4WoElgLQ9cnaVvIq14nssCHN3wvtuU9tC5oGm4VR bb/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697647929; x=1698252729; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/pMxszsWHDpKedI/5pITYv9bsseXhLI86JME0Jv0Euc=; b=retLQYAAxMfs4nfoyqUMDlvaqLKxxyZYyTB0ayhXf7hLZbklyxFYA+WeTtNpzv6IZ6 wdvih1qfW11rT1nqJIg5g6b5ZJ/iQsdB92LAsyBbSIpdPDBf3NBJIcK+Uj03n9tk6aMo FZnldPnXg0eFcebN6tw183DnteWEHbkMDbxDSKe9TnF0VAnJsImAZ2UdfWTPWCjoFJMe 6UBFlQbk3yskWMqj+Un8g30vhG2oD5jfvWOQXEehwGHJcGHzQQ5iKUsOwUatOleB2tj5 kAizxWzfaUzehS/VtNPf5PgnOKH5vT384hRihS08W7B7ChkfPLsOsiChhoLMd3Z/Uz3X +EAQ== X-Gm-Message-State: AOJu0Yx8waI+LdkMp4+N3E8ta6CUwhmabQR0pSlN5oJMe6HuJkWnrMrZ KgHcWGGyDzCFeuGqyDdUCwoQ8SxQXpdhSLGYZf4q7Q== X-Received: by 2002:a67:e156:0:b0:452:61eb:dc26 with SMTP id o22-20020a67e156000000b0045261ebdc26mr3477209vsl.16.1697647929398; Wed, 18 Oct 2023 09:52:09 -0700 (PDT) MIME-Version: 1.0 References: <20231018153147.167393-1-hamza.mahfooz@amd.com> In-Reply-To: From: Marco Elver Date: Wed, 18 Oct 2023 18:51:31 +0200 Message-ID: Subject: Re: [PATCH] lib: Kconfig: disable dynamic sanitizers for test builds To: Hamza Mahfooz Cc: linux-kernel@vger.kernel.org, Rodrigo Siqueira , Harry Wentland , Alex Deucher , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Nathan Chancellor , Nick Desaulniers , Tom Rix , kasan-dev@googlegroups.com, llvm@lists.linux.dev, Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 09:52:23 -0700 (PDT) On Wed, 18 Oct 2023 at 18:43, Hamza Mahfooz wrote: > > On 10/18/23 12:22, Marco Elver wrote: > > On Wed, 18 Oct 2023 at 17:32, 'Hamza Mahfooz' via kasan-dev > > wrote: > >> > >> kasan, kcsan and kmsan all have the tendency to blow up the stack > >> and there isn't a lot of value in having them enabled for test builds, > >> since they are intended to be useful for runtime debugging. So, disable > >> them for test builds. > >> > >> Signed-off-by: Hamza Mahfooz > >> --- > >> lib/Kconfig.kasan | 1 + > >> lib/Kconfig.kcsan | 1 + > >> lib/Kconfig.kmsan | 1 + > >> 3 files changed, 3 insertions(+) > > > > Do you have links to discussions that motivate this change? This has > > been discussed in the past. One recommendation is to adjust the > > Sure, you can checkout: > https://lore.kernel.org/amd-gfx/CADnq5_OyO9CHqahFvdnx7-8s9654udgdfhUntyxfjae+iHey0Q@mail.gmail.com/T/#m5d227dc1ef07b1f4953312287dce4568666c5e09 I would add this as a Link context to the patch. > > build/test scripts to exclude some combination of configs if they are > > causing issues. Or we increase CONFIG_FRAME_WARN if one of them is > > enabled (KMSAN sets it to 0, 32-bit KASAN increases it a bit). > > > > That being said, we're aware of KASAN having had more issues and there > > are some suboptions that have been disabled because of that (like > > KASAN_STACK). I'm not sure if Clang's KASAN instrumentation has had > > some recent improvements (we did investigate it, but I can't recall > > what the outcome was [1]) - maybe try a more recent compiler? However, > > KCSAN and KMSAN shouldn't have any issues (if KMSAN is enabled, > > This patch was initially motivated by KCSAN (i.e. I am able to get it to > blow up the stack with a minimal .config). I don't mind dropping the > other ones since I only included them because Nathan implied that they > could cause similar issues. !COMPILE_TEST is not the solution. Clearly from the link you provided build testing is helpful in catching early issues, so that these tools remain usable for everyone. But we know they use a little more stack, and the warnings need to be adjusted accordingly. My suggestion is to just increase FRAME_WARN for KCSAN, or set it to 0 (like for KMSAN). My guess is that first trying to increase it is the safer option. > > FRAME_WARN is 0). And having build tests with them enabled isn't > > useless at all: we're making sure that these tools (even though only > > for debugging), still work. We _want_ them to work during random build > > testing! > > > > Please share the concrete problem you're having, because this change > > will make things worse for everyone in the long run. > > > > [1] https://github.com/llvm/llvm-project/issues/38157 > > > >> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan > >> index fdca89c05745..fbd85c4872c0 100644 > >> --- a/lib/Kconfig.kasan > >> +++ b/lib/Kconfig.kasan > >> @@ -38,6 +38,7 @@ menuconfig KASAN > >> CC_HAS_WORKING_NOSANITIZE_ADDRESS) || \ > >> HAVE_ARCH_KASAN_HW_TAGS > >> depends on (SLUB && SYSFS && !SLUB_TINY) || (SLAB && !DEBUG_SLAB) > >> + depends on !COMPILE_TEST > >> select STACKDEPOT_ALWAYS_INIT > >> help > >> Enables KASAN (Kernel Address Sanitizer) - a dynamic memory safety > > > > This also disables KASAN_HW_TAGS, which is actually enabled in > > production kernels and does not use any compiler instrumentation. > > > >> diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan > >> index 609ddfc73de5..7bcefdbfb46f 100644 > >> --- a/lib/Kconfig.kcsan > >> +++ b/lib/Kconfig.kcsan > >> @@ -14,6 +14,7 @@ menuconfig KCSAN > >> bool "KCSAN: dynamic data race detector" > >> depends on HAVE_ARCH_KCSAN && HAVE_KCSAN_COMPILER > >> depends on DEBUG_KERNEL && !KASAN > >> + depends on !COMPILE_TEST > >> select CONSTRUCTORS > >> select STACKTRACE > >> help > >> diff --git a/lib/Kconfig.kmsan b/lib/Kconfig.kmsan > >> index ef2c8f256c57..eb05c885d3fd 100644 > >> --- a/lib/Kconfig.kmsan > >> +++ b/lib/Kconfig.kmsan > >> @@ -13,6 +13,7 @@ config KMSAN > >> depends on HAVE_ARCH_KMSAN && HAVE_KMSAN_COMPILER > >> depends on SLUB && DEBUG_KERNEL && !KASAN && !KCSAN > >> depends on !PREEMPT_RT > >> + depends on !COMPILE_TEST > > > > KMSAN already selects FRAME_WARN of 0 and should not cause you any > > issues during build testing. > > > > Nack. > -- > Hamza >