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: 10671011 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 A727915E9 for ; Tue, 6 Nov 2018 17:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 924C52ABF1 for ; Tue, 6 Nov 2018 17:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 903E32ABFB; Tue, 6 Nov 2018 17:32:19 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL 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 3B6642ABF1 for ; Tue, 6 Nov 2018 17:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389800AbeKGC5U (ORCPT ); Tue, 6 Nov 2018 21:57:20 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50649 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389797AbeKGC5R (ORCPT ); Tue, 6 Nov 2018 21:57:17 -0500 Received: by mail-wm1-f65.google.com with SMTP id 124-v6so6923497wmw.0 for ; Tue, 06 Nov 2018 09:31:02 -0800 (PST) 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-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=gQItUgY2gYwGKzTfMCUdpYoluo1ZEefUN3xekUmwX5I=; b=AZUpKa0KvJzvic/XLq0MUGjVf8aCN2FcudqKVBKiSp846fP/afMABY0w7rUY82lZQr 1UAMP0U/53ZzvYpg5A43f1vWYPtgxo72zUL6Vi6W51GI/9PNR8AlagXKaHYKVDyY3YsS YF/JYAgQJagxjgLheHn5AfYodI8d7UEXlJ3bgpNqZ1XnL5D1rn7I3mRjH59HoePrHTeM tDOjI2NLy+jZXpuV0TAhL4X5FwrmzIJ0JcMSYWN2edMAH0MAASvYbL7a35PlUy9RZPv2 7hQ5/A5yO8J153RhoGwX1BUFrP41vGgjdKmwORURuz8CoLxpc1H1A8IpTXmKwS4bO1Dd 8s7g== X-Gm-Message-State: AGRZ1gIMcEMe4OdzYPe1BrZcoB019L5GAVqV62G/3XdMz1hIveLSinMU 69oEVNqtprSzUakBN07o5AXmfw== 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 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 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;