[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <E9221EFA-636C-4D36-AEBA-3A1EEBBF2F50@intel.com>
Date: Wed, 21 Mar 2018 15:11:35 +0000
From: "Bae, Chang Seok" <chang.seok.bae@...el.com>
To: Andy Lutomirski <luto@...nel.org>
CC: X86 ML <x86@...nel.org>, Andi Kleen <ak@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Metzger, Markus T" <markus.t.metzger@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/15] x86/fsgsbase/64: Support legacy behavior when
FS/GS updated by ptracer
On 3/20/18, 17:47, "Andy Lutomirski" <luto@...nel.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
Powered by blists - more mailing lists