From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 14EEF1A285 for ; Wed, 28 Jan 2026 02:13:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769566390; cv=pass; b=Xf7ZRJTYKl1pvuz4RQ50rMsE7KQX0/XEY3zbLg4NwBvxa2uP+h8FF2D3ptXEWyGj3roDEYNagAWl+OXJSLe1VTdTUhZcf84Ep+js6M/RaX8Af7cY38grQKVdJVU/yYgvucKOPUhCqdy5p5VQNJmjDFuP948TJtexM1ZRZ3GdXUM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769566390; c=relaxed/simple; bh=b+PxVaps5wbczNBA9T7jqwmsCca3cCEli6KesXx5eek=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=E1LSC0MGcSXPolzRHGoegODMNK7u2kfc0XQ1H+U14gRgCRj9J7W1K2pG0D0cgDtYVTO5Mkk0UMrCFLz18wEDPRBuWO5MrUJ+pyoymiEL8I2YKfLCAkdE4wYPR2hE7SYG43toKBk0NwOX0CdwAot2YpkjBIPsiYL26r2jpG4YjLA= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.beauty; spf=pass smtp.mailfrom=linux.beauty; dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty header.b=U7dlk702; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux.beauty Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.beauty Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty header.b="U7dlk702" ARC-Seal: i=1; a=rsa-sha256; t=1769566370; cv=none; d=zohomail.com; s=zohoarc; b=gTKcDOy6AWWdlCyJZz+FJFNNOopF5QM2AX4Y0yEOU+O3b3HD3TLh9teopUaEru5uPvLK2bN1zdobOQLY0A0FBgUL1F1cr4FKk3xw4YRIBVtVy7emWfiY003evGGCdfq4c0yHwxKsvOjr0k2JVZk11QyNP+X615baUs5MJ8qTb2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769566370; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=eQf/HBwTqp3sbWkLuE4rQUJP+mP0ujQp7ARzpVJXjTI=; b=kleVgLx223w1AhtdsyMoTnsS+e6fUACA2tNMRhKCVIvcDd04E/ywxMySI2NRZ2AZr6xt5UdByXu0EmVK6b3wKsKEke7/+PZLYTTcKkBhHJB42mBS8fG7enbyRv9bj+T0KMUbNPgnpVJUF5NAyFn7SbevNTJNiH3WkiLhiaoqEuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1769566370; s=zmail; d=linux.beauty; i=me@linux.beauty; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=eQf/HBwTqp3sbWkLuE4rQUJP+mP0ujQp7ARzpVJXjTI=; b=U7dlk702vgtiEs6B+F897hswklP4kInVmtXxAEzXzV42QguRUfmMbOCnwYl+0G0G VMKI7rCLIYnRMSTLiDlSllDGhk4C4aoQoKE/fVymVWntuQntwTFTNq8eOEoDDSGnp6K dTnQ9pfqUb0eRfnaqwKLM41ku4wmwpAHqE3nQcng= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 176956636844617.840325763325495; Tue, 27 Jan 2026 18:12:48 -0800 (PST) Date: Wed, 28 Jan 2026 10:12:48 +0800 From: Li Chen To: "Baoquan He" Cc: "Andrew Morton" , "Eric Biggers" , "Steven Chen" , "Alexander Graf" , "Sourabh Jain" , "Philipp Rudo" , "Steven Rostedt" , "Ricardo Ribalda" , "Ross Zwisler" , "kexec" , "linux-kernel" Message-ID: <19c025ff2ae.7eb49b99801794.5565209326129667667@linux.beauty> In-Reply-To: References: <20260120124005.148381-1-me@linux.beauty> Subject: Re: [PATCH] kexec: derive purgatory entry from symbol Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Hi Baoquan, > Hi Li Chen, >=20 > On 01/20/26 at 08:40pm, Li Chen wrote: > > kexec_load_purgatory() derives image->start by locating e_entry inside= an > > SHF_EXECINSTR section. If the purgatory object contains multiple execu= table > > sections with overlapping sh_addr, the entrypoint check can match more= than > > once and trigger a WARN. > >=20 > > Derive the entry section from the purgatory_start symbol when present = and > > compute image->start from its final placement. Keep the existing e_ent= ry > > fallback for purgatories that do not expose the symbol. > >=20 > > WARNING: kernel/kexec_file.c:1009 at kexec_load_purgatory+0x395/0x3c0,= CPU#10: kexec/1784 > > Call Trace: > > > > bzImage64_load+0x133/0xa00 > > __do_sys_kexec_file_load+0x2b3/0x5c0 > > do_syscall_64+0x81/0x610 > > entry_SYSCALL_64_after_hwframe+0x76/0x7e > >=20 > > Fixes: 8652d44f466a ("kexec: support purgatories with .text.hot sectio= ns") > > Signed-off-by: Li Chen >=20 > Thanks for fixing the issue. Could you tell how we can trigger this > issue so that I can reproduce it? >=20 > > --- > > kernel/kexec_file.c | 24 ++++++++++++++++++++++-- > > 1 file changed, 22 insertions(+), 2 deletions(-) > >=20 > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > > index 3f1d6c4e8ff2..d3c68c6b4bbc 100644 > > --- a/kernel/kexec_file.c > > +++ b/kernel/kexec_file.c > > @@ -880,6 +880,8 @@ static int kexec_calculate_store_digests(struct ki= mage *image) > > } > > =20 > > #ifdef CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY > > +static const Elf_Sym * kexec_purgatory_find_symbol(struct purgatory_i= nfo *pi, > > + const char *name); >=20 > Here, is it better to move the whole function body of > kexec_purgatory_find_symbol() here so that kexec_purgatory_setup_sechdrs= () > can see it too? >=20 > Other than the concerns about how to reproducing and above one, this > patch looks good to me. Thanks for the review. For reference, I observed this WARN on x86_64 with linux-next tag next-20260106 and the savedefconfig included below. Toolchain was GCC 15.2.1 and binutils 2.45.1. The WARN is triggered in the kexec_file_load path (kexec -s -l), during purgatory load/relocation. No kexec -e is required. command I used: sudo kexec -s -l /boot/vmlinuz-$(uname -r) \ --initrd=3D/boot/initramfs-$(uname -r).img \ --append=3D"$(cat /proc/cmdline | sed -E \"s/(^| )BOOT_IMAGE=3D[^ ]+//g= \")" Regarding kexec_purgatory_find_symbol(), agreed; I will move the helper body above kexec_purgatory_setup_sechdrs() in v2 to avoid the forward declaration. kernel config: https://gist.github.com/FirstLoveLife/b0e7c7da7146f1ba63167b76cb10683a Regards, Li=E2=80=8B