Jürgen Groß, le mer. 07 févr. 2024 12:43:03 +0100, a ecrit:
> On 07.02.24 12:34, Samuel Thibault wrote:
> > Jürgen Groß, le mer. 07 févr. 2024 12:16:44 +0100, a ecrit:
> > > On 07.02.24 12:00, Samuel Thibault wrote:
> > > > Jürgen Groß, le mer. 07 févr. 2024 11:42:20 +0100, a ecrit:
> > > > > while implementing kexec in Mini-OS.
> > > > 
> > > > Oh, nice :D
> > > > 
> > > > > For that I need it for sure.
> > > > 
> > > > It needs to be done by kexec itself then.
> > > 
> > > That's another option, yes.
> > > 
> > > The question is whether we want to support to be kexec-ed from other
> > > systems, too.
> > 
> > But aren't other systems' kexec supports supposed to do the memset?
> > 
> > They really should.
> 
> I guess there is a reason why the Linux kernel does clear its .bss section
> in early boot. Maybe it is due to how the boot process works (the ELF file
> is encapsulated in vmlinuz),

Yes, the unpack prevents grub etc. from doing it.

> but following your reasoning they should have cleared their .bss while
> unpacking the ELF contents, not while booting the contents.

AIUI the decompressor itself doesn't actually know about ELF.
decompress_kernel() does call handle_relocations(), but it should indeed
clear bss itself and not leave it out to assembly indeed.

> I'm not sure they do the .bss clearing in kexec either,

AIUI they do, see kimage_load_normal_segment() which clears the page
before possibly loading some file piece into it.

Really, this is part of what "loading an ELF" means.

Samuel

Reply via email to