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: 10488979 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 65EFA60386 for ; Tue, 26 Jun 2018 13:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54B9527F8C for ; Tue, 26 Jun 2018 13:18:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 492DC27DA4; Tue, 26 Jun 2018 13:18: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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F12B827D4A for ; Tue, 26 Jun 2018 13:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935479AbeFZNPy (ORCPT ); Tue, 26 Jun 2018 09:15:54 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52091 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935484AbeFZNPt (ORCPT ); Tue, 26 Jun 2018 09:15:49 -0400 Received: by mail-wm0-f66.google.com with SMTP id w137-v6so1907452wmw.1 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=bkTRovAlTWU5YIZcmS1tBdPexLEWCTJgHjtZxsP0Y1QIUIZMTb6k+sBaZwWvQGTGuj vbkJLaEgw5FHiEDoCnPm08hmEtwrK9w5QM7JCIH9ouSp7Q+hGbD1eTWpRyWUjpNKPQSo KfS9Ts1k1xa/CqjwhmkmzYRApQtcvhhvBUNv/KH3J0VcWpzn7YurVi8xHfYTPDmCWOYl Vy8eSYKKRUzulso+ywy3KSPPdJb7D52QRMrEzTHPx1zPJLzGYTpwlPAMuCHYwsJes9Jz MbJCkRRrHv2VgIf0mqqsfG3xYR5jlqKkY6fcUZYycZ156pVtXNLhdpOcUMHayGSjHfDT F9Hg== X-Gm-Message-State: APt69E2VoCxQyiQAYfOWBOqgDHK2YUOhWjXv3tiL6ueVMPDTf8LaYWpy /tnRVwyoFoRfOuP6qk7jTV+E4Q== 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 Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Andrey Konovalov 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: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.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;