mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MUKESH KUMAR PILANIYA <mpilaniy@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Philipp Rudo <prudo@redhat.com>, Ard Biesheuvel <ardb@kernel.org>,
	Pingfan Liu <atlarge80@qq.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jeremy Linton <jeremy.linton@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Simon Horman <horms@kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Viktor Malik <vmalik@redhat.com>,
	Jan Hendrik Farr <kernel@jfarr.cc>,
	Baoquan He <baoquan.he@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	kexec@lists.infradead.org, bpf@vger.kernel.org,
	systemd-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Dave Young <ruirui.yang@linux.dev>
Subject: Re: [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image
Date: Fri, 4 Dec 2026 16:27:22 +0530	[thread overview]
Message-ID: <C1A88CB3-C096-4E01-8EE4-1403C26EAC04@redhat.com> (raw)
In-Reply-To: <20261020183609.GI3008132@nvidia.com>

Hi Ard,
Hi Jason,

I've been testing and extending your efiloader-kexec branch
(https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=efiloader-kexec)
and I'm preparing crash/kdump support on top of it. Here's where things stand
in case it’s useful.

Your branch's base had drifted behind mainline, so I rebased my local
copy of your commits onto current origin/master (3f963696da44). The three
efi:/efi-libstub prep commits that have since merged dropped out on their
own; the remaining six applied with zero conflicts.

With that in place, I built the branch unmodified (rustc 1.99) and
confirmed all four PE formats load via kexec_file_load(): bare Image,
zboot, UKI, and UKI-with-zboot-inside. Each one ran its real EFI stub and
suspended at ExitBootServices(), as expected.

Along the way I hit a couple of build issues worth flagging. PTE_ADDR_HIGH
was undeclared on 4K + 48-bit PA in kexec_efi.c; I define it (and its
shift) as 0 for <=48-bit PA in pgtable-hwdef.h, and the branch now builds
under both PA_BITS_52 and 4K + PA_BITS_48. RESUME_SCTLR_EL2 also still
referenced ENDIAN_SET_EL2, which mainline removed in eab76a8e1880, so I
dropped it to get things compiling on current mainline.

The kdump work is five commits on top of your series:
https://github.com/mukeshpilaniya/linux/commits/kexec-efi-kdump/

  arm64: kexec_efi: Drop ENDIAN_SET_EL2 from RESUME_SCTLR_EL2
  arm64/mm: Define PTE_ADDR_HIGH for <=48-bit PA configurations
  arm64: kexec_efi: Implement crash (kdump) kernel loading
  arm64: kexec_efi: Support crashkernel=,high and CMA for crash kernels
  arm64: kexec: Enable the EFI loader for crash kernels

The idea is to carve the loader's working region out of crashk_res
instead of alloc_contig_pages, and let a crash-specific EFI memory map
confine the capture kernel to crashk_res — the memmap is the confinement.
elfcorehdr is placed in-region and handed over via the cmdline and DT, and
resume just reuses the existing cpu_soft_restart path at panic. On the
probe side, crash kernels keep preferring the raw Image loader (cheaper,
and it doesn't need EFI), and only fall back to the EFI loader for the
PE-only images (UKI, zboot) that the raw loader turns down.

I've taken this through a full kdump cycle end to end and get a valid
/proc/vmcore for both a bare Image crash kernel (via the raw loader) and a
zboot crash kernel (via the EFI loader).

A few things I haven't verified myself: the DRTM boot-CPU affinity (which
Abhishek has already covered on real hardware), deprivileged execution,
and the taint flag — those are still on my list.

One limitation to note: dm-crypt keys aren't delivered to crash kernels
loaded through the EFI loader, so that path doesn't support encrypted
dumps yet.

Right now this discussion is still hanging off the old eBPF-approach thread;
I think it'd be cleaner to start a fresh thread for the efiloader work so
it's easier to follow. And I'd like to understand how you're planning to
get this series merged, so I can line up the kdump patches to fit in with that.

Thanks for the work on this — it's solving a real gap for UKI/zboot kexec.

Thanks
Mukesh Pilaniya

> On 21 Oct 2026, at 12:06 AM, Jason Gunthorpe <jgg@nvidia.com> wrote:
> 
> On Tue, Oct 20, 2026 at 07:47:19PM +0200, Philipp Rudo wrote:
> 
>> The reason why I and Pingfan abandoned this approach and went for eBPF
>> instead was due to security concerns. Our premise is/was that the EFI
>> stub must not be able to harm the running kernel. Be it intentional or
>> not. That's a guarantee eBPF with its verifier can give but a simple
>> file signature can't.
> 
> This seems too much to me, I think the approach of signature
> verification is sufficient. If you can load a module then you don't
> need to fiddle with some covoluted EFI attack. Distros should include
> their EFI signing key in the kernel keyring so a standard UKI passes
> the test.
> 
> The eBPF approach fails from my perspective because it never actually
> runs the stub code or using the EFI entry point. My interest is to
> actually use the EFI entry point, not just treat it as some convoluted
> zip file.
> 
>> But that still leaves the "unintentional malicious" case. Meaning,
>> that someone tries to be "smart" and does weird stuff in the EFI stub
> 
> Buggy modules exist too, it is up the signer to take a position on
> that, IMHO. How can you have an "out of tree stub" if the only things
> loaded are signed by the kernel builder?
> 
> Regardles, Ard's suggestion to move the execution from a kthread to a
> user thread could provide enough isolation to mititgate even this..
> 
>> Two more comments with my distro head on.
>> 
>> First, kdump is extremely important to us. So the final solution needs
>> to be able to load a crash kernel as well.
> 
> And you want this to be a UKI too?
> 
> I'm not sure it is so good for crash robustness to have so much more
> complexity in the boot path..
> 
> Though I wonder if you can run the EFI flow when initially loading and
> staging the crash kernel? Then stop at the exit boot services and wait
> for a crash before jumping back into the flow.
> 
> Jason
> 


  reply	other threads:[~2026-12-04 10:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-22  1:43 Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 01/13] bpf: Introduce kfuncs to parser buffer content Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 02/13] kexec_file: Use bpf-prog to decompose image Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 03/13] lib/decompress: Keep decompressor when CONFIG_KEEP_DECOMPRESSOR Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 04/13] kexec_file: Implement decompress method for parser Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 05/13] kexec_file: Implement copy " Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 06/13] kexec_file: Chain the stages into a pipeline Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 07/13] kexec_file: Introduce a bpf-prog lskel to run a format parser Pingfan Liu
