Linus Torvalds writes: (Summary)
I think we actually leave the user-space percpu segment in %gs (or the
stack canary base), so that one we should actually save/restore, but
I'm getting the feeling that we should just reset the other segment
registers to known values on 32-bit.
registers to known values on 32-bit.
Also, why does the 32-bit code do
Also, why does the 32-bit code do
loadsegment(es, ctxt->es);
loadsegment(es, ctxt->es);
but the 64-bit code does
but the 64-bit code does
asm volatile ("movw %0, %%es" :: "r" (ctxt->es)); It has been written as some kind of "save and restore registers", but that's not what it really then does - or what it should do.
then does - or what it should do.
It should make sure to restore a sane kernel state, not some random register state.
register state.
And the 32-bit and 64-bit code really should strive to be at least _sanely_ different, not this randomly and insanely different mess.
registers to known values on 32-bit.
Also, why does the 32-bit code do
Also, why does the 32-bit code do
loadsegment(es, ctxt->es);
loadsegment(es, ctxt->es);
but the 64-bit code does
but the 64-bit code does
asm volatile ("movw %0, %%es" :: "r" (ctxt->es)); It has been written as some kind of "save and restore registers", but that's not what it really then does - or what it should do.
then does - or what it should do.
It should make sure to restore a sane kernel state, not some random register state.
register state.
And the 32-bit and 64-bit code really should strive to be at least _sanely_ different, not this randomly and insanely different mess.