[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMR6z3hlyR0t9Kip@zn.tnic>
Date: Sat, 12 Jun 2021 11:13:51 +0200
From: Borislav Petkov <bp@...e.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Kan Liang <kan.liang@...ux.intel.com>
Subject: Re: [patch 07/41] x86/fpu: Simplify PTRACE_GETREGS code
On Fri, Jun 11, 2021 at 06:15:30PM +0200, Thomas Gleixner wrote:
> From: Dave Hansen <dave.hansen@...ux.intel.com>
>
> ptrace() has interfaces that let a ptracer inspect a ptracee's register state.
> This includes XSAVE state. The ptrace() ABI includes a hardware-format XSAVE
> buffer for both the SETREGS and GETREGS interfaces.
>
> In the old days, the kernel buffer and the ptrace() ABI buffer were the
> same boring non-compacted format. But, since the advent of supervisor
> states and the compacted format, the kernel buffer has diverged from the
> format presented in the ABI.
>
> This leads to two paths in the kernel:
> 1. Effectively a verbatim copy_to_user() which just copies the kernel buffer
> out to userspace. This is used when the kernel buffer is kept in the
> non-compacted form which means that it shares a format with the ptrace
> ABI.
> 2. A one-state-at-a-time path: copy_xstate_to_kernel(). This is theoretically
> slower since it does a bunch of piecemeal copies.
>
> Remove the verbatim copy case. Speed probably does not matter in this path,
> and the vast majority of new hardware will use the one-state-at-a-time path
> anyway. This ensures greater testing for the "slow" path.
>
> This also makes enabling PKRU in this interface easier since a single path
> can be patched instead of two.
>
> Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> V4: Picked up from Dave's PKRU series
> ---
> arch/x86/kernel/fpu/regset.c | 22 ++--------------------
> arch/x86/kernel/fpu/xstate.c | 6 +++---
> 2 files changed, 5 insertions(+), 23 deletions(-)
Reviewed-by: Borislav Petkov <bp@...e.de>
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
Powered by blists - more mailing lists