kexec: Clearing registers just before jumping into purgatory

Daniel Kiper daniel.kiper at oracle.com
Mon Oct 14 14:24:15 EDT 2013


On Fri, Oct 11, 2013 at 03:15:38PM -0700, ebiederm at xmission.com wrote:
> Daniel Kiper <daniel.kiper at oracle.com> writes:
>
> > On Fri, Oct 11, 2013 at 03:08:43AM -0700, ebiederm at xmission.com wrote:
> >> Daniel Kiper <daniel.kiper at oracle.com> writes:

[...]

> > What is your opinion in that case?
>
> I can see documenting the registers other than the stack pointer
> as undefined.  (A stack pointer is needed to implement PIC code).
>
> For the implementation I recommend setting these registers to known
> values.  The issue is that your implementation will not change much and
> if you don't set the registers to known values someone may develop a
> dependency on what you happen to have those registers set to.
>
> It is easier to force a fixed value into a register that isn't hard to
> maintain into your registers than to discover when you make a change
> that there is some odd client that depends on some value that just
> happened to be in your register, and that your necessary change is now
> made 10x harder by a client you can't afford to break that depends on a
> bug in the previous implementation.
>
> So yes I strongly recommend setting the registers to a 0 in this case.

Thank you for this explanation. I think that it is worth to add relevant
comment to arch/x86/kernel/relocate_kernel_*.S and purgatory entry.
I will try to prepare something when we work out nice thing for Xen.

Daniel



More information about the kexec mailing list