2026-03-22  1:43 ` [PATCHv7 08/13] kexec_file: Factor out routine to find a symbol in ELF Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-23  7:07   ` kernel test robot
2026-03-23 10:19   ` kernel test robot
2026-03-22  1:43 ` [PATCHv7 09/13] kexec_file: Integrate bpf light skeleton to load image with bpf-prog Pingfan Liu
2026-03-22  2:14   ` bot+bpf-ci
2026-03-22  1:43 ` [PATCHv7 10/13] arm64/kexec: Select KEXEC_BPF to support UEFI-style kernel image Pingfan Liu
2026-03-22  1:44 ` [PATCHv7 11/13] tools/kexec: Introduce a bpf-prog to handle zboot image Pingfan Liu
2026-03-22  2:26   ` bot+bpf-ci
2026-03-22  1:44 ` [PATCHv7 12/13] tools/kexec: Introduce a bpf-prog to handle UKI image Pingfan Liu
2026-03-22  1:44 ` [PATCHv7 13/13] tools/kexec: Introduce a tool to build zboot envelop Pingfan Liu
2026-03-23 19:02 ` [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image Andrew Morton
2026-03-24  7:09   ` Pingfan Liu
2026-10-11 20:13 ` Jason Gunthorpe
2026-10-13 19:19   ` Ard Biesheuvel
2026-10-14  0:02     ` Jason Gunthorpe
2026-10-14  4:39       ` Ard Biesheuvel
2026-10-16 14:41         ` Jason Gunthorpe
2026-10-16 15:56           ` Ard Biesheuvel
2026-10-16 16:29             ` Jason Gunthorpe
2026-10-19  0:38     ` Pingfan Liu
2026-10-20 17:47     ` Philipp Rudo
2026-10-20 18:36       ` Jason Gunthorpe
2026-12-04 10:57         ` MUKESH KUMAR PILANIYA [this message]
2026-12-04 12:35           ` Mukesh Pilaniya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C1A88CB3-C096-4E01-8EE4-1403C26EAC04@redhat.com \
    --to=mpilaniy@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=ardb@kernel.org \
    --cc=ast@kernel.org \
    --cc=atlarge80@qq.com \
    --cc=baoquan.he@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=horms@kernel.org \
    --cc=jeremy.linton@arm.com \
    --cc=jgg@nvidia.com \
    --cc=john.fastabend@gmail.com \
    --cc=kernel@jfarr.cc \
    --cc=kexec@lists.infradead.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@linux.dev \
    --cc=prudo@redhat.com \
    --cc=ruirui.yang@linux.dev \
    --cc=song@kernel.org \
    --cc=systemd-devel@lists.freedesktop.org \
    --cc=vkuznets@redhat.com \
    --cc=vmalik@redhat.com \
    --cc=will@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®