[PATCH 3/5] arm64: change the prototype of image probe function

Pingfan Liu piliu at redhat.com
Fri May 5 20:14:11 PDT 2023


On Fri, May 5, 2023 at 11:42 PM Simon Horman <horms at kernel.org> wrote:
>
> On Fri, May 05, 2023 at 10:54:35AM +0800, Pingfan Liu wrote:
> > Changing the aarch64 probe's prototype  from
> >       typedef int (probe_t)(const char *kernel_buf, off_t kernel_size);
> > to
> >       typedef int (probe_t)(const char *kernel_buf, off_t kernel_size, struct kexec_info *info);
> >
> > Later, info can be used to return both the file descriptor and parsed kernel
> > buffer. The fd is passed to sys_kexec_file_load, and the parsed kernel
> > buffer is used by image's load function.
> >
> > Signed-off-by: Pingfan Liu <piliu at redhat.com>
>
> Hi Pingfan,
>
> I am seeing a build failure on ARM (32bit).
>
>   138 | int zImage_arm_probe(const char *UNUSED(buf), off_t UNUSED(len))
>       |     ^~~~~~~~~~~~~~~~
> In file included from ../../kexec/arch/arm/kexec-zImage-arm.c:21:
> ../../kexec/arch/arm/kexec-arm.h:12:5: note: previous declaration of ‘zImage_arm_probe’ was here
>    12 | int zImage_arm_probe(const char *buf, off_t len, struct kexec_info *info);
>       |     ^~~~~~~~~~~~~~~~
> make[1]: *** [Makefile:124: kexec/arch/arm/kexec-zImage-arm.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make[1]: Leaving directory '/home/runner/work/kexec-tools/kexec-tools/kexec-tools-2.0.26.git/_build/sub'
> make: *** [Makefile:276: distcheck] Error 2
> Error: Process completed with exit code 2.
>

Oops. I just tested on x86_64 and aarch64, and did not detect this bug.

> Link: https://github.com/horms/kexec-tools/actions/runs/4895124719/jobs/8740272103
>
> ...
>
> > diff --git a/kexec/kexec.h b/kexec/kexec.h
> > index 0d820ad..6e8430e 100644
> > --- a/kexec/kexec.h
> > +++ b/kexec/kexec.h
> > @@ -191,7 +191,13 @@ unsigned long locate_hole(struct kexec_info *info,
> >       unsigned long hole_min, unsigned long hole_max,
> >       int hole_end);
> >
> > +#ifndef __aarch64__
> >  typedef int (probe_t)(const char *kernel_buf, off_t kernel_size);
> > +#else
> > +typedef int (probe_t)(const char *kern_fname, off_t kernel_size,
> > +     struct kexec_info *info);
> > +#endif
> > +
>
> This seems kind of unfortunate.
> Could we update the prototype for all architectures?
>

I will have a try with coccinelle.

Thanks for your help.

Regards,

    Pingfan




More information about the kexec mailing list