tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Some issues with x86's TLS [amd64: USER_LDT (and wine)]
Le 12/02/2017 à 20:21, Joerg Sonnenberger a écrit :
On Sun, Feb 12, 2017 at 08:07:06PM +0100, Maxime Villard wrote:
I see only two ways of fixing all of that:
- change amd64 so that it saves/restores fsgs like i386.
This is not desirable since it moves the cost from
one-per-context-switch to once-per-return-to-userland.
Yes, indeed, I know it is heavy but that's the only consistent solution I could
think of back then.
That said, for USER_LDT it will likely need a branch in the return-to-userland
code to do a second pass for FS/GS reload for 32bit processes.
Yes, I also thought about something similar - if the lwp is 32bit, restore on
exit and not on context switch. However I (mistakenly) thought there would be no
way to retrieve lwp information in INTRFASTEXIT. In fact there is.
I have written this patch [1] on the fly, without testing it yet. There is a
necessary three-instruction overhead, even on 64bit lwps. Note that a change
is also needed for T_NMI, but the handler is wrong anyway and I intend to switch
back to the original ZTRAP(T_NMI).
[1] http://m00nbsd.net/garbage/ldt/fastexit.diff
Home |
Main Index |
Thread Index |
Old Index