From patchwork Tue May 8 17:20:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10386619 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 0793160353 for ; Tue, 8 May 2018 17:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7F5E290B3 for ; Tue, 8 May 2018 17:21:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBD69290B9; Tue, 8 May 2018 17:21: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=-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 5D12F290B3 for ; Tue, 8 May 2018 17:21:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C12FB6B02C8; Tue, 8 May 2018 13:21:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BC4266B02C9; Tue, 8 May 2018 13:21:26 -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 A3FDD6B02CA; Tue, 8 May 2018 13:21:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id 3F1106B02C8 for ; Tue, 8 May 2018 13:21:26 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id 44-v6so22282616wrt.9 for ; Tue, 08 May 2018 10:21:26 -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:in-reply-to:references; bh=ICExutSsxMNmOeqM56Yn6CuSUfLXBAripkLnfwN846o=; b=gqvX/kBPkLa/HlChH5tF1ntZmXUjvO6fe40BK/VdWNq/sMM/A8kmNDllBw4ltier2w ZwqOogH84ayVFLAzVwwqxRhxg8BkPJb50agn44zpgLRnV8d7IEpRiAo9uD5o9ZPF1YCc wvOYurar8zDIOuLv2cRC/4R845KLbB2CRztFD5JAj7Z+jxJoE9sW5G9Rho/+CZRP4pTX sKbinPYtBYm84rL8HmSO8WElzTPJrQeG0BoUReu2uAzDL7+dV2kvJlGGyTp34eH2S8RW CLfAm66YSXQ9Nct/ZjPNHPMrNPPjAsPRllF8RL5YTgr8QRS5nEi47jzYqiISt6ahvfPn Ln4g== X-Gm-Message-State: ALQs6tDRgDGz1a6hrSFKpo2vzqgEMXXzHqN5cZ7RbWiZCa0aK1xp6nJd rOyJVF/TlPtEH9Lt3Vc6+4lU+mWyEi0BszSiPNlD9buj++daikVDR2GZtjbcJwaBwwUGdjljRNq X9C93ooXp8Ah2w7/WtjrAPq6l61yDkGMAnrmvpKEo3BzFm4eJF2jous7AFTd7KIhV24t7MfVvYt Qrn010Gh8Fam5OqioC9o2yBXYkrIh1kSJ2z9MidJoo4oHpcEI3bpYXKWXqQ2C+FVG+J9s2uSUMB BldGGUL96q2Dk3DuZHqDAlWFpawBqxZDEwoe+RgMqBVrwrTBCHHoHGNVeTI/k6y8MfUuEmWLKn8 HAgPj1GE7A//ueRT4AdglLCBxvcFGuYxTShxDApo20NEFODvMFLch716pHkvnyg6xFO6t/sNhN0 4 X-Received: by 2002:adf:e642:: with SMTP id b2-v6mr31497864wrn.172.1525800085842; Tue, 08 May 2018 10:21:25 -0700 (PDT) X-Received: by 2002:adf:e642:: with SMTP id b2-v6mr31497818wrn.172.1525800085190; Tue, 08 May 2018 10:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525800085; cv=none; d=google.com; s=arc-20160816; b=KU2XINRonDuXMmLRZSVQFPUlzehuryZYGX6CQA9smIrO9lIPIUIqCWd296dow/K0NG t8caG4JEX0plXhxjnJOxkmIHZ44NLt6Y6+m2XGRwi/K7e4dqXdW7AB6//vsde/aXEyM2 O6t4rji+SHXBXhGXMFWPix7WJXTXR1i+H2acfvev3SYlhNDuBBPDauI9BoN69Jize8MZ tDE7Lbr+5YK3rwpIOMNy0ocSguc6B1/gGS+rL8pkK6lILvNSrDq1hKkLeKkcHrAUSV4u +KnJtR9Eh7JD/lxUpTzS9EH6qnlWgQWoeOh/DYzgDEdq/dJwEsVI0SakTWp2K3hWz/2Q PRSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ICExutSsxMNmOeqM56Yn6CuSUfLXBAripkLnfwN846o=; b=Na0TDCPC8xtIu2WvXbsbhnfvBxI8OEQK62f7aTwR0f7EQo3Blrif9wSJWKqA07Zpzg A+mCFPgOtJapWYoJNTISogIrLRhuTa/sRC4cI0JRx4PlH7KQERj1zZRd3uK6RE7Wr9TO aH+fTV0AGGU6PyaOOU3QLU3YbEBI7bBltlxRyP3WnaZyeiyf7rAc7gSzXa9GKsB6ERUW QfKicJcdKAj9/PF0G/iNem5/oqb4gPPF4CEp0kV+SgEtqmP2Is4OsSm/YpymMDSbHdqg q6kl7PaCF7Mf79Dd5ZVkdcDissWOEP/BhUXVcjVG1SitTWnuB3hg8Yn9ZX5cDg6sIx/x JKNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=myWlVihh; 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 s59-v6sor11656587wrc.52.2018.05.08.10.21.25 for (Google Transport Security); Tue, 08 May 2018 10:21:25 -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=myWlVihh; 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 :in-reply-to:references; bh=ICExutSsxMNmOeqM56Yn6CuSUfLXBAripkLnfwN846o=; b=myWlVihhPD5rsGfjHLk9cQGCLIah3OYw8n9jZhRPRIYf9kWtiKKw+IKvBMtAX4d4/u 3xJQPPXls0ZM3wslfWlp4cwee30aeFSuW5dWgxxKUMYsYNhpkKLOIfxaWsAMsoq/vyzU qMdY6BrBZV5yzJPF0R6EeDzHEpJK7leKJUgYrlC92IHfXBMIk2d0yAEuj4YNozVEPte5 gU45dvGeYdZKJwnVOMfNMdrNZSAumKSdG/FAvUkdwo1Jn+CvzriwBuTYm12XXrx/6CdA IfjH0z4gPoqekPihltLyzklOfFCEhmNKOL6oJqAbq/VjodqbyXTJF01p8OKR8ObluZMo OBXw== X-Google-Smtp-Source: AB8JxZrvQ4RihxXsnVSNXvLckZjD5lH9GUaNW656fTUhjAji7v3XOkQKmJJQ9ikwECUJ0+h6f157zA== X-Received: by 2002:adf:c6c1:: with SMTP id c1-v6mr33440139wrh.236.1525800084439; Tue, 08 May 2018 10:21:24 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id m134sm14178311wmg.4.2018.05.08.10.21.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 10:21:23 -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 v1 07/16] khwasan, arm64: fix up fault handling logic Date: Tue, 8 May 2018 19:20:53 +0200 Message-Id: X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: References: 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;