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, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham 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 1378DC433DB for ; Mon, 22 Mar 2021 08:19:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9CE386192D for ; Mon, 22 Mar 2021 08:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CE386192D 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 6A3508D0007; Mon, 22 Mar 2021 04:00:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 651118D0001; Mon, 22 Mar 2021 04:00:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47E688D0007; Mon, 22 Mar 2021 04:00:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 24ED08D0001 for ; Mon, 22 Mar 2021 04:00:18 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7EA478129 for ; Mon, 22 Mar 2021 08:19:08 +0000 (UTC) X-FDA: 77946809976.32.3149D52 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) by imf13.hostedemail.com (Postfix) with ESMTP id 05795E0001AC for ; Mon, 22 Mar 2021 08:19:07 +0000 (UTC) Received: by mail-oo1-f52.google.com with SMTP id j20-20020a4ad6d40000b02901b66fe8acd6so3891665oot.7 for ; Mon, 22 Mar 2021 01:19:07 -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=JBfYmKFZfBEnELsahissKGVzgwoqNgBhQO83P0Ky7Zc=; b=vbc/hSaV4MuILyTU4P286uzmQVg34MFU7tQUli92lqMnCXWwFUEbXjQIcMpQSlbqpZ vCxpSDAOlaKA/4gPzfUIYMOlbCkj45dAwFF9YgyEGe2fyM1jGtbeISW7T3IprN048F3o IkmFqA7MYPGDrWaBcerQ8t3/QzjJ3VmbPg9EBw/MyxaInCYzs9kcemcD/YSVOeHmXBe6 s7cQxiDZCAFmEbHysreQQLCkGqG3LXNGCSsbGwPs6K36c+Kt54OUCzI8ws19WhpYSryf lMkMu0YSVCvhS+HK5mLoSOHfRS95+Wi8951HhXuO0m64scpOGKlA0N3ZEv6XHVv2IOwa VPEg== 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=JBfYmKFZfBEnELsahissKGVzgwoqNgBhQO83P0Ky7Zc=; b=SumawwmlLjlHsTIK217d15z4dqH8FmJozEZplGkhX4wiDUUmtASuuTPhyWn3kyTrhM mVNOdvOyVtmctHuO/3kNrcQxQGjS9V+2KS3H0mOheIwAhmVQVMJlyDPxofoe+WMurhkR 06ccOFL9adUzuffDD8PJ+09cVNaORDJawPQJPL/9MQKVFtQtj1mE45q14gs5tz4qS1pf KhZyxGcxj2QcFDgKus1Bdr0Bb5SXTfN7NAmvoDg0C3rlfuJEXBZ3qTdfAXGboOKwOsZl DH/ESDag/zW1s7Aelcu+q+YB00fJQleYPgSLVPSz/CjdYeHuHuuHQERoOzmjqGHpSFjP f5sQ== X-Gm-Message-State: AOAM5302ojzWJgKWZiA3KCVUzlkGk/cb0/w9EYFUYbLdlj8ILhvSetq8 R1annhtzNU4LxSkEV8Zw/8wMnn/c2W1gsC68z70vuA== X-Google-Smtp-Source: ABdhPJzOfhULA7o6Ke4gbHHc79cRpiFVd1ZzcejhYH+UmuCFogcw4AsJutpy6ZzMe2Ucj0nst5L5zLnLOTOkGxaY3p0= X-Received: by 2002:a4a:d0ce:: with SMTP id u14mr10172401oor.36.1616401147100; Mon, 22 Mar 2021 01:19:07 -0700 (PDT) MIME-Version: 1.0 References: <20210319144058.772525-1-dja@axtens.net> <20210319144058.772525-2-dja@axtens.net> In-Reply-To: <20210319144058.772525-2-dja@axtens.net> From: Marco Elver Date: Mon, 22 Mar 2021 09:18:55 +0100 Message-ID: Subject: Re: [PATCH v11 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" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 05795E0001AC X-Stat-Signature: 949jyc9gn4qzy96gs7kxt1a4n8txgq8p Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mail-oo1-f52.google.com; client-ip=209.85.161.52 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616401147-456172 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 Fri, 19 Mar 2021 at 15:41, 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 | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan > index cffc2ebbf185..7e237dbb6df3 100644 > --- a/lib/Kconfig.kasan > +++ b/lib/Kconfig.kasan > @@ -12,6 +12,9 @@ config HAVE_ARCH_KASAN_HW_TAGS > config HAVE_ARCH_KASAN_VMALLOC > bool > > +config ARCH_DISABLE_KASAN_INLINE > + def_bool n > + Does just "bool" work here? > config CC_HAS_KASAN_GENERIC > def_bool $(cc-option, -fsanitize=kernel-address) > > @@ -130,6 +133,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 > @@ -142,6 +146,7 @@ config KASAN_STACK > bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST > depends on KASAN_GENERIC || KASAN_SW_TAGS > default y if CC_IS_GCC > + depends on !ARCH_DISABLE_KASAN_INLINE Minor, but perhaps this 'depends on' line could be moved up 1 line to be grouped with the other 'depends on'. > help > The LLVM stack address sanitizer has a know problem that > causes excessive stack usage in a lot of functions, see > @@ -154,6 +159,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/20210319144058.772525-2-dja%40axtens.net.