From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B603FC433F5 for ; Wed, 1 Dec 2021 16:12:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C32C6B0075; Wed, 1 Dec 2021 11:12:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 04ADB6B0078; Wed, 1 Dec 2021 11:12:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E06C26B007B; Wed, 1 Dec 2021 11:12:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id CC5B26B0075 for ; Wed, 1 Dec 2021 11:12:21 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 77D1318113292 for ; Wed, 1 Dec 2021 16:12:11 +0000 (UTC) X-FDA: 78869717262.19.2E2BFA7 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) by imf10.hostedemail.com (Postfix) with ESMTP id 41D236001E4F for ; Wed, 1 Dec 2021 16:10:56 +0000 (UTC) Received: by mail-ot1-f41.google.com with SMTP id a23-20020a9d4717000000b0056c15d6d0caso35838694otf.12 for ; Wed, 01 Dec 2021 08:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qEqb4KAOgMzFJNLkGQkPT3DXIyCBroaySsB9I+dSD/s=; b=RLrKil5/ET2RKJZWFZ1FIvXUiN178FVuavqk+u2vTfvDSCgKlRUwc6W4Jl8fSI8UN/ IgHjKoLCbh1xhH11IuUFST1AOGk7t1wPXKCXwso3Mtk/QeMXq/tzdOzWjhBXbzy0fHmU gaRxcEorBZeMJDiKjwQ6FCbbJyZiwijPurG36uUFJnQPOS3aSrUPhRuIen7uNDqWkOVb yhiOYYAh2i1veL9v1OA7c1ZGmikQc3l2uBsOjjwNh1/eElnXhGLd/IldE2QYHL2kfphy rwfed2QHe+8voYcKHwKblNJflluujJpXSbZxHbUUyH1sCYBHYln59BhWPnYzFuU+L97K YEMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qEqb4KAOgMzFJNLkGQkPT3DXIyCBroaySsB9I+dSD/s=; b=S+tGqUrWHSCf5av7fEFvuv411UFBtktKjBTYt2D17JuViHpDoAPFUtVytK6d12YZPJ vehhNHEl4lbcTj1pd4GMoNbPA5iCkfLn+dEKm9wyCaiTLMXwK2wzq42g7c6af+FJ1p0x i5gNw4gtVF3mVZQdqEZCJLiTCLmKnmvcVsdxR/MNm8EEYR6gprz7kvnT5pdRwTib5dqa 9Rr4zl/hX8s3yEFzWA7j64RdbDoktJtwFnEY7jOkIu5Qgb7Uud+5VTM/NVhuayVzkU6f QhSoJT8YM1OYx+cxVHivdnB1uXHCjJ2Dxm4qFJRXWaRUdd6KSV4Z4AnjshwYnvRaryV7 L1/w== X-Gm-Message-State: AOAM531jh7QNl7e91lTk0EhGqBGj2AE29BeXoSbaphJCvG+sr2+IVs/Y PMsQAx/hdhgxB1ceFs3zS3UqfwA5OEPh4Pu/A3Onkg== X-Google-Smtp-Source: ABdhPJzTS9wgAfK3dj8teWOUyT6VAGJHZPB2bZWbhYi6D6P/7EKmY33eCGly4ZJH6Lq3o4jdvtfCYY/5z2Bf1An2JmU= X-Received: by 2002:a9d:77d1:: with SMTP id w17mr6449697otl.329.1638375054586; Wed, 01 Dec 2021 08:10:54 -0800 (PST) MIME-Version: 1.0 References: <20211201152604.3984495-1-elver@google.com> In-Reply-To: From: Marco Elver Date: Wed, 1 Dec 2021 17:10:39 +0100 Message-ID: Subject: Re: [PATCH] kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR To: Mark Rutland Cc: Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, Peter Zijlstra , Nick Desaulniers , Nathan Chancellor , Dmitry Vyukov , Andrey Konovalov , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 41D236001E4F X-Stat-Signature: 841r91w8zen4jrhrjzec4kj7ntdh9b84 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="RLrKil5/"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of elver@google.com designates 209.85.210.41 as permitted sender) smtp.mailfrom=elver@google.com X-HE-Tag: 1638375056-589836 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 1 Dec 2021 at 16:57, Mark Rutland wrote: > > Hi Marco, > > On Wed, Dec 01, 2021 at 04:26:04PM +0100, Marco Elver wrote: > > Until recent versions of GCC and Clang, it was not possible to disable > > KCOV instrumentation via a function attribute. The relevant function > > attribute was introduced in 540540d06e9d9 ("kcov: add > > __no_sanitize_coverage to fix noinstr for all architectures"). > > > > x86 was the first architecture to want a working noinstr, and at the > > time no compiler support for the attribute existed yet. Therefore, > > 0f1441b44e823 ("objtool: Fix noinstr vs KCOV") introduced the ability to > > NOP __sanitizer_cov_*() calls in .noinstr.text. > > > > However, this doesn't work for other architectures like arm64 and s390 > > that want a working noinstr per ARCH_WANTS_NO_INSTR. > > > > At the time of 0f1441b44e823, we didn't yet have ARCH_WANTS_NO_INSTR, > > but now we can move the Kconfig dependency checks to the generic KCOV > > option. KCOV will be available if: > > > > - architecture does not care about noinstr, OR > > - we have objtool support (like on x86), OR > > - GCC is 12.0 or newer, OR > > - Clang is 13.0 or newer. > > I agree this is the right thing to do, but since GCC 12.0 isn't out yet (and > only x86 has objtool atm) this will prevent using KCOV with a released GCC on > arm64 and s390, which would be unfortunate for Syzkaller. > > AFAICT the relevant GCC commit is: > > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=cec4d4a6782c9bd8d071839c50a239c49caca689 > > Currently we mostly get away with disabling KCOV for while compilation units, > so maybe it's worth waiting for the GCC 12.0 release, and restricting things > once that's out? An alternative would be to express 'select ARCH_WANTS_NO_INSTR' more precisely, say with an override or something. Because as-is, ARCH_WANTS_NO_INSTR then doesn't quite reflect reality on arm64 (yet?). But it does look simpler to wait, so I'm fine with that. I leave it to you. Thanks, -- Marco