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: 10478369 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 8EF8560383 for ; Wed, 20 Jun 2018 17:46:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 787FE28DFB for ; Wed, 20 Jun 2018 17:46:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AFBA28E15; Wed, 20 Jun 2018 17:46:24 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DDE1D28DFB for ; Wed, 20 Jun 2018 17:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FgJzQh/b6+Mo3M3b7UgE6IJiPKoGsy1O6C3az81QNXU=; b=iI7xeNsY71NBc1KPbzJjy0OTxC 025+TkItL1sJodfHc5evUFqebDJBCCuSrusdhvALya8p0v5vIwP/vlzeFuy/Mzkqgu6UmOdH9dT5Q FIOUXyy3/nXmOJ6NfJN0rHaCbEbjCKMq1tup7W1crkRWtVAaSLRvsCJhWhZc/OuP88+qAvwW+9PHJ HqPj6suKDvFC1/12NwcXyP0Abh9vmc2eci+65bxnYm4g4UzOJeLH+Co8ux0QzZh1cgJ+T9r4E0zMT WiwRFKOg8SafiiIn+dXcckbWnKmKr5dLh+7dlQqo1rGXZpJ8wEXBMoQNMCLMwS2MvkuGBRjhmCVQm p1pFjSNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVhBL-0006LL-Ih; Wed, 20 Jun 2018 17:46:11 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVh5u-00025G-NW for linux-arm-kernel@bombadil.infradead.org; Wed, 20 Jun 2018 17:40:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=p85QUjRuow4dpc/B2Caf2sJdJzBwj5MZiQXcRPnXZZs=; b=Bf8scvO+E3A3orgMc5aJO75Vj ndCDt/9qEbI6eLnJKwxJYzzoUZXipPg8Xl7I7ExEup2d9TsBhcRL3sssFzLkPeJh8p2t6koKOKMSC BqFQvqBBKl5VW15rX0uAJRIET3Ypi6LbVa1WrEsqgGgwjkkZW4o5SiD6YUBZthHzUvRW4vbeBNz/y kvjuF8kEdr+3cNyImV+EiDaDFS001qTfQAEw5XvnsuWn5Ilge6dO2MWwhIxVWDE8I9XHGImFgirav NCXhmj88ZfAogH0oMrxM9VouFPgz3mc+A/n0doSOGkAA12ctOOJh1XNxF389jFIxZTnZPefzQ/evc 688SOvYIA==; Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVh5r-0004Ym-MA for linux-arm-kernel@lists.infradead.org; Wed, 20 Jun 2018 17:40:33 +0000 Received: by mail-wm0-x243.google.com with SMTP id v131-v6so1009883wma.1 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=AcG6o/3b0DZJThSXZFxrLbJUfBFDD/2d/hkwK+S+fiSs7FLtd7qiuxYiDqcNQ8dD9O Ni+a7a+pNVjC7bTX7FJe20KGLfkWQaGrg3AiCe78ZSvPYb3WTt4VTVcfvOeyhwpD6M1m CD2eU5DwUSFBXxq4wIYg6axcqmecTTwXFvG5j/MHS2FvGQozMTojV297QvyDXXc75L6i 2yA68/M3fobSZMLqwFPUEWbHsfj/aJi99EmmRJfV2LIU2l6cTdXe++FK2uMMqOPe3gYL kb6TfIR/djH33SImGUqlG529VGJOdQINn7WByNSbh8hkNyofrP5epg+ynYX9xciuOSKi f40g== X-Gm-Message-State: APt69E20RxRahyZ7xOny3KPWgd7ILl9xul9FqIWYLPpOWljTk+fUtSRN 9SXQz5F7h4216Ys1WruGTsrH0Q== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_184031_715990_FB6AB94D X-CRM114-Status: GOOD ( 14.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Andrey Konovalov , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;