On 09/11/25 at 03:30pm, Bouron, Justinien wrote:
> On 9/11/25, 02:42, "Baoquan He" <b...@redhat.com <mailto:b...@redhat.com>> 
> wrote:
> > Do you mean we will adjust the memsz and buf_align to PAGE_SIZE aligned
> > in kexec_add_buffer()?
> That and mostly the fact that `sanity_check_segment_list()` explicitely 
> rejects
> any segment that either does not start or end on a page boundary:

Ah, yes. I missed this one.

> 
> int sanity_check_segment_list(struct kimage *image)
> {
>     // ...
>     for (i = 0; i < nr_segments; i++) {
>         unsigned long mstart, mend;
> 
>         mstart = image->segment[i].mem;
>         mend   = mstart + image->segment[i].memsz;
>         if (mstart > mend)
>             return -EADDRNOTAVAIL;
>         if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))
>             return -EADDRNOTAVAIL;
>         if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT)
>             return -EADDRNOTAVAIL;
>     }
>     // ...
> }
> 
> > That better be explained in log.
> Does it warrant a second revision to change the log?

I would appreciate it if we can tell the reason a little bit in patch
log. Because we have codes as below where people assign a non PAGE_SIZE
to kbuf.buf_align. With a general conclusion, people need explore code
to find out. At least that's what I do when I check this patch.

arch/x86/kernel/kexec-bzimage64.c:
static void *bzImage64_load(struct kimage *image, char *kernel,
                            unsigned long kernel_len, char *initrd,
                            unsigned long initrd_len, char *cmdline,
                            unsigned long cmdline_len)
{

        ......
                kbuf.buffer = params;
        kbuf.memsz = kbuf.bufsz;
        kbuf.buf_align = 16;
        kbuf.buf_min = MIN_BOOTPARAM_ADDR;
        ret = kexec_add_buffer(&kbuf);
        if (ret)
                goto out_free_params;
        ......
}

Thanks
Baoquan


Reply via email to