[PATCH v5 4/5] kexec: Add option to fall back to KEXEC_LOAD when KEXEC_FILE_LOAD is not supported

Petr Tesarik ptesarik at suse.cz
Tue Mar 27 04:10:28 PDT 2018


On Tue, 27 Mar 2018 13:01:29 +0200
Michal Suchánek <msuchanek at suse.de> wrote:

> On Tue, 27 Mar 2018 18:06:19 +0800
> Dave Young <dyoung at redhat.com> wrote:
> 
> > On 03/26/18 at 07:38pm, Michal Suchánek wrote:  
> > > On Mon, 26 Mar 2018 17:12:10 +0800
> > > Dave Young <dyoung at redhat.com> wrote:
> > >     
> > > > On 03/26/18 at 05:08pm, Dave Young wrote:    
> > > > > On 03/20/18 at 04:56pm, Michal Suchanek wrote:      
> 
> > > > > Hmm, this is still used in latest version.  kernel does not
> > > > > return such error number,  I might not say clearly previously.
> > > > > Please check the kernel code, the only one place I know is
> > > > > because no kdump support in power kexec_file:
> > > > > arch/powerpc/kernel/machine_kexec_file_64.c
> > > > > 
> > > > >         /* We don't support crash kernels yet. */
> > > > >         if (image->type == KEXEC_TYPE_CRASH)
> > > > >                 return -ENOTSUPP;
> > > > > 
> > > > > So I suggest not checking this as well since -ENOTSUPP is not
> > > > > populated in userspace headers, and -ENOTSUP is not used at all.
> > > > > 
> > > > > Also as I mentioned in another reply -EINVAL and -ENOEXEC is
> > > > > also not ncessary.
> > > > > 
> > > > > For -ENOTSUP, maybe someone can submit a patch to switch to
> > > > > -ENOTSUPP so that userspace can check it.
> > > > > Ccing Thiago and Hari for the -ENOTSUPP errno issue.      
> > > > 
> > > > Oops for the hurry reply,  I means -ENOTSUPP might be able to
> > > > replaced with -EOPNOTSUPP, a similar change like this:
> > > > https://patchwork.kernel.org/patch/8490791/    
> > > 
> > > Thanks for catching this. In Linux ENOTSUPP with extra P is
> > > different from EOPNOTSUPP and ENOTSUP (single P). Since we are
> > > talking to the kernel and it returns the double P ENOTSUPP we need
> > > to define it in kexec as well. And we should check ENOTSUP with
> > > single P in case somebody some day thinks that returning undefined
> > > error codes to userspace is not nice like in the patch above.    
> > 
> > I'm not sure if we can define it in kexec-tools since they are used
> > in kernel only..   
> 
> We define the KEXEC_FILE_LOAD syscall numbers so why not ENOTSUPP?

Essentially, because syscall numbers will be added to Linux uapi
sooner or later, but ENOTSUPP is meant to stay kernel-internal. It is
declared in include/linux/errno.h, which says:

 * These should never be seen by user programs. 

In other words, it is already a kernel bug that these error codes can
are currently returned to user space.

Petr T



More information about the kexec mailing list