Messages in this thread | | | From | "Bae, Chang Seok" <> | Subject | Re: [PATCH 14/15] x86/fsgsbase/64: Support legacy behavior when FS/GS updated by ptracer | Date | Wed, 21 Mar 2018 15:11:35 +0000 |
| |
On 3/20/18, 17:47, "Andy Lutomirski" <luto@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
| |