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: 10561823 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 C19CF1390 for ; Thu, 9 Aug 2018 19:23:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADD3A2B907 for ; Thu, 9 Aug 2018 19:23:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1ACF2B929; Thu, 9 Aug 2018 19:23:28 +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 572382B907 for ; Thu, 9 Aug 2018 19:23:28 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=4VP0IwMdHJ9aixAROUwVppd+TROAdrSNuVi3ZRQppQs=; b=CiXWVlEqsB/r9c bM9QfcgwA6ReFY1vAO32+rqA+wk9E6cxE8bk2CZjStvx455uuTNvLdWZ1mauHkQUnEgzfbZsMY38L Tr5RJxPOJHx7Ye0jk0JEtCvrB0rzZmsaNo/G9VKv39Y0ipqfIxKfWuf0PwL/mBg+rXnhlMqRfwQSf ZyEMf4U96bEnXGkcH0ujotx6Sg/E/2D0IeKvEdwG4i8X+JHXv3sHuc4jDnuqhCPnYHdMUYxrf4bAi QNa+aGrFesOBh4QD21sCJK5+Fmhmzo+mwVJwCsZ0k/FNCL1MP4SOICvZOtXvIx2VDOkLlaMvqVepj JZC/a1WqrNXbXWUfsE5A==; 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 1fnqWs-0002Nw-K3; Thu, 09 Aug 2018 19:23:26 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnqV8-00008D-I8 for linux-arm-kernel@lists.infradead.org; Thu, 09 Aug 2018 19:21:42 +0000 Received: by mail-wr1-x444.google.com with SMTP id h14-v6so6067781wrw.13 for ; Thu, 09 Aug 2018 12:21:31 -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=S2ZNYexMnl0dXyczFbOwM2cIB9NKTYW0Q1a/Gfo1zqQLBrSkBy8fRw+4/WeX2wW0l4 /fij97iT6kzW56tRAnNscYUOzn045D8o3OxHZdWcWmQDk/g61CxZxaSLN+I4Df/aUeIY s+EFI0//+dMpQzAsYmyQrRYXun70flmc9ov1hd/5NBi7p6Iy9krx2k6vb4dnUY4Faxwq KKPW1lhxDRGrYWBlEUGtEsasV76X9NxjOVpLzuESBWtMjkTkN3Z2HbOjIoF8uJoUmVtZ W0CVT1oi+okoKoKxDXNMI3LEOV4Iv7tbSzh+xhii91DF9sH+RMbO+vMfysn/fGRVOLa4 PVaQ== X-Gm-Message-State: AOUpUlFfH7Qf52nPScppcrRcsduOU5gADUlmv1ME67XeRrkykwvL1kNG pWz/Wqvxqf5X1lejoC2rzDJe4Q== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180809_122138_916779_0993D325 X-CRM114-Status: GOOD ( 14.05 ) 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: Vishwath Mohan , Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov 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;