Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3913914rdg; Wed, 18 Oct 2023 09:23:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGT1i1XxcJJhvB06UY0OcNq5SrpfpcWMcnW5OfzLh1RYsEDpWMqScEtZSFI1LrHztk+Fz+l X-Received: by 2002:a05:6359:59f:b0:145:6560:d86d with SMTP id ee31-20020a056359059f00b001456560d86dmr5108816rwb.32.1697646186462; Wed, 18 Oct 2023 09:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697646186; cv=none; d=google.com; s=arc-20160816; b=g4j/Pwbzkewz6eZMQGOMwrbE0NQEiK1ioHiE817z1gCPa/Gwrwmok1KMXXwM6yIxXH dncVg836xdbUDJhD33+AbUa51kIBhcX1mkZDqNden6VxPTbAnCTCeENZKL4ul6xn6KSp M7Mn3efXbU/L+FvqKhKYbWNhhrdZmfaLx/+2AMrKwsSp14D64vLA7MYf96yite2qssaP 7mt1mJwCo+3e7oSTkOc5gkId9gNEL/QOEa+sFNMCumJoAKrUznV6qwJIRV1+CKD6KrFB JxxpGzduuFZNN7wpHMHUrF6bGV3ZHKaJUJNTXNw6YnotCtBdjnC4qyDWwMV/DwiiS+6I RerQ== 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=i8uMytjHiXi9xKsw6qoUi0Pc7HNlD5A1bFtvpbrNGTM=; fh=iavFEGiaH83Lc5aDzeABOQpyXUB7IiGge6GRfnQJa9w=; b=a5ba5+Mzaqjj+T28K1jLWHrm/ZlqTy0xOXcU7u7setqEr4GhxA8kyqtuC1DldnfX3Y eay+irMwUmmfl+CoGVurDXkWtB9XKx2U95zn2zvmrvj4ldx/u3pmjQmbwtK57dj/e3bo S9/6hGPMx1fU+AWNfMpS7j59RgcM5antInXHc3nI8AxK2xLFRVRSX2LZQw8mI4QjuVUY rb1hnXFJ/qeyt1Ea4lK1A0VKOORqiyYItWilXlc2rnv4q6NxmsXyFltSeJUFyVWdEjDL jsTZWn+lCw9C1Wp51cQeAmxKdfxRH5N3dBobaVo0TnY0eXGEW6CLYSw+soWt0loddMLa HKfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RzFLFi4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id d15-20020a65620f000000b00573f885c4edsi2373530pgv.368.2023.10.18.09.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RzFLFi4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 2312981EA5F8; Wed, 18 Oct 2023 09:23:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbjJRQW4 (ORCPT + 99 others); Wed, 18 Oct 2023 12:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjJRQWz (ORCPT ); Wed, 18 Oct 2023 12:22:55 -0400 Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A90B7FA for ; Wed, 18 Oct 2023 09:22:53 -0700 (PDT) Received: by mail-vs1-xe31.google.com with SMTP id ada2fe7eead31-45845db2d63so659550137.3 for ; Wed, 18 Oct 2023 09:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697646173; x=1698250973; 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=i8uMytjHiXi9xKsw6qoUi0Pc7HNlD5A1bFtvpbrNGTM=; b=RzFLFi4B1+wflRvIqpmuzzIzMfOVQvOXju13NupwjlltsoomQWKm7ff8jmbgTjA/GG iqRZbYf7Omnej5885TMONAKL5GkFF0DnbGa9/splVgSo80pcAqZQ0nFkY0NZTBz63l3h 2pfQAh9exwhvqFwiT5t1Ne+A4T46Mx+eLpD2pq1uGP2CMj+XLqR3/9ByOCS56YdUzvNF HZn4JI13U9fHzR3uUinUCjpXH5Ui9NsPjC22qcKg3d/XB0nze4V/fPqUvWzwtsYtfXWS mhCgoS1yTJJ+KeZTYM8x/y/X35Pcx79tuRzzt3d/48GfmDIrTM2OQvxyP4DucUGGv8Es 3YSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697646173; x=1698250973; 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=i8uMytjHiXi9xKsw6qoUi0Pc7HNlD5A1bFtvpbrNGTM=; b=ItMORHRCETxPeCaFcp+vnMf9Ko7ZA5WVWGGWoOcHtjy4N841AtoPiss+B3IZ2326aB 3HpF0wP6hBFcS23IqdspYOWRmle/PQT4A67Kmlk+fCoL6ZVm1JGWvHX813dP439ghBg+ nK1pFl+JtmzNacpCya83HltAyWUKtJjC+moh3c8D5Ypt63wOp0j2n0eTkQsVmFNx9MNT GnWfoqzzjARMsWGSXbySIBNVE4538mmox6n6l2S5WmquzeJwmbRjoLm7sv7yXAZzzEfn oMjjgfgGAtsY6m37fK4hjYckBMbh4p7yUt8AT4cgwSL65AbDdwBc8OwrzCJfl9hu7DKU GDCA== X-Gm-Message-State: AOJu0YzJLDsBgjZ1lfRfQxKY0f4Lar2aKNKNiWxx+YgenORGyEXaiSpI zKOAwKjvnU3jRIudGp41iBzdF+UGvTCLDsQZD11+ng== X-Received: by 2002:a67:e14c:0:b0:457:cc6c:9491 with SMTP id o12-20020a67e14c000000b00457cc6c9491mr5467384vsl.17.1697646172621; Wed, 18 Oct 2023 09:22:52 -0700 (PDT) MIME-Version: 1.0 References: <20231018153147.167393-1-hamza.mahfooz@amd.com> In-Reply-To: <20231018153147.167393-1-hamza.mahfooz@amd.com> From: Marco Elver Date: Wed, 18 Oct 2023 18:22:14 +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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 09:23:04 -0700 (PDT) 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 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, 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.