From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94802224B16 for ; Thu, 8 May 2025 12:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746707006; cv=none; b=agtU9l5gKuf4rx00Nw8i6rVdAH1UoHKfwlJDJYBuQTuqlTR2ogeoVPTy1AZMBy6QEyP+Q5X5V/NYxcy+lywWvbQ1F8MpGvFckb6umn6wTvQhgYVnba+NpEGbZrsND5TJov+ToQs5lq5mGt8CdwkGeJO2pcrP+DrFTT3jTtOXosU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746707006; c=relaxed/simple; bh=n1DaNBSAbwSjqMNiKl3ZhnzGUtTOnVJb3kD0pUQSCf4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=noHLx4w1eaXSR+/a6u5tCbFhH4TfQRghVs9ftw7xhDfQw2K2BdKlvbFGbMGBwW0Nt+XxOy3ny+bLfiBqXHFFhrQ5xBhw+0amshMrngM0poeO8uCM9vvy3ZzzFX0dr7sNMuSTLBgkRTDbEHxO2D9N8j+e/PBMyRhhFeObA2bRfxo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TI3lhddp; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TI3lhddp" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-af52a624283so856847a12.0 for ; Thu, 08 May 2025 05:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746707004; x=1747311804; 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=YHzGR2TH3f5PkiaDuIeNupqLtaLoSxh32TBcttsiE58=; b=TI3lhddpzOnan2Fj4PlAoxEtdyJhilTH0aEryFC51JWmDuTJqRXV9M9IpaZ+0Bi+Vj W4IclAy3ed3oqSMRsFsQ/7rDqJHPHn6hDmRpvatvoz76F3ImVAIbE/b/2fDJjw/x6QcL 3O/1m4LuvMiwZncuB8KnqTiSYuh0wLDUyMZzOtiRaeUXJyb1BuhHSG0B9o050imPA/jx /oD8Sj9+JsdcdPoyuu4mBZ2icyKxv4pQutD0UucwckkYnO1t0lN1NezzwlhggBGxt8jN XyMZDkQwIe7C7pddABjhAdfBNSvfEtF4plZ2v0nLH43gPd7YW12ARPAGdV9pw9cUJSgE QDcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746707004; x=1747311804; 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=YHzGR2TH3f5PkiaDuIeNupqLtaLoSxh32TBcttsiE58=; b=OrrrZ69ws+k3/7kle4qlojhs3vyCldU+rb768iJ1lHhkR9ih4WNFoEe9FUeqdpMPoL GG095ajfTjkkedIwh7NCAigHhNQVCtNMzPqjChAb4J4qsUjd5cTaXzIUBbQOx7gSlexd tuBA2QU8VAPVHXO38bSA9/6uaPC7LaQ36lCBsHrj+Mg7QXcCmLVtfR839hqvpsPGc4So k0Ne0LHAGYiwUi2UUto6ctmZArbzWnLpr5YehLsk74HMHSKxkqN1wbWeCsEc2vNEap5o sGyND4dBkN5smmL76rGFOVPMomBfxEBot+KvN/8x9S1a1MeqC2RzU34SqzAFYqpGogFz wbkg== X-Forwarded-Encrypted: i=1; AJvYcCX2gxp6zHRPDuLEG1uFNv4uSWSAKzzzIfDm36CUBeDUsrvnYScuMOTubWsSpPIvXQPSh7EyqyEqsjhXA1K5acw=@vger.kernel.org X-Gm-Message-State: AOJu0YyQFlL2iHm5BkoY34gofVyqk0SG1fEujO+QTmXuiGv2e4tT79nA HJ7SPqMBKZVXOmaTjc+x8fPNoMW6WAz1bLXNFonbj3+VHraiDXKddj58nP/pGouItEghXYq8XNb w8HSvr3UFQOoz6UT5WV+2HKAG76vr9muTRloK X-Gm-Gg: ASbGncvZiaIPRwDCsLUSc2375Ti/1U8igo1Fz6t9HyGDzeN5GDePQcIbsTVXdOEFjgy 86NhdCEOiGbGwdeVhv3haDAl0ZqFKpIRuonATj8dPnxDIfC7w/7iThct0EpAFE+9WwulBrIPUs3 +jwwXuM/N5q519/nB4ixVkLaD0NnvXrHUAWhFdul/s8Z7EVDGijsqYelFyJrlWzH4= X-Google-Smtp-Source: AGHT+IGuazhS9joimxHTMGiamVK9GxUm2CRwvQi3+Gq6fqxsbfAnr7up4McbBtUROkgn62zEFRcy/K/C2EzHqfHG+xw= X-Received: by 2002:a17:90b:4b8c:b0:2fa:1d9f:c80 with SMTP id 98e67ed59e1d1-30adbf6d05amr4939913a91.17.1746707003520; Thu, 08 May 2025 05:23:23 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250507180852.work.231-kees@kernel.org> <20250507181615.1947159-2-kees@kernel.org> In-Reply-To: <20250507181615.1947159-2-kees@kernel.org> From: Marco Elver Date: Thu, 8 May 2025 14:22:47 +0200 X-Gm-Features: ATxdqUHttH2gHvJKzLvMz7fkEuSC2xFFktBrniyRJYj71k93n_Rm8LTTobDJ7fU Message-ID: Subject: Re: [PATCH 2/8] init.h: Disable sanitizer coverage for __init and __head To: Kees Cook , Dmitry Vyukov , Alexander Potapenko , Aleksandr Nogikh Cc: Arnd Bergmann , Andrey Konovalov , Andrey Ryabinin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ard Biesheuvel , "Kirill A. Shutemov" , Hou Wenlong , Andrew Morton , Masahiro Yamada , "Peter Zijlstra (Intel)" , Luis Chamberlain , Sami Tolvanen , Christophe Leroy , kasan-dev@googlegroups.com, "Gustavo A. R. Silva" , Christoph Hellwig , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-efi@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, llvm@lists.linux.dev, syzkaller Content-Type: text/plain; charset="UTF-8" +Cc KCOV maintainers On Wed, 7 May 2025 at 20:16, Kees Cook wrote: > > While __noinstr already contained __no_sanitize_coverage, it needs to > be added to __init and __head section markings to support the Clang > implementation of CONFIG_STACKLEAK. This is to make sure the stack depth > tracking callback is not executed in unsupported contexts. > > The other sanitizer coverage options (trace-pc and trace-cmp) aren't > needed in __head nor __init either ("We are interested in code coverage > as a function of a syscall inputs"[1]), so this appears safe to disable > for them as well. @ Dmitry, Aleksandr - Will this produce some unwanted side-effects for syzbot? I also think it's safe, but just double checking. > Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/kcov.c?h=v6.14#n179 [1] > Signed-off-by: Kees Cook Acked-by: Marco Elver > --- > Cc: Marco Elver > Cc: Andrey Konovalov > Cc: Andrey Ryabinin > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: > Cc: "H. Peter Anvin" > Cc: Ard Biesheuvel > Cc: "Kirill A. Shutemov" > Cc: Hou Wenlong > Cc: Andrew Morton > Cc: Masahiro Yamada > Cc: "Peter Zijlstra (Intel)" > Cc: Luis Chamberlain > Cc: Sami Tolvanen > Cc: Arnd Bergmann > Cc: Christophe Leroy > Cc: > --- > arch/x86/include/asm/init.h | 2 +- > include/linux/init.h | 4 +++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h > index 8b1b1abcef15..6bfdaeddbae8 100644 > --- a/arch/x86/include/asm/init.h > +++ b/arch/x86/include/asm/init.h > @@ -5,7 +5,7 @@ > #if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 170000 > #define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector > #else > -#define __head __section(".head.text") __no_sanitize_undefined > +#define __head __section(".head.text") __no_sanitize_undefined __no_sanitize_coverage > #endif > > struct x86_mapping_info { > diff --git a/include/linux/init.h b/include/linux/init.h > index ee1309473bc6..c65a050d52a7 100644 > --- a/include/linux/init.h > +++ b/include/linux/init.h > @@ -49,7 +49,9 @@ > > /* These are for everybody (although not all archs will actually > discard it in modules) */ > -#define __init __section(".init.text") __cold __latent_entropy __noinitretpoline > +#define __init __section(".init.text") __cold __latent_entropy \ > + __noinitretpoline \ > + __no_sanitize_coverage > #define __initdata __section(".init.data") > #define __initconst __section(".init.rodata") > #define __exitdata __section(".exit.data") > -- > 2.34.1 >