Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5121075imm; Tue, 26 Jun 2018 06:17:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe+zKm5EWIt4ddfCD4ZKFUEWeha6oZgts3omSs0cxcPDmXGedbU6asyQKyKPNhp9Bt8rJvX X-Received: by 2002:a62:9513:: with SMTP id p19-v6mr1520076pfd.239.1530019075694; Tue, 26 Jun 2018 06:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530019075; cv=none; d=google.com; s=arc-20160816; b=k0rwHd8DeYn2C2SU+L1vdixX9RbGlTc2c0GPFvaZXOm4TGfT5dhsv4twa1Lllmrv84 6iShBO8hBAMNKHvRQBnJI1YSoLsMZCBWPhpZJ0y6PX4FS5a8XFf1p/vrecL67j2IwjaG QsrABOB0Z+cfHhIeWaNfMWaRKk0DmaER8M4ZV8DC/oAgVg4RrxaJkNGD+W0q/xj6Go0o LxVyKPK60231erUMRdJ8cE5wpZYhHO/VOZAKKvA3Y9WCFMENVmgcAkTcfOMq0fbLim7U kZBbiNh3oX1MizvmrPT0cFQVvIMAzYC6/npDul8lgtVZUtQ++qOfr520RLzO+c63v9x/ 18YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=HVZ6yIjTM13mswNjnQk6+zabyo8SS7fb5UklqkhM58w=; b=sNiNv3J4J6XT73VAhZfd+2WYldLia2uEfN5ihtRmxSrIPsb1+k/7cYGT6TD69XtwNi CmTe+Zovp+JqSZqKG+7wBIwF0bnu9RTs6UtVoB7Lc4X9SQz9U09coe+Ygkl3lOkVneFz ArxVJ4fRVxytHtGqOV3ICe/jjRORpEV7nX5z5qLsTqogp6noeA0y/1YAsu/2VCtiVBDo YJndGywwZNqLuMO54Q+pSqkSg3k4WQ30PwsgYuEHXVFUBgJipKKgNmYUo5xMJGRFbpSj XTL4zyX+3cT5ZiRFr+1eoqADu165qspX024NgUto9xGd1M3Urxogs+1MALTAD+1d8hsp KGWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="K0T/BGtT"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si1330491pgt.552.2018.06.26.06.17.25; Tue, 26 Jun 2018 06:17:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="K0T/BGtT"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935553AbeFZNP5 (ORCPT + 99 others); Tue, 26 Jun 2018 09:15:57 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40768 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935483AbeFZNPt (ORCPT ); Tue, 26 Jun 2018 09:15:49 -0400 Received: by mail-wm0-f67.google.com with SMTP id z13-v6so1803534wma.5 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=Wf3UYUFwoN4UCUN6Qhaib/bUHbAxMeR1UaLMgUKgPK6rDn6tUJv3AlZZCuyUgv/VBG GRHWihRBCamY85ZjxpYGSlVc3G1PDMo3zre10kXgIVMSJWicceiPJNMXxWC+c4rvaLf1 qmooCL8OUAqjcxgp1VV7XzN4yBf7ePaHPEe2RHFr0WmvAjNDwejymXkvvq3qy88SxwF5 WMBNM0r72WYjHmWNcli9JJyCXyXzNrJ4e9mrVVqBzl0JN8TRuWodyIoU3lAgm8cJ25JO LQOUtbPtL9TtkvziDQ6dZNOjEBOVH1cBuwoqlCWcE2oGZg4UnHXKB2rxSpfyWdewhMmB 64cQ== X-Gm-Message-State: APt69E3rgGxEZxVFQ8kmntm0OE/hCwdbRBh/LEixu3Su4f96+IWPzNiX fatlXMlQ+WBzFqna/WYEemB0lQ== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.18.0.rc2.346.g013aa6912e-goog