From patchwork Tue Sep 15 21:15:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11777745 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1DBD59D for ; Tue, 15 Sep 2020 21:17:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A474320770 for ; Tue, 15 Sep 2020 21:17:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="vWPqCcAo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A474320770 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 D5AA7900067; Tue, 15 Sep 2020 17:17:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CE49F900012; Tue, 15 Sep 2020 17:17:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B84E1900067; Tue, 15 Sep 2020 17:17:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 8EFFE900012 for ; Tue, 15 Sep 2020 17:17:03 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4C3673489 for ; Tue, 15 Sep 2020 21:17:03 +0000 (UTC) X-FDA: 77266555926.18.help90_0510a9527114 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 19647100EC683 for ; Tue, 15 Sep 2020 21:17:03 +0000 (UTC) X-Spam-Summary: 1,0,0,8c30b646f494e805,d41d8cd98f00b204,3ts9hxwokcdiobrfsmybjzuccuzs.qcazwbil-aayjoqy.cfu@flex--andreyknvl.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1042:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3866:3867:3868:3871:3874:4250:4321:5007:6261:6653:6742:8603:9969:10004:10400:10450:10455:11026:11232:11473:11658:11914:12043:12048:12114:12297:12438:12555:12895:12986:13069:13311:13357:14181:14394:14659:14721:19904:19999:21080:21365:21444:21451:21627:21772:21990:30054,0,RBL:209.85.221.73:@flex--andreyknvl.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04y8xruqtt6tub9mt77ur5nq4jiqsyphwmt9351zjpogx8t41ubtbkh47z6pb85.mjm5xs36zhgxshc1pjq7e63kw6inam78u3cekeeme59jprgwfcq8q83hgjchim1.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,D NSBL:neu X-HE-Tag: help90_0510a9527114 X-Filterd-Recvd-Size: 4531 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 21:17:02 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id j7so1706870wro.14 for ; Tue, 15 Sep 2020 14:17:02 -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=4/ByT/O4Nvro4TMeKsqTFF+dTSNFkXyz3Nr2NgmhNnY=; b=vWPqCcAogi/jKWDdSun+38aXUOu71RzUkxMZHry8mER86ei6RngcWX7q1L6xR8ZMlh QRknTpkFeRjQB1Jy58mQQL41sc1vD8ym2kiC7LjDoQmF23mcwpIPTsdDobRXsA+wx7se onuLgOwct/FFx9HpJ53MiI1FHLQ58Z70nV57zxp96T1XBGa23PiyDtLZxuL6P9a36qYD TJ/ejxtH2CWVIhfzyck0X++QNvuP0WMwnWGT8AdjRRBPqiKJfMUb1CzXadGEgAli4123 XCjrmwUFGZDw094+VZFg3RpgzxrCIaGO/3PmKr636pE4cvr0uy2ePrBnNkou2IwHJHFD c5mA== 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=4/ByT/O4Nvro4TMeKsqTFF+dTSNFkXyz3Nr2NgmhNnY=; b=oYapPqvOiyAtMc+i88jPNkCp792Zx0p473WUGgZSYkM/62cDfvfDCt9lpW6F1H6t8x kFx8kFw+Hz281CZ1fFGnMinybzXhtajbB+F/NDfEeh1ZyLsJ1CHMD7dXDl/lLO2Hmg+9 0nMKVWYtW7cNwh2/UOre0U2+5ehkqgprXyAkyYGi5e3ehG66C80ftPuRSZ6fQGrW/GFN gDtvjLj2k42K2Bte0CT/TGEPeuuXc1GRTf6Jx+sd+vgQpmaXymMnVTS6AvwXx5uTRsNl w2VicIQWLqvnALG7ALJ4fE1HyFsrwzTLMjF8z3HoEyZSjcEqlyY0uC/GQM/lkbg+I20+ 50Qg== X-Gm-Message-State: AOAM530m6a7BJJMY9xyIsa+zX+8ALTZu/wANDTF7nz/XftZl8DoegoEf EFFlDmr6dcdGBElzBaPu2k1uD0QpcgDJbXWr X-Google-Smtp-Source: ABdhPJyJzy0pAfIpJ83kYJpmfubqjIv8bKNgjP3h8jm4Z1uHk8W7Ngaeixu1VZJreyO5PJKTsLfJTs9OkhL7AtDF X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a1c:6385:: with SMTP id x127mr1274747wmb.95.1600204621569; Tue, 15 Sep 2020 14:17:01 -0700 (PDT) Date: Tue, 15 Sep 2020 23:15:58 +0200 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v2 16/37] kasan: kasan_non_canonical_hook only for software modes From: Andrey Konovalov To: Dmitry Vyukov , Vincenzo Frascino , Catalin Marinas , kasan-dev@googlegroups.com Cc: Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Elena Petrova , Branislav Rankov , Kevin Brodsky , Will Deacon , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-Rspamd-Queue-Id: 19647100EC683 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: 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 --- 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 8ad1ced1607d..2cce7c9beea3 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -376,7 +376,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