From patchwork Wed Nov 4 23:18:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11883259 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.7 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 9BA2FC00A89 for ; Thu, 5 Nov 2020 05:08:31 +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 B2D3C21556 for ; Thu, 5 Nov 2020 05:08:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s6PSVleh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IHVPl2+n"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="br613dpy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2D3C21556 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=s6PSVlehXlLxtee/N8K2zJbBT ERPQDXbSg0w6O4+RjMxeIdDsY8RbsQpMy/MJ75mBodMinljAfXqqbLFNmOdZZRfEZO1tguMGBqgut gJCb+5i7p1f7TDQ6MQy+myH2c48BFUoJzTeY62MP8CtF4gUCfffZbQsmFgDWF/t3PehE2wfM3uGm/ ROWm67ShlJAp4+7FPxHIvMiUg7XJVGcv/Z9ncHQv1mN7Hq7mIdJg7Q3rQb9pxyhpyA7jxTCk4FwZY zTaQYGPYKNW2vSldJqLaVrzH8s3du3Yu1agFJzfhXcliCGxs82N2werUstFv3uVNIrI2zbQl/2p7T i8OXS38uQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaXTZ-0005FX-9F; Thu, 05 Nov 2020 05:06:21 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaW5D-00016k-Or for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:37:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oA6gmttblv8OmG3VJbCFTsqSwJTzGphkOsRK2ZeD750=; b=IHVPl2+nKbvM0s37PdRf8jdK0F lwXZtnkz68qcZjRHmKtzH1ptf0+opngzdiGvu7toYWgA2f5wtXNwW1Q7WVGAd8UwpjREQapzZp01M vdgHz/W3sc75/mOPuRXMK0hkxYBy7hnIccYoJT6hR6Ias5bzdWPthKZOaJqfa7b/4A9D9y2wV6/tn T4I2UWAuKn+6JLsC6l5Hq90H5Nzc0AormOllEd1W1lr2QHRrmE/hkgIBOZRBm5Avo0s6sfBZeyjdk xtTbsELConX8qFgxAV6aCU1JjHBwdwMe4ybmlcwsRr9y20MQoeycAdNZz7lKbtepctQxSOkBRmqZ2 C/SUojQA==; Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaS5K-00043y-OD for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 23:21:00 +0000 Received: by mail-qv1-xf49.google.com with SMTP id q19so4912qvs.5 for ; Wed, 04 Nov 2020 15:20:58 -0800 (PST) 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=br613dpyefM6H17vxZ5Q4p0T39IrkLkDnZLDTiqqPDpFMMgCo+4VFo3LKvZ1P6Dslp Mf0CE4Fw8PeS1fwsbMEmuShN8+EPmelyh7nDN5LzLby357nasoxjb1LANRxkuexwVPYe LwxGSUVFyLKhDH7ttzPPyxGueeWEhdpcVUDqW8ywGJLzVo4fA0K/aUx0n7km3P0JtRv3 Bp90RJW5FmSu2QzXaJFlBCHC5YOHK7dIZG60fFIdPzS0+fZH/bTCh+FrxoeQO07FhrqG RDBlgXLvB97eS/lAALxVKBMD+H2a58tt8HMP59QEf4qm99yP2PbJYpKXnSdMApGfMszG ugBQ== 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=Q/HAGsNRJLE5PY87QknJN08ViFzzYNqHBlfR/M3/lRdYVdv2yP9XDn5zed4fmWbpOS 03j5VeV8dg6NPWG2gBXQFdyTGplShCDkFjXLOD8/6noIu8jKoO8niOLLLw9Z8BokHXgp 6zBkbbhtCMB5/jHIYfZTDxEAi37E8fiVkL+JkOKpM4N/P5ZzuW34uEl1t1YhtwrLSiad bEXQVqLohRFqtpWh1p8KciItCCuGQ5xvMMkRqLrJI6+vQbY2eTCVx/dK1KFJ/j1aPfAX 9HrH9xTTuxPKuT3wAEAOMuO89G1shUd9L3Ledn+vwJOYSWxRzxaBiXv8RcVtRScOtp88 jA2w== X-Gm-Message-State: AOAM531GLz3LCk8lN5B5cgrRVv4kKn9LEI8nUgfTD42mxCmM/wm6vssw v6G5DRlqgBhs6oJBQbAZ0GSYvhziYuwBZjtz X-Google-Smtp-Source: ABdhPJw3SygWDpOISuAZQmg79+TdwGrWwFo7fxBzvvQW4z2e0Vzd9qlw00Tr0XM9KlVC8zJMzixPFDkx2UiyGedC X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:414d:: with SMTP id z13mr147192qvp.37.1604531997034; Wed, 04 Nov 2020 15:19:57 -0800 (PST) Date: Thu, 5 Nov 2020 00:18:36 +0100 In-Reply-To: Message-Id: <45dce4028d9f5e4c5705b481a8ac37bf516caa16.1604531793.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v8 21/43] kasan: kasan_non_canonical_hook only for software modes From: Andrey Konovalov To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_232058_945730_7DE9A3CD X-CRM114-Status: GOOD ( 11.28 ) 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 , Andrey Konovalov , Kevin Brodsky , Will Deacon , 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