From patchwork Thu Oct 29 19:25:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11867411 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 BA927C55178 for ; Thu, 29 Oct 2020 19:37:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 187A2206D4 for ; Thu, 29 Oct 2020 19:37:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Bh9EeMFL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="K1nHe9B/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 187A2206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fUPWOtLXMSTsvoqTtcTB3bJQyUB7pV/iN8bjRzsmMfk=; b=Bh9EeMFLg8pV96J2V/VaQYusH kBB11GzBQQKqL7sBavyYk6GY0U4dgwxUxGrQeEVf63g/bt79eKjkoiKqQBE/ElpA1H+g85aN9w+Sk 0eNsWd9JE0IgADa2gBxLQs6a563J6C8kUFUokhOkbpRd0L4y0hD9GVxUF6H8R/cAWAzmsPzGFjMpU 79LhSPDQ+iwdajZDsw1PSIObvVbcYnP0/GWn42Y9mtw5OE/j7CvV5goPET7wZWbJu12FvMSbGR6v6 LNNaRsDHNb+pQ9wuaQHnLSuXZ92PLpw8TqC8Z7w37Zkk+bu3fH2R80hmrncADBioXaDABNaRr+6lF Sf2Gan4aw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYDip-0002CD-Bo; Thu, 29 Oct 2020 19:36:32 +0000 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYDZt-0006xf-6G for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2020 19:27:43 +0000 Received: by mail-wr1-x449.google.com with SMTP id f11so1673188wro.15 for ; Thu, 29 Oct 2020 12:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=oA6gmttblv8OmG3VJbCFTsqSwJTzGphkOsRK2ZeD750=; b=K1nHe9B/C1vUVBhjmN3ouwiA2G8Bil+4lOTK4Roy4CfYBtAkrBiqvKLoffIsQ5dmeX 4w/tPJkLIjUxjWrbGhK0uX5TQJI8bCt9+XdTeg5hW1m2Rsh0lf7zBUkd2HOwOy5V35UP I5AnLEtT559b5rZqwgyQ7rwK3svrcoNaPYuS0x+6UIyRM10MNv9USnXLkRS4tyoxptqy WZAZekCmx94CldQgMK9MtCE5xD9/yCStJIYW8OHRxW5FdCXkIpoSi6VL6O22VJ6oPFGN 9eD/c7wi8u6kDY0pqkXgwr9qCNFo6OZzfG4hwkWRHspPfd00kIIJ9yHGokHi1nDcyTN3 VXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=oA6gmttblv8OmG3VJbCFTsqSwJTzGphkOsRK2ZeD750=; b=JMdCje073rmmK24N2vOdQANIzMcz2AHLDTC2qXIzYJ+FVrFAYkdZeA7SbjM29ZksXb 4k+xZqZ+S2j4Rwg7geHqZuy3Pms1lVRcV2ti7xMIQpxSBF7N2I77mpVv+AVVAoDHUCt/ T6rh3wu3eVsQRMEVO5iXFHH0mfkY+6RI3C8R/l69LTLetYJrD3a1U4FrKH3aoXcU8Q1V UKS4H1ni87nvuChcgxvWnAllrMyGimGzssB8I1RRRcGzRSpLXiz4g4Z7UNwVk4wFammM vS+8OLOhAh+n6oR7jZu+dBMugQPY26YTy2pasx9smmmfstG6Hbq8H45Ndnr47u3AJVWH 7+Ww== X-Gm-Message-State: AOAM533rbItvTLzTl87u8WJeuKkUmE29+oeCc7wSBVpAlzio2fTz8KXZ RwRcDwzqCZj7ZZXuFKv6QeAHXBS1t3Lj6+tW X-Google-Smtp-Source: ABdhPJwLqg9Q2JCfZvLcHaZRnmwgB3K3EMmizulaJN0u7Fm4WDLwURsOiao/6X8pMf0ooBjhb23kIF7zGzlFYh6+ X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a7b:c92c:: with SMTP id h12mr464316wml.134.1603999633473; Thu, 29 Oct 2020 12:27:13 -0700 (PDT) Date: Thu, 29 Oct 2020 20:25:48 +0100 In-Reply-To: Message-Id: <36ab70fef7688f7a43871b82320784a67f8ffb10.1603999489.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v6 27/40] kasan: kasan_non_canonical_hook only for software modes From: Andrey Konovalov To: Catalin Marinas , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201029_152717_400492_42FD1A89 X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Marco Elver , Elena Petrova , Andrey Konovalov , Kevin Brodsky , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is a preparatory commit for the upcoming addition of a new hardware tag-based (MTE-based) KASAN mode. kasan_non_canonical_hook() is only applicable to KASAN modes that use shadow memory, and won't be needed for hardware tag-based KASAN. No functional changes for software modes. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Marco Elver --- Change-Id: Icc9f5ef100a2e86f3a4214a0c3131a68266181b2 --- mm/kasan/report.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 5d5733831ad7..594bad2a3a5e 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -403,7 +403,8 @@ bool kasan_report(unsigned long addr, size_t size, bool is_write, return ret; } -#ifdef CONFIG_KASAN_INLINE +#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \ + defined(CONFIG_KASAN_INLINE) /* * With CONFIG_KASAN_INLINE, accesses to bogus pointers (outside the high * canonical half of the address space) cause out-of-bounds shadow memory reads