Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: correction to compat_sys_kexec_load
       [not found] <4836AC3C.3090005@in.ibm.com>
@ 2008-05-23 20:14 ` Eric W. Biederman
  2008-05-23 21:33   ` Bernhard Walle
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2008-05-23 20:14 UTC (permalink / raw)
  To: Sharyathi Nagesh
  Cc: akpm, mohd.omar, IndhuDurai, maneesh, Kexec Mailing List,
	fastboot, linux-kernel, mohan, sachinp

Sharyathi Nagesh <sharyath@in.ibm.com> writes:

> Hi
>   While testing with kexec tool, I observed some problems. When application
> (kexec) is 32 bit and kernel is 64 bit I observed that loading crash kernel
> works without any issues but unloading crash kernel fails.
> --------------------------------------------------------
> running strace over 'kexec -u -p'
> show the problem to be with sys_kexec_load() call
>
> sys_kexec_load(0, 0, 0, 0x1, 0)         = -1 EINVAL (Invalid argument)
> write(2, "kexec_load (0 segments) failed: "..., 49
> kexec_load (0 segments) failed: Invalid argument
> ) = 4

Yes.  This is a bug.  Although not in the kernel implementation.

> --------------------------------------------------------
>
> This is patch to fix the problem, I think kernel code had a typo where in:
> if((flags & KEXEC_ARCH_MASK) == KEXEC_ARCH) was used instead of
> if((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH)

Nope.  We do the latter check after we have fixed up the arguments
and call sys_kexec_load.  The check really is meant to filter out
KEXEC_ARCH_DEFAULT.


> This patch takes care of that, I have tested the patch it worked fine for
> me. Please review the patch and let me know of your views. This patch is based
> on linux-2.6.26-rc3.

That patch as it exists is actively bad.  It removes the check for a really
nasty gotcha if someone passes in KEXEC_ARCH_DEFAULT in 32bit mode.  Code
expecting a 32bit handoff and getting a 64bit handoff will explode in fun
ways.  You happened to test the one corner case where this does not matter.

What we need to do is fix /sbin/kexec to pass in the correct
architecture of the kernel for unload as it does for load.

Eric

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: correction to compat_sys_kexec_load
  2008-05-23 20:14 ` correction to compat_sys_kexec_load Eric W. Biederman
@ 2008-05-23 21:33   ` Bernhard Walle
  2008-05-24  0:36     ` Eric W. Biederman
  0 siblings, 1 reply; 5+ messages in thread
From: Bernhard Walle @ 2008-05-23 21:33 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: akpm, Sharyathi Nagesh, sachinp, mohd.omar, Kexec Mailing List,
	fastboot, linux-kernel, mohan, IndhuDurai


[-- Attachment #1.1: Type: text/plain, Size: 609 bytes --]

* ebiederm@xmission.com (Eric W. Biederman) [2008-05-23 13:14]:
>
> What we need to do is fix /sbin/kexec to pass in the correct
> architecture of the kernel for unload as it does for load.

How should it know that it unloads a 32 bit kernel on a 64 bit system?
It doesn't have access to the kernel any more once it has been loaded.



	Bernhard

PS: My mail server complains that  maneesh@in.ltcfwd.linux.ibm.com is
invalid because "Recipient address rejected: Domain not found". Maybe
some of the other IBM guys in Cc can take a look at this ... I just
removed that address from Cc for now.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: correction to compat_sys_kexec_load
  2008-05-23 21:33   ` Bernhard Walle
@ 2008-05-24  0:36     ` Eric W. Biederman
  2008-05-26 20:32       ` Bernhard Walle
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2008-05-24  0:36 UTC (permalink / raw)
  To: Bernhard Walle
  Cc: akpm, Sharyathi Nagesh, sachinp, mohd.omar, Kexec Mailing List,
	fastboot, linux-kernel, mohan, IndhuDurai

Bernhard Walle <bwalle@suse.de> writes:

> * ebiederm@xmission.com (Eric W. Biederman) [2008-05-23 13:14]:
>>
>> What we need to do is fix /sbin/kexec to pass in the correct
>> architecture of the kernel for unload as it does for load.
>
> How should it know that it unloads a 32 bit kernel on a 64 bit system?
> It doesn't have access to the kernel any more once it has been loaded.

The architecture parameter is the architecture of the running kernel
that implements sys_kexec_load.

Because it is a pain for testing and in general impossible we don't
change cpu modes during a kexec.  So a 32bit caller of sys_kexec_load
will need to passing in different code if it is running on a 32bit or
a 64bit kernel.

The trampoline code in /sbin/kexec does change modes on x86 when
appropriate.

Caring if you know the architecture in the unload case is a bit
silly. As there is no real justification for it.  At this
point getting user space fixed so that it works on older kernels
seems important. 

Eric

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: correction to compat_sys_kexec_load
  2008-05-24  0:36     ` Eric W. Biederman
@ 2008-05-26 20:32       ` Bernhard Walle
  2008-05-28  4:39         ` Sharyathi Nagesh
  0 siblings, 1 reply; 5+ messages in thread
From: Bernhard Walle @ 2008-05-26 20:32 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: akpm, Sharyathi Nagesh, IndhuDurai, mohd.omar, Kexec Mailing List,
	fastboot, linux-kernel, mohan, sachinp

* ebiederm@xmission.com (Eric W. Biederman) [2008-05-23 17:36]:
>
> As there is no real justification for it.  At this
> point getting user space fixed so that it works on older kernels
> seems important. 

http://article.gmane.org/gmane.linux.kernel.kexec/1534 should fix this.



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: correction to compat_sys_kexec_load
  2008-05-26 20:32       ` Bernhard Walle
@ 2008-05-28  4:39         ` Sharyathi Nagesh
  0 siblings, 0 replies; 5+ messages in thread
From: Sharyathi Nagesh @ 2008-05-28  4:39 UTC (permalink / raw)
  To: Bernhard Walle
  Cc: akpm, mohd.omar, IndhuDurai, fastboot, Kexec Mailing List,
	linux-kernel, mohan, Eric W. Biederman, sachinp

Bernhard/Eric
   Thanks for helping with this. kexec patch has been submitted up stream
Thanks
Yeehaw
Bernhard Walle wrote:
> * ebiederm@xmission.com (Eric W. Biederman) [2008-05-23 17:36]:
>> As there is no real justification for it.  At this
>> point getting user space fixed so that it works on older kernels
>> seems important. 
> 
> http://article.gmane.org/gmane.linux.kernel.kexec/1534 should fix this.
> 
> 


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-28  4:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4836AC3C.3090005@in.ibm.com>
2008-05-23 20:14 ` correction to compat_sys_kexec_load Eric W. Biederman
2008-05-23 21:33   ` Bernhard Walle
2008-05-24  0:36     ` Eric W. Biederman
2008-05-26 20:32       ` Bernhard Walle
2008-05-28  4:39         ` Sharyathi Nagesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox