From patchwork Fri May 25 14:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10427667 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 60BE3602D6 for ; Fri, 25 May 2018 14:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EC6C29792 for ; Fri, 25 May 2018 14:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41B17297C0; Fri, 25 May 2018 14:41:14 +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=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFECF29780 for ; Fri, 25 May 2018 14:41:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81B226B0010; Fri, 25 May 2018 10:40:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7CB7D6B0266; Fri, 25 May 2018 10:40:57 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 669AD6B0269; Fri, 25 May 2018 10:40:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 0801A6B0010 for ; Fri, 25 May 2018 10:40:57 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id y82-v6so3558294wmb.5 for ; Fri, 25 May 2018 07:40:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=xBQb5puXQGt1Z2tf+m5VDwwF9OS2pGbcv1u0fNGMhbc=; b=L8vjEaZfZ6VnrlLYCcTzoyr7TsvCHbaWvIztaynFV1qk6eZKK6cPIqVBcIEz+BdPLq g8AusXRgUgcrQ1nwZfEimrjLzdK30DLdxOn+iFhf9T1WilzR72JVIoKzWYiqGBmtvQW4 vawNWNz9fUMgIQ8i8zqONspUSvTrbVDO6LT/mdaH3sVzCS5M65Sn91l3/Vt0pFAlb3Fb RvVEnr3WaPdZzoa8eLyJT6vC5B/A7QiqfhRd1f3KaENFylY/dB40D7k2MgZ6drd+EAru fXblhkWQC8rxE1snjOR9wM7QLCnSuS4mzT2hs+ZslJ6ShxJ91XZNB566zANcCd6BKSZE sXUQ== X-Gm-Message-State: ALKqPwfWi8C6G5fqsbTYpc7xTPPfT1Bg1KEa56vKMAfbXRf3GDt6O7vr ntZ5XI2iZzIbVCfwqtgdhnqmUYUOLDCTUAf0Vzhb6g5d0YAUzvdggYmTDV8VrJgYtNrgtBtv6O6 RbfBP17B0Bk1fEHsmt79byE/qmDnnKeugQs0KEvPI66VEsCZ7lESsVjE5wFIqfvdg1ZDlWBnFiA 0x8ml9KhCW8eSVP7w4mtY3TJmABWJzGzL5uLGCiwX1NaQYAVZy7C6drmjrmWecm/3UGGFHE8azf M//gPLG/5qs6w2yevtrewcAoUX3Xix+OvsykJiPJVHTPPJTzneYdFwgYrGAIjorled2kCDQ1e43 km+wAnNjSJ6GBgjn1AlpQuO9GFmH/zNfmnH9sPYW84O48zOl1h+PDztgQrsekxX75EI37SetZCr w X-Received: by 2002:a1c:355:: with SMTP id 82-v6mr1792673wmd.96.1527259256572; Fri, 25 May 2018 07:40:56 -0700 (PDT) X-Received: by 2002:a1c:355:: with SMTP id 82-v6mr1792649wmd.96.1527259255956; Fri, 25 May 2018 07:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527259255; cv=none; d=google.com; s=arc-20160816; b=Az3Nq2/ItWYPnnMhmBUzPPx1bh+7xa1pjJoFaZKpgVfCKYUKgRrt8JyrBCy1aE4KhQ f8dM7X8l05m5BT5K1aBxEvuJDaYATJtfpoJF/fFrGSevNjLLO8ycWr6Ua9fPHibKyhWn QoFe/h4APS8S97VhUYtq2k+gYMXZQZh3+E9mBblxjBudSNKLtDE6oDExQ1mrjTlsqm1v C36Or4cGebNzaPUcG35BHA7fznn1xCUfDyFxBNExpD5NwRt/rRyv2AGGZfYcBQPzyq7r gBEaGjxL1YH1X/LIGGC1TYzBbOuqKuRad+TAOM5oT4yyU3L3pRmXoGQZnV7N34AMGnKr ZyiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=xBQb5puXQGt1Z2tf+m5VDwwF9OS2pGbcv1u0fNGMhbc=; b=iVFcEakEr34WHVaiWQgrkwo0pBrZQe4v83MeBkcUmHYFjdjx8BupgQWengX9lnTyus Y7Td0euJbGGpfhT1/EUBH7HpsmJZEy6Y2K3k9bQ7Njga6Co99JEUMonNkOVMh6nyfqk5 Cn/cwpZLrFOxPlHzHMe4yOJt/5s0/YrKQ+/duTRjFEUBEccscfiklQ8kNHSv2wjrZTWe naJ5MDLqNRPcJRMWaaWHjYI3RD0JPRYyKQExY0A3FswU2QvFxEwsGIgxTKzeL3fbQmSa 8Fa+llJvjyvInGFhiWEBN7TW1/7MFZcKToIG/Ny4QOq3bBmENjwttv5Ops4R+gZqd0EF ibCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qD+ldOKt; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id x65-v6sor2391881wme.80.2018.05.25.07.40.55 for (Google Transport Security); Fri, 25 May 2018 07:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qD+ldOKt; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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=xBQb5puXQGt1Z2tf+m5VDwwF9OS2pGbcv1u0fNGMhbc=; b=qD+ldOKtEZfIo0jBjn9zjB+GuALJvTTBvUmZ1wxxAeIk5i/sm8wVRIMcpvdq95cRcv ewcLfUku+jsNgdv39SkedFBvkSzzagD8iNbPnR+Smo9JxQE4EUV7Q39KrFugvU4EM2iK nAai0S1HmYrZ4i9QYH5YNKF5ZeBVPu2/nyw1QrQ21sTzmpd4X5EUTWyVtCAYl40Zvmm1 1NpZAvDIe7ZDWkov7YoHevBHl/HItfp4vwX4ydZTzVZYBRxEKgFDD6zFm0JREucCEbCT h/LF2Rjyu4un5aby0uILh/iwff5lJcqWRyBqUXRI1nhQVysVG2GU5NUFCu55JxRQaagE DDgw== X-Google-Smtp-Source: AB8JxZrJgGGrGNFnQVRTXc32hWr+SGiQDL1m2fKCWP1ZaVNKPvy43rtv4keWLB1A1nHWEtBNZzQy4w== X-Received: by 2002:a1c:b943:: with SMTP id j64-v6mr1834114wmf.30.1527259253741; Fri, 25 May 2018 07:40:53 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id q2-v6sm25293885wrm.26.2018.05.25.07.40.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 07:40:52 -0700 (PDT) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Jonathan Corbet , Catalin Marinas , Will Deacon , Christopher Li , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Masahiro Yamada , Michal Marek , Andrey Konovalov , Mark Rutland , Nick Desaulniers , Yury Norov , Marc Zyngier , Kristina Martsenko , Suzuki K Poulose , Punit Agrawal , Dave Martin , Ard Biesheuvel , James Morse , Michael Weiser , Julien Thierry , Tyler Baicar , "Eric W . Biederman" , Thomas Gleixner , Ingo Molnar , Kees Cook , Sandipan Das , David Woodhouse , Paul Lawrence , Herbert Xu , Josh Poimboeuf , Geert Uytterhoeven , Tom Lendacky , Arnd Bergmann , Dan Williams , Michal Hocko , Jan Kara , Ross Zwisler , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Matthew Wilcox , "Kirill A . Shutemov" , Souptick Joarder , Hugh Dickins , Davidlohr Bueso , Greg Kroah-Hartman , Philippe Ombredanne , Kate Stewart , Laura Abbott , Boris Brezillon , Vlastimil Babka , Pintu Agarwal , Doug Berger , Anshuman Khandual , Mike Rapoport , Mel Gorman , Pavel Tatashin , Tetsuo Handa , 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 , Kees Cook , Jann Horn , Mark Brand , Chintan Pandya Subject: [PATCH v2 07/16] khwasan, arm64: fix up fault handling logic Date: Fri, 25 May 2018 16:40:23 +0200 Message-Id: <2957573e73c3f9085f480e0bfe27d93088493e28.1527259068.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 4165485e8b6e..e834fe76f5d2 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;