From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A31FE2676CA; Tue, 8 Apr 2025 12:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114810; cv=none; b=G6IVEnryegRocvghHi+dzbNU9V4hpODR7rSVUrC6jPsVnE5tD464GtWgqFAw4uRXs+wmKybVHnICBfi5HK58RXhIhfN8lLAZMCYveHY+s071w2HhUnEttM3ml5cA/iY7GzKb0CX2rHTpXNAs3xvkS4OGVDXfiod91xtoM33tSKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744114810; c=relaxed/simple; bh=uh06CNG3xEpK/bEeMCloaNGhRAyAGlcW0xPiFJK3ARI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZppbvEgAdowYIVVUcWoIi7kvMjS19PzAXSR4EG7t51LDPOcuc6HOC8xo0LKaKC6G5rcG6dc/GoiPTNALaAA06DF2hnfCYp7AQvXaPhJqe3oYbdVl4Ag6oCBV0nvLbSmHYmClluX9Syd4R/7FyW3RV+Dv2JMnvufY6m/8+S538S8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a/1WksAK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="a/1WksAK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00CD4C4CEE5; Tue, 8 Apr 2025 12:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744114810; bh=uh06CNG3xEpK/bEeMCloaNGhRAyAGlcW0xPiFJK3ARI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/1WksAK3/0wQko0Hz1OylFZ6eKIjTNcGdXpMGnWDBZdYZZJlKRQPGtUfqjxYt37i gBlhMFO04EBCCiqyxemPOvPQyLEXviYsG3sAu16hoAc7PBazL1e42VwM2nuw4vCtgf PkqqOv+nYCZN/MMnsJ+JrQjPpo9YNN0w4tsr8TZc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sourabh Jain , Hari Bathini , Baoquan He , Madhavan Srinivasan , Mahesh Salgaonkar , Michael Ellerman , Andrew Morton , Sasha Levin Subject: [PATCH 6.13 242/499] kexec: initialize ELF lowest address to ULONG_MAX Date: Tue, 8 Apr 2025 12:47:34 +0200 Message-ID: <20250408104857.251930307@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104851.256868745@linuxfoundation.org> References: <20250408104851.256868745@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sourabh Jain [ Upstream commit 9986fb5164c8b21f6439cfd45ba36d8cc80c9710 ] Patch series "powerpc/crash: use generic crashkernel reservation", v3. Commit 0ab97169aa05 ("crash_core: add generic function to do reservation") added a generic function to reserve crashkernel memory. So let's use the same function on powerpc and remove the architecture-specific code that essentially does the same thing. The generic crashkernel reservation also provides a way to split the crashkernel reservation into high and low memory reservations, which can be enabled for powerpc in the future. Additionally move powerpc to use generic APIs to locate memory hole for kexec segments while loading kdump kernel. This patch (of 7): kexec_elf_load() loads an ELF executable and sets the address of the lowest PT_LOAD section to the address held by the lowest_load_addr function argument. To determine the lowest PT_LOAD address, a local variable lowest_addr (type unsigned long) is initialized to UINT_MAX. After loading each PT_LOAD, its address is compared to lowest_addr. If a loaded PT_LOAD address is lower, lowest_addr is updated. However, setting lowest_addr to UINT_MAX won't work when the kernel image is loaded above 4G, as the returned lowest PT_LOAD address would be invalid. This is resolved by initializing lowest_addr to ULONG_MAX instead. This issue was discovered while implementing crashkernel high/low reservation on the PowerPC architecture. Link: https://lkml.kernel.org/r/20250131113830.925179-1-sourabhjain@linux.ibm.com Link: https://lkml.kernel.org/r/20250131113830.925179-2-sourabhjain@linux.ibm.com Fixes: a0458284f062 ("powerpc: Add support code for kexec_file_load()") Signed-off-by: Sourabh Jain Acked-by: Hari Bathini Acked-by: Baoquan He Cc: Madhavan Srinivasan Cc: Mahesh Salgaonkar Cc: Michael Ellerman Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- kernel/kexec_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kexec_elf.c b/kernel/kexec_elf.c index d3689632e8b90..3a5c25b2adc94 100644 --- a/kernel/kexec_elf.c +++ b/kernel/kexec_elf.c @@ -390,7 +390,7 @@ int kexec_elf_load(struct kimage *image, struct elfhdr *ehdr, struct kexec_buf *kbuf, unsigned long *lowest_load_addr) { - unsigned long lowest_addr = UINT_MAX; + unsigned long lowest_addr = ULONG_MAX; int ret; size_t i; -- 2.39.5