Messages in this thread | | | Date | Mon, 27 Jan 2014 14:17:23 -0800 | Subject | Re: [RFC] de-asmify the x86-64 system call slowpath | From | Linus Torvalds <> |
| |
On Mon, Jan 27, 2014 at 2:06 PM, Andy Lutomirski <luto@amacapital.net> wrote: > > It's not just ip and sp -- cs matters here, too, I think.
For signal *delivery*, CS will always be __USER_CS, and %rcx can be crap, so sysret should be fine. We could easily check that %rip is valid in the whole slow-path instead of saying "return 1 if we did do_signal()".
Now, it's a different thing wrt signal handler *return*, because at that point we really cannot return with some random value in %rcx. We absolutely do need to use 'iretq' in that whole [rt_]sigreturn() path, but on x86-64 that is all handled by the system call itself (see the stub_*_sigreturn stuff in entry_64.S) and it very much uses iret explicitly (the 32-bit case also does that, by forcing the sigreturn to be done with an "int 0x80" instruction - we could change that to use syscall+iret, but frankly, I'm not all that inclined to care, although it might be worth trying to do just to unify the models a bit).
Linus
| |