From patchwork Fri Apr 19 14:49:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 2465511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 90FC93FD8C for ; Fri, 19 Apr 2013 14:52:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTCfu-0008DE-D5; Fri, 19 Apr 2013 14:52:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTCfr-00082q-Py; Fri, 19 Apr 2013 14:52:27 +0000 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTCfo-00082V-Uw for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2013 14:52:25 +0000 Received: by mail-wi0-f174.google.com with SMTP id m6so942917wiv.1 for ; Fri, 19 Apr 2013 07:52:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=kKpgKa+pgYyYcx5cp5SsW+cfKrACEksrH8SRukTmNTU=; b=fwYJgRFF8YgJsCwxHyTJEFUHo8ZNMfNtyW0j33/d6NVYGWTh60FMCTrbD2i3DQYFok 6sMxWhBxRJ+0vSqnPq0MW6NJcYf9quDx//SvEY4Zqa3MnkcLgZ3VSJcp3lJyI1eWujHD I/tggGwXHjT3N3RDcrqLzwsFGCAAUVxLkyFZJY7IPeCVq2kCa21pTQv0mLb4yliy8NiW vIKx9k4T7wiV0NYi3HBu1bjXP6p/fQYxo4FJaOS+endcD4l1VDEpEsq8Vo7jcThg7U46 kKcoR57Q74sc3lDDLptkh7CAot2li/jYqRrIoNVbCuGppo4b9NpASz+UJeyesPMWp4JU ZBWw== X-Received: by 10.194.57.137 with SMTP id i9mr26467237wjq.18.1366383140537; Fri, 19 Apr 2013 07:52:20 -0700 (PDT) Received: from localhost.localdomain (validation.linaro.org. [88.98.47.97]) by mx.google.com with ESMTPSA id t14sm4100672wib.0.2013.04.19.07.52.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Apr 2013 07:52:19 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM64: mm: Correct show_pte behaviour. Date: Fri, 19 Apr 2013 15:49:31 +0100 Message-Id: <1366382971-12682-1-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQlwzlzvhCvcaNq4oM7V8EAe/ZAMA8cDcuRhHMnWPDl6suK5N6ExL8dRR0Qfk7cTG6Wr8Fnt X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130419_105225_114609_0F127AEA X-CRM114-Status: GOOD ( 10.99 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: catalin.marinas@arm.com, Steve Capper X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org show_pte makes use of the *_none_or_clear_bad style functions. If a pgd, pud or pmd is identified as being bad, it will then be cleared. As show_pte appears to be called from either the user or kernel fault handlers this side effect can lead to unpredictable behaviour; especially as TLB entries are not invalidated. This patch removes the page table sanitisation from show_pte. If a bad pgd, pud or pmd is encountered it is left unmodified. Signed-off-by: Steve Capper --- arch/arm64/mm/fault.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index afadae6..5263817 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -57,16 +57,16 @@ void show_pte(struct mm_struct *mm, unsigned long addr) pmd_t *pmd; pte_t *pte; - if (pgd_none_or_clear_bad(pgd)) + if (pgd_none(*pgd) || pgd_bad(*pgd)) break; pud = pud_offset(pgd, addr); - if (pud_none_or_clear_bad(pud)) + if (pud_none(*pud) || pud_bad(*pud)) break; pmd = pmd_offset(pud, addr); printk(", *pmd=%016llx", pmd_val(*pmd)); - if (pmd_none_or_clear_bad(pmd)) + if (pmd_none(*pmd) || pmd_bad(*pmd)) break; pte = pte_offset_map(pmd, addr);