From patchwork Tue Aug 15 12:50:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 110143 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp5439082obb; Tue, 15 Aug 2017 05:52:35 -0700 (PDT) X-Received: by 10.84.229.8 with SMTP id b8mr30363856plk.93.1502801555522; Tue, 15 Aug 2017 05:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502801555; cv=none; d=google.com; s=arc-20160816; b=Hvz2RBHx0E7rXz+LXGjaEwCnv+nuptQO3UbS+4c5YJD6vxg8XKkUH2721ioV/Iy3Hk fGNCgfcEwiQpcXnaeN6rsXcbEOFMc94r5ikbD+SFUKvO57ndR2xkMwUfmvnkPiTtgGCj FhF5/nbwo8yQ3f7q/yHqr9v0GSw/Na01uDpmRZ9uuprt7VaR57AYPtW8VXCfhc9V9El1 EY3OuKy7oq1BPW6qkaIQ7ntlNuT9bnsEzZzFYaECuuex3O0OQOdHtFK8DHuGDwvYitOK 9fxWFjb1vnmBF7w5PYIIzpVNh+pGneiHKizvIazbYVYxsqDwdEUMFP5WijEIfPXAJAVH 3CVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=J1QoV70zeK2xWn4Y/Ff1f+Pq9wWI5i3bZr/DV9XUGys=; b=EYKdOq2C09eXZAcTbUsc3mAIXgpPwmjc+LSOwLI90yZnFh9EA4hGpzWMmiWGY0mziz 0/wQs9EbpIrOBtjtJlZB6SCeoH/80YqD/5qvrACinuBFAK36YDWfVAL+fLD3bOUkMfVp Q76HkHoPFEMv/1t2ORPNdmaW4K1SPxewr42UHlDV+CcpwmupQcelodnxawO7Hpn1v5zK T3dyLmDOKZIlIbcF58bEOPAoPJ5etXq7ArEQphKA6rD0b28usMh+nAdeYes1WGpv3IrQ VsYXpcsCmeDjfqxLR4DxiCjPZRKKuW8FPrHau2a5dO59h2VQTG/p8rAnQ2bAJJ94Q1Vd u4Qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q73si5508468pfa.255.2017.08.15.05.52.35; Tue, 15 Aug 2017 05:52:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663AbdHOMwc (ORCPT + 25 others); Tue, 15 Aug 2017 08:52:32 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:51390 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632AbdHOMwb (ORCPT ); Tue, 15 Aug 2017 08:52:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF02F13D5; Tue, 15 Aug 2017 05:52:30 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AC1F93F540; Tue, 15 Aug 2017 05:52:28 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: ard.biesheuvel@linaro.org, catalin.marinas@arm.com, james.morse@arm.com, labbott@redhat.com, linux-kernel@vger.kernel.org, luto@amacapital.net, mark.rutland@arm.com, matt@codeblueprint.co.uk, will.deacon@arm.com, kernel-hardening@lists.openwall.com, keescook@chromium.org Subject: [PATCHv2 01/14] arm64: remove __die()'s stack dump Date: Tue, 15 Aug 2017 13:50:36 +0100 Message-Id: <1502801449-29246-2-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502801449-29246-1-git-send-email-mark.rutland@arm.com> References: <1502801449-29246-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Our __die() implementation tries to dump the stack memory, in addition to a backtrace, which is problematic. For contemporary 16K stacks, this can be a lot of data, which can take a long time to dump, and can push other useful context out of the kernel's printk ringbuffer (and/or a user's scrollback buffer on an attached console). Additionally, the code implicitly assumes that the SP is on the task's stack, and tries to dump everything between the SP and the highest task stack address. When the SP points at an IRQ stack (or is corrupted), this makes the kernel attempt to dump vast amounts of VA space. With vmap'd stacks, this may result in erroneous accesses to peripherals. This patch removes the memory dump, leaving us to rely on the backtrace, and other means of dumping stack memory such as kdump. Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: Laura Abbott Cc: James Morse Cc: Will Deacon --- arch/arm64/kernel/traps.c | 2 -- 1 file changed, 2 deletions(-) -- 1.9.1 diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index c2a81bf..9633773 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -237,8 +237,6 @@ static int __die(const char *str, int err, struct pt_regs *regs) end_of_stack(tsk)); if (!user_mode(regs)) { - dump_mem(KERN_EMERG, "Stack: ", regs->sp, - THREAD_SIZE + (unsigned long)task_stack_page(tsk)); dump_backtrace(regs, tsk); dump_instr(KERN_EMERG, regs); }