From patchwork Wed Jun 20 17:39: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: 10478391 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 0261F601D7 for ; Wed, 20 Jun 2018 17:47:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4DC028DFB for ; Wed, 20 Jun 2018 17:47:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D977D28E15; Wed, 20 Jun 2018 17:47:08 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 82A1328DFB for ; Wed, 20 Jun 2018 17:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754624AbeFTRqy (ORCPT ); Wed, 20 Jun 2018 13:46:54 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38643 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754601AbeFTRkT (ORCPT ); Wed, 20 Jun 2018 13:40:19 -0400 Received: by mail-wm0-f68.google.com with SMTP id 69-v6so986036wmf.3 for ; Wed, 20 Jun 2018 10:40:19 -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=p85QUjRuow4dpc/B2Caf2sJdJzBwj5MZiQXcRPnXZZs=; b=cKMog7X2WPJDh2SetkEA2LzVcfeVlPSabg492BhqyjJtuk+uD7mTbXUGHMgXgkX0+z nce3cY4HpUrBw2dF+w26cohuQ4LNOVcnNXjygWthLCk5admFeUUoeT0ZzaFLe4N4HFjx fKpPqS151IMpsM7atSDyWsyMpcCrNy9NQlI2dNd4Du2t4dOjlcjw00mWxwEZWwpfndjG 3EWMUA95vJDt0+oxJwNAjTg5w4uOiJKAvYJnJZM0head/QBtWLMSQ9Z84Hk09NAOo4YB lU0wq9CXKzi00S9pI0LIKDVfcUUf8vgBMRQOCs7XSLki1DUDDpXZ2akjY+iCFrfUVKk/ 6VyQ== 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=p85QUjRuow4dpc/B2Caf2sJdJzBwj5MZiQXcRPnXZZs=; b=tEhP4vgJQ7aQ43tA/DZgtJC4xjbmjNjfnBYVko7SwRp1nqY2OVqtXRwDNjh+a4kW6f phlPw/n0tFcA2SLGc4scu3fVOJjxbsPc7LtLK673nlAP2ceKhSnE6UgKU1hT5Rm+CJ9z FbXmOhlZJitjpTHV8eTKXWwvnmddevFcKpfgMZZCoVz7mqU7tHEyUOmQtu9yV2eXN9cW Mrwnsrng431mtkBHZPWids6wXNEFhrr5U+E5SVdb5iHSjkRY4bBMvm3lftnTH3UZoIxU sykRljK3UwOBHu8gl++E0eTLcaWMOj1QQ3FI0L8OcZpOsWTEdqW0jyT0ii0fQu3ojD+z IfCQ== X-Gm-Message-State: APt69E2PNgzYuG89H94CA5l0dtvHHkeu+erVBniLI83TD4jElIMN0nVa 12jtHOOXkRwd68EUmvYBjtjQtA== X-Google-Smtp-Source: ADUXVKI9lnsolI1QB0qhbD0NkTANy1JGmjbguTtaYpBwlZAz0SNSWmijMIO+Jx4xdTEuQeLjLXl71Q== X-Received: by 2002:a1c:4adb:: with SMTP id n88-v6mr2543982wmi.121.1529516418195; Wed, 20 Jun 2018 10:40:18 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id f18-v6sm4388598wro.1.2018.06.20.10.40.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:40:17 -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 v3 07/17] khwasan, arm64: fix up fault handling logic Date: Wed, 20 Jun 2018 19:39:53 +0200 Message-Id: <719e17667dcf93c2789c2b6c873aa424cfe378b9.1529515183.git.andreyknvl@google.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: References: 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 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;