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=-15.8 required=3.0 tests=BAYES_00,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 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 94DB6C433C1 for ; Mon, 22 Mar 2021 00:29:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 081E06190A for ; Mon, 22 Mar 2021 00:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 081E06190A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 24C106B0036; Sun, 21 Mar 2021 20:29:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 223836B006C; Sun, 21 Mar 2021 20:29:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C4AF6B0070; Sun, 21 Mar 2021 20:29:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id E49B76B0036 for ; Sun, 21 Mar 2021 20:29:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A018B5DF0 for ; Mon, 22 Mar 2021 00:29:37 +0000 (UTC) X-FDA: 77945626794.08.C24FE4E Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf10.hostedemail.com (Postfix) with ESMTP id 202FA407F8DC for ; Mon, 22 Mar 2021 00:29:36 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so7618607pjv.1 for ; Sun, 21 Mar 2021 17:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=mN9M2gHDmHAMZP+50/Nsn8lRknSmspKGtmjuk7ePwS4=; b=LIWwyHHNktv8GP6XKK9oeK5MSL/7YlonGPEGcdfj73hiYJ3jW/UjEflWYG7ADC9ung +gQJhzdmo+TJ+pv7YoE+5JEPfYaCTZVrRo9hUj8H39b6bjycfjCDcvuoImxhv/1B9AxF F6hetDo8fEmbCZnSEQU3nAaVWQwEN1xZ6u7FE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=mN9M2gHDmHAMZP+50/Nsn8lRknSmspKGtmjuk7ePwS4=; b=PVkZp2qYhafsomH88eYjwc14l3VeeJkYrBASVbpLoqlcn4CbmEFJ8HGRE2JRwKNz9l NGOBxAZiFJ7a45D6ZWHo6ZhP++eEWYGfX2EyG/Sf6ZLfZ2+bu/QOlxqsV0lhM2f+vJ1Z WObOYeZbmuhOQSc5IOmxb1BraAnpZWhZXAtFmIVxUqcpCF6r9zYbwNJBeTFjdnfMjKwg 9UdAt5uChutBEi/ek5lr6xXrydiyWZTonppA27mMunELis0RX/xZWeT72ViAkv4QTblb XS+hL3jItysI+h0huiX9R82pp9iBMru9nqZ7ifmxdX8qxH0Yxfg6ptHOSyJCgrxVjWBs rwcg== X-Gm-Message-State: AOAM531JyiRb4eHyiez99/sQ6wpuc3Rt24M4hf8P2yMWA/tO6+jihujO GYzUEXE1nFxoOHE/7MZxCi7GIA== X-Google-Smtp-Source: ABdhPJyZ/jN5TaWP814l7V73C6xJ4pkB8X56MyPwnqT5f4D8rK22D0Wcv1lAfC6UQf3ARiG2+GsELQ== X-Received: by 2002:a17:903:228c:b029:e6:4c7e:1cbc with SMTP id b12-20020a170903228cb02900e64c7e1cbcmr24592365plh.38.1616372976026; Sun, 21 Mar 2021 17:29:36 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-b0f2-84a1-ce9a-a0fd.static.ipv6.internode.on.net. [2001:44b8:1113:6700:b0f2:84a1:ce9a:a0fd]) by smtp.gmail.com with ESMTPSA id i10sm12299634pgo.75.2021.03.21.17.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 17:29:35 -0700 (PDT) From: Daniel Axtens To: Balbir Singh Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, kasan-dev@googlegroups.com, christophe.leroy@csgroup.eu, aneesh.kumar@linux.ibm.com Subject: Re: [PATCH v11 1/6] kasan: allow an architecture to disable inline instrumentation In-Reply-To: <20210320014606.GB77072@balbir-desktop> References: <20210319144058.772525-1-dja@axtens.net> <20210319144058.772525-2-dja@axtens.net> <20210320014606.GB77072@balbir-desktop> Date: Mon, 22 Mar 2021 11:29:32 +1100 Message-ID: <87r1k8av4j.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 202FA407F8DC X-Stat-Signature: o5kmy6pwcxqqxaab6fr778bwo1baqurx Received-SPF: none (axtens.net>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=mail-pj1-f48.google.com; client-ip=209.85.216.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616372976-918109 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: Balbir Singh writes: > On Sat, Mar 20, 2021 at 01:40:53AM +1100, Daniel Axtens wrote: >> For annoying architectural reasons, it's very difficult to support inline >> instrumentation on powerpc64. > > I think we can expand here and talk about how in hash mode, the vmalloc > address space is in a region of memory different than where kernel virtual > addresses are mapped. Did I recollect the reason correctly? I think that's _a_ reason, but for radix mode (which is all I support at the moment), the reason is a bit simpler. We call into generic code like the DT parser and printk when we have translations off. The shadow region lives at c00e.... which is not part of the linear mapping, so if you try to access the shadow while in real mode you will access unmapped memory and (at least on PowerNV) take a machine check. >> >> 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 >> + > > Some comments on what arch's want to disable kasan inline would > be helpful and why. Sure, added. Kind regards, Daniel