On 3/20/18, 17:47, "Andy Lutomirski" <l...@kernel.org> wrote:
>    If I've understood all your emails right, when you looked at existing
>    ptrace users, you found that all of them that write to gs and/or
>    gs_base do it as part of a putregs call that writes them at the same
>    time.  If so, then your patch does exactly the same thing that my old
>    patches did, but your patch is much more complicated.  So why did you
>    add all that complexity?

What is tried to be provided is backward compatibility by emulating 
“mov gs (fs) …” when index is only changed and preserve a (given) base value 
in other cases. If ptracer changes GS index between PTRACE_GETREGS 
and PTRACE_SETREG, the tracee does not have GS base from GDT/LDT 
when it resumes, with the patch [1]. Task’s GS base is preserved at 
schedule-in, 
when FSGSBASE enabled.

Code-wise, no clean implementation was found from the existing putreg(). 
putreg() goes in an independently isolated way, while the backward 
compatibility needs something to put one from the other value. 
I would like to know a better way without introducing putregs() (and 
reversely setting them).

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?h=x86/fsgsbase&id=cfaf9911b88930ca6e4d0173fe8a58d2ea4ee6fb

Reply via email to