From patchwork Tue Nov 6 17:30:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10670953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BB1915E9 for ; Tue, 6 Nov 2018 17:31:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25F752AB30 for ; Tue, 6 Nov 2018 17:31:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2339E2ABCA; Tue, 6 Nov 2018 17:31:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A62392ABBF for ; Tue, 6 Nov 2018 17:31:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B49886B0366; Tue, 6 Nov 2018 12:31:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B20EC6B0368; Tue, 6 Nov 2018 12:31:03 -0500 (EST) 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 9C3156B0369; Tue, 6 Nov 2018 12:31:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id 468896B0366 for ; Tue, 6 Nov 2018 12:31:03 -0500 (EST) Received: by mail-wr1-f71.google.com with SMTP id a8-v6so12189207wrr.16 for ; Tue, 06 Nov 2018 09:31:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gQItUgY2gYwGKzTfMCUdpYoluo1ZEefUN3xekUmwX5I=; b=FrNjrYit7z1o26c9Tcya2NVXYKOzUXAgJ81oKVAxySs2vfswVkDWdGGtQSTc2b09Pz ZYUf+oUn2+A4vvzmwVBhqLCBkNeOLBe+u2zBKEmhisjOqmjuRSOKGPmSzIgTfRnlWMev /qqUFd0H72WSZ5nzMLLgh3z7KGsN58ynM1dhCE9uPq0af6X2aOT+TXdQCw8DuavOq1U5 f3l3AxCDK63JHGtNql6jpDZQq7Gk6vgsNxHWpPJQ9fv33H29l1/DqW8jEsUPAtZM6Ghb N0vvv0bcyHu+AuuMpR0zAsB1eCpl0Q4kaLJzfME2g9B1fqpKIQJat10H26T9wh6fM8JQ K2Zg== X-Gm-Message-State: AGRZ1gKWgkKlU7rHk4tOMHW4bt+V/t1H8BTIMFoZOGB//8daJ9Ds/ZMX ff03L999I+hFTdYv1Ks0h/oTS9hDoa0qokG7ihzybGBQG9faqjnkq0Us3MZh/b8+u+N48NLwvFH ygTmJ7L3ZvNAbUkBKuYLXXwc9vwGk+1d4QKTyI2aoOb3anvl7hYKaY5slPX+yFumjYycF5Sl/wc 7kIlzjQo74leKshcbwrZvzSrCLQce8ZUewaf69EiigBi1WkL7+oqiOur2NQZ7xlP19q0HIAXSOV TiiklAeQa7o+DXobabs2HzVT0sxAu6rvgnM8QQUz4FuKTlI8V+m2lNNZDrCUreRdTUUcBQW7dZX W2arVyPqoEfVc2ORLhA7pYrYo/pl1vQiKWWtqOO2BdU+SL98LoauX98tlsZhVdFSDOpXhxV0WYI v X-Received: by 2002:a1c:7dd7:: with SMTP id y206-v6mr2933273wmc.78.1541525462717; Tue, 06 Nov 2018 09:31:02 -0800 (PST) X-Received: by 2002:a1c:7dd7:: with SMTP id y206-v6mr2933227wmc.78.1541525461858; Tue, 06 Nov 2018 09:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541525461; cv=none; d=google.com; s=arc-20160816; b=AvDvDir0k+2Pf9rDnuqru8RDn6tfkSMUqOUHJnaJpH1pXHimpMqA0XGt3ZIZkNDoEk Rk/FBiwgsLjTpor6jcFCbCCzQHBuizbLUsYLQNeJiKF06uzer//OdA/F1uwzoeBtkDAn r6Dc7kva0ORiqZYp/ZZeCyXz/0CmYRvFff9UouTQqVH6qmP6VLzEXKydzJ8HlYmlSBhg xjG0a4RcYofPr8yotQSrs5LKC3KhuVkQLBvu7+a5oAJ6+6i3xyqIjwHSvkPRiv09Zwgi IPPZbiWz1X8+/0B3rQfDlgzWVO+wS/DC4kKvwXPo2DqXGRNUpHSKFVMQt4/f7lq6E1G8 UzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gQItUgY2gYwGKzTfMCUdpYoluo1ZEefUN3xekUmwX5I=; b=X0Ee957VJQ+8ps6pSCHXGxa/mjw4bwGwTwAbvvE6FwiHu33XnMZ1UOke1hR3NS4Z74 LOs0VKgwNVCeDhXLoMRuDrI4+eb2PHKKAtoK5cysj8toZ8TIQUEwdRo5MuASBvSM2isK izfk2W8bxjxWCcdlWPRP7Qt1b6PcLbxsjz8fjfoo6Wh2Z2qGbbyoUDbiZdbj3lkuLeEU c1ZF+fvWzrt4R9SF0+5rnG7/RE71OyBcoQ14yVl06uN2wIOdLI2PmjrkvBL8N4vGJhXl UFBPk3lqSbEG5mJuphaRPZ+q959t1im0HQGg8LcucJL1U6ibLXVJZXXYIKt3gQva3oF7 yWkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NCUfaaky; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 3-v6sor1645702wmd.3.2018.11.06.09.31.01 for (Google Transport Security); Tue, 06 Nov 2018 09:31:01 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NCUfaaky; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gQItUgY2gYwGKzTfMCUdpYoluo1ZEefUN3xekUmwX5I=; b=NCUfaakydyP1mEvjAcq8JqZWWvdcWMF4TaNfXTuOsryR1QLHPetRjJptGyLqia1LZ+ Ez1ekzw0lIFJ5zjJ3XMv0NGNc/pM04k26s037zRcMLaiQu2rwvOojgssKOv9bj3TUkKH j4LlZXbpr2MmixQik019u26VRZ068PYuvDqTRX00emE+RaLbDhlG9S3rqgy+rfR84VN8 vHzyWrq2sL6WmXv0GqN3HiTlTzotv9mWtuiirsp2rfxQyxAocP1ytm9By7vHNEzCp7pn UCA1eM2qOccn1KI00dbkHUrGtgR+uj1A6jGQc30kzEZb/2SowEoFdUPv7lcsBaxlqWRD 26Uw== X-Google-Smtp-Source: AJdET5ewibFtIOBChjomp4ASbXPo7qin6bueX7L2jOoKAZ7ADOmOLeDKrR8tezhA6WYSL8tTi7qH3A== X-Received: by 2002:a1c:b8d:: with SMTP id 135-v6mr2659929wml.128.1541525461350; Tue, 06 Nov 2018 09:31:01 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id z17-v6sm16328416wrm.65.2018.11.06.09.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 09:31:00 -0800 (PST) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan , Andrey Konovalov Subject: [PATCH v10 12/22] kasan, arm64: fix up fault handling logic Date: Tue, 6 Nov 2018 18:30:27 +0100 Message-Id: <4891a504adf61c0daf1e83642b6f7519328dfd5f.1541525354.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: References: MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP show_pte in arm64 fault handling relies on the fact that the top byte of a kernel pointer is 0xff, which isn't always the case with tag-based KASAN. This patch resets the top byte in show_pte. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/arm64/mm/fault.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 7d9571f4ae3d..d9a84d6f3343 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -141,6 +142,8 @@ void show_pte(unsigned long addr) pgd_t *pgdp; pgd_t pgd; + addr = (unsigned long)kasan_reset_tag((void *)addr); + if (addr < TASK_SIZE) { /* TTBR0 */ mm = current->active_mm;