From patchwork Tue Jun 26 13:15:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10488989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0632060386 for ; Tue, 26 Jun 2018 13:19:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8FA328949 for ; Tue, 26 Jun 2018 13:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB99B28956; Tue, 26 Jun 2018 13:19:05 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A4B228949 for ; Tue, 26 Jun 2018 13:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=gTDlzAasO3ArnFg3uvR3tn8dsggg4OGkDPDyUyV/bzc=; b=pYoQ3BbJc0UvJgXJqQbUG1IDPu OHQw84ss9hWUcJlXcr/QdSA/O+2lKYGWkyttBF37uCaIC4AZTCDp7os8aespx5wOAPX152f4hD8IA r/P0iMwk/731MNEHUQkJH5XNhZAr2zIKIUtVym3OyLlmhyAMKWX50KTHcl8nV88jed0XnxVjSAqHZ 3yzE9avGsI8hoBWJJF/SpHET0N05zdCe7ODgMjV+Q/Ilhm/5X+NlZzGBXhbZtPL6/Bg9rcdASF2H9 7YcrxfbQGkH489UmfO+xFqYMHb0Jbf8UcHkars86uViDY4OJb4AjoxKGfGF4RNSvyTY/BAy0MwbfK lEQgFiXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXnrx-0000Me-TP; Tue, 26 Jun 2018 13:18:53 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXnp0-0007Cs-16 for linux-arm-kernel@lists.infradead.org; Tue, 26 Jun 2018 13:16:15 +0000 Received: by mail-wm0-x243.google.com with SMTP id i139-v6so1881567wmf.4 for ; Tue, 26 Jun 2018 06:15:49 -0700 (PDT) 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; bh=HVZ6yIjTM13mswNjnQk6+zabyo8SS7fb5UklqkhM58w=; b=K0T/BGtTWmwZIbXc0p7bznJ2J1hlkZXaH4Na6xLHuqk3/fvwfKwCuSFhGdI+We10Qm FBzoOkizeuy6DDOVYS71GGrq3NDkoqMMtkOBWyJAvD+9Dl9j34GnaTto7tqDxuB41zVj 14W6fsFQiWjKP0Z5lkERDCdurq1mmgoYrRjEbnX14OmMd1BevlI5zYPzLXzfEgJ7f3Tp iOc5qRaVsBgNxfwQs6IRlIj5ol3KoZGMfvVhTM06DKRaSSTP+Dfm0c52lX+VH5X0BpkY hi801AoIZdfrhkGBjCDv5mkztBDUJfP4Sw5P1JxkNe8kb7ym7PfBTXi4/bc1ke6Ms4oq K5Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HVZ6yIjTM13mswNjnQk6+zabyo8SS7fb5UklqkhM58w=; b=uHBpQ6UbE5j8K9qIWUBA3VuZ58gpXO5QvBnSPbSh9zZ1ilV0eVqvvrPzmqrmArjhBd dm3dijcjRHW10D7Hb04qjmGsS2ACojc/RSxczyOwT0wwbwZ9WV0LT7h/Ep/n9hgTppEg g6m3WBruwMCZEc5aiIfuzXMZc4bF/TfEnPkCw1hk/jQ/l5VRyLFRghmH+s8q21IB419L bB1UiP6wvx7GLOKcBgugAD4jUbzVboLdWUMiXbtMa5hCiDjCdpAFjusDUsCsvIRYhIHG kwbFUOp2rsqu4uURi2YjcB87a6TN5PufvIxHxo4SEd7zUUEVh7IhgcVklHp6zcAwbXFg /cfw== X-Gm-Message-State: APt69E3aXhuzBlZfF+SIuNit5EuG3IX/txfTCMcYRMNNtfpeL6BvbOV6 ua9WP/gv7KMcD7SyHhb7wIjxsg== X-Google-Smtp-Source: AAOMgpcuL71s6ITvRElHRCV0fhXpbdNKVTBvRFWyz74HHMzJAqrfEwh7IMXX26xQEeCg/QmJNqgXZA== X-Received: by 2002:a1c:d388:: with SMTP id k130-v6mr1588299wmg.66.1530018947902; Tue, 26 Jun 2018 06:15:47 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id w15-v6sm2162639wrn.25.2018.06.26.06.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 06:15:46 -0700 (PDT) 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 Subject: [PATCH v4 08/17] khwasan, arm64: fix up fault handling logic Date: Tue, 26 Jun 2018 15:15:18 +0200 Message-Id: <9f3e30f8144682c989bbf9fdac081501258a0b06.1530018818.git.andreyknvl@google.com> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180626_061550_245241_481B98D9 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 KHWASAN enabled. Reset the top byte. 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 b8eecc7b9531..b7b152783d54 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,8 @@ void show_pte(unsigned long addr) pgd_t *pgdp; pgd_t pgd; + addr = (unsigned long)khwasan_reset_tag((void *)addr); + if (addr < TASK_SIZE) { /* TTBR0 */ mm = current->active_mm;