From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 AEE55199931 for ; Thu, 8 May 2025 12:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746707130; cv=none; b=IyzlUkw2vguDLoK+ucIrKtcIE91MwrLArBKEKNdayStJvu11iZs2TqCe2Es/QVTvAkS145fGC/saI1ASlnc3HT4qCT3Zh3gmbxD7Nbh5NssV58styxxL/CXlu1TFoEQM/7Rg0K3xplMIcfPNENIaPYug9yRuFJ6cbzYCNCT8lfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746707130; c=relaxed/simple; bh=GSPlMkE9xl1CKG6+aR4Lnpqmp6kkUaBOsXBjm7FdCs8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Xtqi3woBKbMqmFlcwjGsLJjMXp/NLdG7emAF1YOy/2k3j9ugWQ4Extlbs1LYC8wlYMbt5HzimNha9WYfrCNDbCDEKkCzzk7wNmEpu5r6rkhADR498JRulf7a/ZnLFH8nFOeHGa9wlQS7z/FYvG7WNhWOs5OYyaiWwSgkXcmTUbI= 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=ONaTa7mk; arc=none smtp.client-ip=209.85.167.46 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="ONaTa7mk" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-549967c72bcso999798e87.3 for ; Thu, 08 May 2025 05:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746707126; x=1747311926; 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=SGXUIdTFQac7mJFRH+e+84EpMzV6neC01o/VEUKascg=; b=ONaTa7mkd9jVBDhTxOiNjDB9oo7ZjFFzBT97onAVuG9S+UwGeCqO4hXZK/nqbJUC5t 2yJo4mux/6GIOUCviWK0mKOKdELAH4WroXckzdLgoeA5rmJ9Vq3E7TZrudMSm4/XLMSU We0MQ/50Ns1jLNJ1iFHhLDLCobMR3pRT7CER365RgfcCCqK8pTxwLAVzHwOrcAfmrnQ3 p55KROtV+WfTFr2ua2Su1IXybLXufIrUacbo2ZwHgI97BYK6FDd2/vSDIXqjm9ApLE/e zGp0bwKQ9lPRKEKvymtb7m/acWfQ8mZ/3YlUcbNuGnYsvDhvWBDj/BS03V+9LKduDxhs jkNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746707126; x=1747311926; 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=SGXUIdTFQac7mJFRH+e+84EpMzV6neC01o/VEUKascg=; b=XfFNkVkEUR4Ub+aP9fwyM6Yfy5DeUaWrtyRLs/PXLjfdp3ZcEEvJVwi6wksI6cbIGk SJ0z1pD9oBsEgJQySCxZWE2F7SkcTgpiJS1PKXBPsZ6FGOhmhX6XQzAXRPKGD5TkSo6b yAghQRtV9ZnPAUHDhpEpfpmgylyD8llrkfgbC3jc2ThxWBCdP960Htct7hni9nWTAYVs tCuSQxZybhm5zykBjzsEwpP3NxzZqKKDriKQaxtH8yUpDuMmiaPtacclqy+S8nBcuOhz UCs7vSq4jJMwIFZLnWoootlZwaXo3ytb69NdACLN3ouwJkeNECyuZHbpw9fNwMLXUg8x b4aw== X-Forwarded-Encrypted: i=1; AJvYcCUMLhVgQN7SOq3mDG6aqusHGB9TXG3htp/Ddgf1tBfJ32PS3gZ2LsrRELYRWNRMK/k7UDpahNM86d6RQIMJa0M=@vger.kernel.org X-Gm-Message-State: AOJu0YyEeHrtUYYwobbV1e29HoILn3qsw7//Hj7a/TETuJnOAecNfKRH tKpyN7lph8uXYWajLuR7yFP3iXb0BQbC3CSIqfbHYeWQwMdm6Oy0xNRQK1jJOz1M+PC96rQWOn9 qkwiuijzlbXXYoIytx+JNL/wUZ1Lqz1UmFZU5 X-Gm-Gg: ASbGncsnoLbXWfkTsEp/X50XgAmklNlhdgstnNpWKuqND44VE/q+DBFSdApSKU0KyVj Qkl00/gkwTd3TR11B2olmExnrArEW8Q6fNh37pWlnnDcbwtfmPwmtVEMTAKDm3l8KXkUBpM73t+ fYCsf5GOttGGRmky6xK9fmVb3cNTJA8Eo/VeA1NqEn7eXZVej/cawh X-Google-Smtp-Source: AGHT+IHELJP6PjDmjgnoQ+DcewZezMvkPDTBk3DlAEgOIW2HtUu14uSoRBVrm2tBSd/cEMjU36ADUjG1Ap9y8UFRrr8= X-Received: by 2002:a05:651c:b11:b0:30b:f006:3f5 with SMTP id 38308e7fff4ca-326b87dacdfmr7793251fa.15.1746707125568; Thu, 08 May 2025 05:25:25 -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: From: Dmitry Vyukov Date: Thu, 8 May 2025 14:25:13 +0200 X-Gm-Features: ATxdqUEOMWVMkXbvXQaHqruZq4t8-pmXFLrRyvMg5ohXOpGrzDC1z300bwlcEE0 Message-ID: Subject: Re: [PATCH 2/8] init.h: Disable sanitizer coverage for __init and __head To: Marco Elver Cc: Kees Cook , Alexander Potapenko , Aleksandr Nogikh , 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" On Thu, 8 May 2025 at 14:23, Marco Elver wrote: > > +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. I do not see any problems with this. > > 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 > >