Red Hat Bugzilla – Bug 151453
vdso should use AMD syscall
Last modified: 2007-11-30 17:11:02 EST
AMD processors have the `syscall' and `sysret' instructions, which are like
Intel's sysenter/sysexit but with fewer problems. Firstly, the upstream kernel
should get changes to support syscall/sysret for AMD processors. Then we will
need to modify these for exec-shield support.
See bug #151452 for related issues with exec-shield (not an issue for upstream).
syscall/sysret only has one of those problems, not both.
First we should try using syscall and not using sysret, which may have a
performance improvement vs using int.
The issue is conflicts with cs segment limits used by exec-shield.
sysret cannot be used when cs segment limits are being used. But, newer
processors have NX support and do not need to use segment limits.
We should conditionalize sysret use on that.
We already do the conditionalisation (is that a word? it is now!) on NX, and
that works fine afaik.
syscall support however is indeed still lacking (at least for ia32). I thought I
read that sysexit also resets segment limits, but I could be misremembering.
The thread on lkml when Linus first did the sysenter support did touch on this
briefly iirc. I'll see if I can dig it out.
sysenter also resets to flat segments, yes. That's why it's disabled when using
segment limits for execute protection (i.e. no NX). The only issue is the extra
entrypoint flavor for syscall on AMD 32-bit. But since we only enable it for NX
(upstream doesn't constrain it, since no exec-shield), I don't think it's worth
bothering. I'm not sure, but I think that maybe all the AMD chips that support
NX also support sysenter (though older AMD chips only support syscall).
Not worth worrying about. Someone upstream might decide to optimize old AMD chips.