From patchwork Thu Aug 9 19:21:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10561791 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 283081390 for ; Thu, 9 Aug 2018 19:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 176BD2B911 for ; Thu, 9 Aug 2018 19:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A68D2B929; Thu, 9 Aug 2018 19:22:39 +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=unavailable 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 B46F82B904 for ; Thu, 9 Aug 2018 19:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727467AbeHIVrq (ORCPT ); Thu, 9 Aug 2018 17:47:46 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34797 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727591AbeHIVrp (ORCPT ); Thu, 9 Aug 2018 17:47:45 -0400 Received: by mail-wr1-f68.google.com with SMTP id c13-v6so6116926wrt.1 for ; Thu, 09 Aug 2018 12:21:30 -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 :mime-version:content-transfer-encoding; bh=8+04WRzIPiPgey4OPz4HFnYO/J88O5syronaT3xg5j0=; b=nxQ591Vhu03jnMxTYftvDNh225xeMHTn98JxuP6moeqXBbN9Wz89hlVBaEjcdTix/Q JRwhpBR80Gj1SHIRxBzEIJpPHE0ATKaojKZcNppqoD3eSLfSwJt62hQcbI+yB1lR5U0g 2EctZIagziNIyXWykgBIYJMtOuzWS4CSipKmJoUvEfFlMHcj2uAwIxJ7RR5ZA4IPAUhu 5w9rpydzp/Auhu1I81jLZccIFqUC+UGbqcwsEghtsA0vN32f/VyWRYK9wFnoNr4dHP6k kjHB0RKkKxr6fPi5vhpNLvGvoiUJVpk4pPHrJNama0hpw7dPu9m1uD3R+oeqfeucRXyC GqpQ== 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:mime-version:content-transfer-encoding; bh=8+04WRzIPiPgey4OPz4HFnYO/J88O5syronaT3xg5j0=; b=T2CcIQVGfssIBfRFD2ByN/PTPKwiNmwFBZfyyDFrJerUcrZ369INw8zGg7zizLPsdg vgIGFyz7HIe5BJwKtyfZddSpJ87MJ17BanKkNRfLx6tsc6VpPHOCLfOBVz+YyIrhOjRG OUyJDhch0cSc/lhG+KtC7D8aO8Xkz+tiEZSHjLfZzWy3h34u+71wTffHgfXmdncvMlbF rORMDkNaeZ7JpWTB1RFuCx1K0UDDDe8Fv3/K+0hiOPjG94XrG5QsbZEIcJGDhDNBQBTw 6p7oWlnJUErctqZXTC1n9mZjhE0dQIxA+htlIN+0DkuSWA5qLxuzSYGd5bNaSInUL/xj 9NLg== X-Gm-Message-State: AOUpUlGkz3Ku2OBXTbBJSxuiGOQwKCGBC7VviZsm3feRsBz5tqWUgM2q iHnCJ50JLe8UzKw8beRcEEaqAA== X-Google-Smtp-Source: AA+uWPwd82lZWG8HymUYNafSfNQe3iX/xSKDivVKRCbcK1qe34tzRwCCiSDAxySAScuUxsFNJYa/KA== X-Received: by 2002:adf:a789:: with SMTP id j9-v6mr2120826wrc.277.1533842489885; Thu, 09 Aug 2018 12:21:29 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id o14-v6sm14738797wmd.35.2018.08.09.12.21.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 12:21:29 -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 , Vishwath Mohan , Andrey Konovalov Subject: [PATCH v5 09/18] khwasan, arm64: fix up fault handling logic Date: Thu, 9 Aug 2018 21:21:01 +0200 Message-Id: X-Mailer: git-send-email 2.18.0.597.ga71716f1ad-goog In-Reply-To: References: MIME-Version: 1.0 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;