From patchwork Tue Nov 10 22:10:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895747 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 779A0C4742C for ; Tue, 10 Nov 2020 22:43:01 +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 15E66206B6 for ; Tue, 10 Nov 2020 22:43:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mx6YuJBF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FAIcvB1r"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="CLSgr8f8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15E66206B6 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=XAx7++4MBM7GPRH327nJMT8Bgp8RDYH6+iM3tVuRrsQ=; b=mx6YuJBFbEPy9kfnoumEPSiLM ZYEs1CRXUwkYgd6nROheLXQJTsYEkUaD9aaF+zTvwedIrJZgBwxXKIRsmuVnHmsPx2WY7/Xw0HTeC rgH8ick4aPPbOHHhBGgYeMJNhDfBobBkbO3a6j3qAZ3mxJZVkGDkEvMXQ234eN87BCA4ZpIZ6yfJx hBpj24TPruVZzZgUAhCtSUxf2vFs1CdxkpdQDJ4O8e8aDSLutBIGDaiKVeQ+hrhdAGEUgtRoHIv8e ERG6Wllru8EcRgDeYp1pQmvsEK02sXB+3dPSVJ0UV85kfd72g5Oq4A0OXhHCIYWb1BLga8E7+MRzR 7nMv+F7Ug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccLF-0001Ru-K6; Tue, 10 Nov 2020 22:42: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 1kccBW-0005D9-9g for linux-arm-kernel@merlin.infradead.org; Tue, 10 Nov 2020 22:32:19 +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=5uhZzkc7GaVITot0FsuHIhcvnz4Kwzzg7fDog44yjpY=; b=FAIcvB1r4bb1ghbKQrCh/iFpit RoEi8HwL8or/GPy/I3sDuWf7Sc5e3T1jMt1ZHJlCkGuc3vD3UtyCTXp32qpcZawrH/CS9BBAps749 PPBCLhVif7Fl+f1x1zmpu0cwUHT3kFwsAAquSIhz55eVxhda42ZTEe36i4xnSSek0BXArOF9XOC6g ppS96755afYe7s8YU7aTWJw+Giud79bP8EJfCr9J+5/3ZG+l/vy5lEuZDZUobvgzL/DrhtrezmafV MHtFTcsM3h4oKPxk7dQqlPkQ+9jk2wogF6u6BAQ7OSqhqszx42XCPlTgUnc/WRkZo+o5Jm9SYcork OTvful2Q==; Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcbrs-0007Xw-6U for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:12:05 +0000 Received: by mail-qt1-x84a.google.com with SMTP id l67so8476690qte.6 for ; Tue, 10 Nov 2020 14:11: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=5uhZzkc7GaVITot0FsuHIhcvnz4Kwzzg7fDog44yjpY=; b=CLSgr8f8FTIZg6bMIyxaGVeeEcFOrWMDPbZPAvZT1MfB4z8Suhe5boRMsumGyvFNk1 LjKKm50iHbXfmNRu6XUs4UoHXQGDFig39TSyU2sHd0hIZ2EmrYhkxzXr8U4p+VkIwgdM 2IMyJ+g9REJj6rC5asdtdPRqDTIWpdnLuyBD3ISr476SrLsl4NF2QxsJYt1ycv9Li3MH c9uWYFVeV0cpoffBVtKxcgpoC5/H2MqBNHloRHtFwiFpBpQmj6raqt5/JRE4I92gqqWy iMqrQ8YQcXmy5elG+vxv2r33iGPpMhXlwcHnNfP58dfpYMKVCKC1qKG9aVX4wbq0hppg wL1Q== 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=5uhZzkc7GaVITot0FsuHIhcvnz4Kwzzg7fDog44yjpY=; b=DW1PiyitYcm6JbJJDLDNqw1Mgy0xl2CDUpbZeHJC2NLMowDVwuRAPuaYWLja4ezF9V qL8Mq0DX5u0EIW57Wo/kbw/5GJm9TyNrcmfhvgWUtLWFoHEDhxWKOWPpIx5lPBEG5alj 0i5U86JLj7N4dvQoKEOJKXyj91SrNLm1FZ01spUDwX3IMd/cAdW2H9JT0WgNubbm20Su VZjPer9SQkT5/7qOYMDDk810YLrVmxiegCt1bDZNoUpP9xLpMC2DM1aZSk1XxznxMgmn 14qwvPA4pgFv/MFjzAzOmbTMP3G67ZdjNAKpG6bJWmp2/B6X1zXS7XGN5PU6CbI0YeVB S71g== X-Gm-Message-State: AOAM531yhLod4WfMRQOrZ+IyWboBpL00+ry7uiGQ9mTCUqXjRIhC+QxL pHbQ0Cn4aiLwGMROtk7dfp73WBMlRiwPo/XG X-Google-Smtp-Source: ABdhPJxlGUcHEC0cFkjY++xEGK8kde6sgJxy5/dNx6kc2EDZ6TfPWJDPwJEgMWeFJJ/BNXjkc/AzCq+AKE2M2FFw X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:47b0:: with SMTP id a16mr21217064qvz.22.1605046316972; Tue, 10 Nov 2020 14:11:56 -0800 (PST) Date: Tue, 10 Nov 2020 23:10:18 +0100 In-Reply-To: Message-Id: <49f7f2c12b0d5805f9a7b7092b986bbc2dd077a1.1605046192.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v9 21/44] 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-20201110_221201_453464_8338485C X-CRM114-Status: GOOD ( 11.33 ) 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