Re: [Fastboot] [CFT] kexec syscall for 2.5.43 (linux booting linux)

Eric W. Biederman
2002-10-23T02:19:16Z

erich@uruk.org writes:

> ebiederm@xmission.com (Eric W. Biederman) wrote:
>
> > In the process of setting up hooks, I have run across a very interesting
> > data point. If I load %ds, %es, %ss in my hook the problem goes away.
> > But I must load all 3.
> >
> > Given that the code sequence that is executed if my hook is not run is:
> >
> > cld
> > cli
> > movl $(__KERNEL_DS),%eax
> > movl %eax,%ds
> > movl %eax,%es
> > movl %eax,%fs
> > movl %eax,%gs
> >
> > lss stack_start,%esp
> >
> > I am rather confused. I am not changing the gdt or anything like that so it
> > appears I may have found a way to tickle a processor errata.
>
> I kind of doubt you found an errata...

Me too but the number of remaining possibilities is quite small.

> the mode switch combinations in most
> of the modern x86-variants has been tested pretty exhaustively because
> people use so many variations on it.
>
> Let's see:
>
> %ds and %es are implicit operands for the source and destination of a
> MOVS operation, so if you or the Linux kernel performs a MOVS copy
> before that point, that is likely the problem there.

Nope. In fact on a another 2.4.17 kernel built with slightly different
options the code works.

> The requirement of %ss is a bit more puzzling, but are you 100% sure
> you don't reference the stack anywhere? Else it may blow up.

Absolutely.

> For example, the start sequence calls "cli", but do you have interrupts
> disabled before that point? Maybe you have a stray interrupt catching
> you there...

Yep. In fact last I checked I had interrupts disabled at the interrupt
controller as well, but that may not be a certaintly. But it doesn't matter
as I also have nmi disabled at that point.

> I had to deal with these problems, and had exactly something like the
> last case, in my early work on the GRUB bootloader.

I will certainly take any help people can give. But I am tickling some
very weird things in there.

Eric