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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7387AC49361 for ; Tue, 15 Jun 2021 07:46:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D1D896140B for ; Tue, 15 Jun 2021 07:46:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1D896140B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3C7556B0036; Tue, 15 Jun 2021 03:46:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 377C86B006E; Tue, 15 Jun 2021 03:46:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 218A56B0070; Tue, 15 Jun 2021 03:46:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id E67E56B0036 for ; Tue, 15 Jun 2021 03:46:29 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6F844B2B6 for ; Tue, 15 Jun 2021 07:46:29 +0000 (UTC) X-FDA: 78255175698.25.E9B12E5 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by imf16.hostedemail.com (Postfix) with ESMTP id 80350801936A for ; Tue, 15 Jun 2021 07:46:20 +0000 (UTC) Received: by mail-ot1-f46.google.com with SMTP id 66-20020a9d02c80000b02903615edf7c1aso13393631otl.13 for ; Tue, 15 Jun 2021 00:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iSVyAacN7l8MRU6+yXnglhfZd0yPT6M71q0qhoSn658=; b=Ma5dk7dw0py0KMSezsjczrNLk2CqZKg10JsIjyEe3U1pEvt5ydu0bUCARaRJ4qeU5L IWbS57fwsWyMAKpwDOsj0Al0AZWttPfUdRJkX/g9LsxM8DhlXrWVFVngFvAlaFRPd+bM wCI3fJ8zFZDal4fw1RhxmNpYqgXqmsSz+hIfI6J/WkJcINCWTgPji8QxdTaE4ViYxLab X9cpI1EvtyDDoAgzipck4FVqQrEau2v5WXDpkNVBzo0kBpK8oVI+qy+O0otdYEFni1Ba rYtoVW/wNEsmiX0tg4zEatuiCYZw8BMmHJwXeSBCbG85/X43XF0gkIYlWj4u4EreqbZ4 CrmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iSVyAacN7l8MRU6+yXnglhfZd0yPT6M71q0qhoSn658=; b=gZ6+8Urho64q7+p6Pt8qSfW7NjLvsq6gcgZnXjxMrAm6cR+zdNHRtlL9sGN8BBgiU8 pQ57wYn1IS7c3G0ynEz2jEYyCkv03pPt2LhSj1hSN3bXHBCDvLMl3d0eysRlC1hDMhEK TVDpCh6Q0aV1vqEIpkWrCJ2i2mjW9LiyZ3o+jphconKWiwfGoMH1Iy6xEa2PZKlwnRj7 92x/XHnTGYQuZIE7rnF4u0D93Up/UKqYHZoR/cHgofOX3zfB93PebkWJFmT6a9a5OvcW mMFpznj9htinTbEz4ehQt4l6ofktHi3fKTphXKYLE5qZhDphPvqTt0ajeLXK3tJ7qzDr UU4A== X-Gm-Message-State: AOAM532zVp4x/dhfCqrmnt9l6w+VTtItE31h4eUBvDHMH38r+1L5XNZC TLfc0XEUFd4lGHGCpkVEdVx0LOCad2QFtGyTQ63xbg== X-Google-Smtp-Source: ABdhPJxTwVuYpOsUHB/zZCmNgAEl0R34kaWfPaSAc5XQzSsCOzmFbbJ5xQFNjbnBZfWDTPH1mExgV8EmLRtJfclXSTU= X-Received: by 2002:a05:6830:93:: with SMTP id a19mr16704693oto.17.1623743188202; Tue, 15 Jun 2021 00:46:28 -0700 (PDT) MIME-Version: 1.0 References: <20210615014705.2234866-1-dja@axtens.net> <20210615014705.2234866-2-dja@axtens.net> In-Reply-To: <20210615014705.2234866-2-dja@axtens.net> From: Marco Elver Date: Tue, 15 Jun 2021 09:46:16 +0200 Message-ID: Subject: Re: [PATCH v12 1/6] kasan: allow an architecture to disable inline instrumentation To: Daniel Axtens Cc: LKML , Linux Memory Management List , linuxppc-dev@lists.ozlabs.org, kasan-dev , Christophe Leroy , aneesh.kumar@linux.ibm.com, Balbir Singh Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=Ma5dk7dw; spf=pass (imf16.hostedemail.com: domain of elver@google.com designates 209.85.210.46 as permitted sender) smtp.mailfrom=elver@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 5sy3ymcchnk19fyyhsd5zynt4ingar1k X-Rspamd-Queue-Id: 80350801936A X-Rspamd-Server: rspam06 X-HE-Tag: 1623743180-495075 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 Tue, 15 Jun 2021 at 03:47, Daniel Axtens wrote: > > For annoying architectural reasons, it's very difficult to support inline > instrumentation on powerpc64. > > Add a Kconfig flag to allow an arch to disable inline. (It's a bit > annoying to be 'backwards', but I'm not aware of any way to have > an arch force a symbol to be 'n', rather than 'y'.) > > We also disable stack instrumentation in this case as it does things that > are functionally equivalent to inline instrumentation, namely adding > code that touches the shadow directly without going through a C helper. > > Signed-off-by: Daniel Axtens > --- > lib/Kconfig.kasan | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan > index cffc2ebbf185..935814f332a7 100644 > --- a/lib/Kconfig.kasan > +++ b/lib/Kconfig.kasan > @@ -12,6 +12,15 @@ config HAVE_ARCH_KASAN_HW_TAGS > config HAVE_ARCH_KASAN_VMALLOC > bool > > +# Sometimes an architecture might not be able to support inline instrumentation > +# but might be able to support outline instrumentation. This option allows an > +# arch to prevent inline and stack instrumentation from being enabled. This comment could be moved into 'help' of this new config option. > +# ppc64 turns on virtual memory late in boot, after calling into generic code > +# like the device-tree parser, so it uses this in conjuntion with a hook in > +# outline mode to avoid invalid access early in boot. I think the ppc64-related comment isn't necessary and can be moved to arch/ppc64 somewhere, if there isn't one already. > +config ARCH_DISABLE_KASAN_INLINE > + bool > + > config CC_HAS_KASAN_GENERIC > def_bool $(cc-option, -fsanitize=kernel-address) > > @@ -130,6 +139,7 @@ config KASAN_OUTLINE > > config KASAN_INLINE > bool "Inline instrumentation" > + depends on !ARCH_DISABLE_KASAN_INLINE > help > Compiler directly inserts code checking shadow memory before > memory accesses. This is faster than outline (in some workloads > @@ -141,6 +151,7 @@ endchoice > config KASAN_STACK > bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST > depends on KASAN_GENERIC || KASAN_SW_TAGS > + depends on !ARCH_DISABLE_KASAN_INLINE > default y if CC_IS_GCC > help > The LLVM stack address sanitizer has a know problem that > @@ -154,6 +165,9 @@ config KASAN_STACK > but clang users can still enable it for builds without > CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe > to use and enabled by default. > + If the architecture disables inline instrumentation, this is > + also disabled as it adds inline-style instrumentation that > + is run unconditionally. > > config KASAN_SW_TAGS_IDENTIFY > bool "Enable memory corruption identification" > -- > 2.27.0 > > -- > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20210615014705.2234866-2-dja%40axtens.net.