From patchwork Fri Dec 7 10:14:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10717845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D24471731 for ; Fri, 7 Dec 2018 10:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC0F82DFD5 for ; Fri, 7 Dec 2018 10:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC0292DFE9; Fri, 7 Dec 2018 10:15:12 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 577DF2DFD5 for ; Fri, 7 Dec 2018 10:15:12 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=28Kuxf9nC+JZWb+Ud/9mNhXCtqyLM8oN0vHijfqgSOE=; b=Uv7d0loiMZFbgL jAVl0J002S5DwUuH7QmDk24p7bQy19gi6xKiRNGc03I1Fu7sk1vqEwZgylxs9dHIN5Jry7+Rft/16 jJGiUVDoOJ/wdDkXJLx3cIddsHh5bDUPumHAjgX9j9z4sJ3EPTk/y5VDs26y+stRU+aySecOnQumd YaSr3q/h0ucuaffiOoSCeFAypUvDZFg0Jf3aNMU6VocY4fc4xzXzsDaXjfWWES+QgOZqqa6NHf+ET FGRj9YOnb2//Yek1JfK39ZHl79H4W+GBjrt1p7BY92e9IEYWseAV7DIMr9EhRRMAv4oTJy8SaXbu7 H27PHiSXg0qmjBYj+VgQ==; 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 1gVDA6-0006uD-DV; Fri, 07 Dec 2018 10:15:10 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVDA1-0005ei-8J; Fri, 07 Dec 2018 10:15:07 +0000 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 CD678EBD; Fri, 7 Dec 2018 02:14:54 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4CC8F3F5AF; Fri, 7 Dec 2018 02:14:51 -0800 (PST) From: James Morse To: linux-arm-kernel@lists.infradead.org Subject: [PATCH arm64/kexec] arm64: kexec_file: forbid kdump via kexec_file_load() Date: Fri, 7 Dec 2018 10:14:39 +0000 Message-Id: <20181207101439.190918-1-james.morse@arm.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181207_021505_306950_1C0F8355 X-CRM114-Status: GOOD ( 11.27 ) 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: devicetree@vger.kernel.org, Herbert Xu , Baoquan He , Ard Biesheuvel , Will Deacon , bhsharma@redhat.com, Frank Rowand , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Heiko Carstens , David Howells , AKASHI Takahiro , Rob Herring , Arnd Bergmann , James Morse , Catalin Marinas , Martin Schwidefsky , prudo@linux.ibm.com, dyoung@redhat.com, David Miller , Vivek Goyal 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 Now that kexec_walk_memblock() can do the crash-kernel placement itself architectures that don't support kdump via kexe_file_load() need to explicitly forbid it. We don't support this on arm64 until the kernel can add the elfcorehdr and usable-memory-range fields to the DT. Without these the crash-kernel overwrites the previous kernel's memory during startup. Add a check to refuse crash image loading. Signed-off-by: James Morse Reviewed-by: Bhupesh Sharma --- Context: http://lore.kernel.org/r/20181206155424.GA4422@arm.com arch/arm64/kernel/kexec_image.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c index 1ad1d5f8f024..07bf740bea91 100644 --- a/arch/arm64/kernel/kexec_image.c +++ b/arch/arm64/kernel/kexec_image.c @@ -47,6 +47,10 @@ static void *image_load(struct kimage *image, struct kexec_segment *kernel_segment; int ret; + /* We don't support crash kernels yet. */ + if (image->type == KEXEC_TYPE_CRASH) + return ERR_PTR(-EOPNOTSUPP); + /* * We require a kernel with an unambiguous Image header. Per * Documentation/booting.txt, this is the case when image_size