[uml-devel] [PATCH 3/3] um: fix ptrace PTRACE_GETFPREGS and PTRACE_SETFPREG support

2016-03-06 Thread Eli Cooper
-off-by: Eli Cooper --- arch/x86/um/ptrace_32.c | 4 ++-- arch/x86/um/ptrace_64.c | 14 ++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c index 47c78d5..2eeaf2c 100644 --- a/arch/x86/um/ptrace_32.c +++ b/arch/x86/um

[uml-devel] [PATCH 2/3] um: add extended processor state save/restore support

2016-03-06 Thread Eli Cooper
are unavailable, it falls back to the old PTRACE_GETFPREGS and PTRACE_SETFPREGS methods, which have been renamed to save_i387_registers() and restore_i387_registers(). Signed-off-by: Eli Cooper --- arch/um/include/shared/registers.h| 2 ++ arch/um/kernel/process.c | 2 +- arch

[uml-devel] [PATCH 0/3] um: Add support for extended processor state

2016-03-06 Thread Eli Cooper
This series adds support for the extended processor state (XSTATE) for x86_64 UML, especially the YMM registers used by AVX/AVX2 instructions. Modern userspace programs built with AVX can now run inside x86_64 UML without YMM registers getting corrupted. Eli Cooper (3): um: extend _fpstate to

[uml-devel] [PATCH 1/3] um: extend _fpstate to _xstate

2016-03-06 Thread Eli Cooper
Extends _fpstate to _xstate, in order to hold AVX/YMM registers. Due to increased frame size, compilers might emit some warnings. Signed-off-by: Eli Cooper --- arch/x86/um/signal.c | 26 +- arch/x86/um/user-offsets.c | 2 +- 2 files changed, 14 insertions(+), 14

Re: [uml-devel] [PATCH 1/3] um: extend _fpstate to _xstate

2016-03-11 Thread Eli Cooper
Hi Richard, On 2016/3/10 4:44, Richard Weinberger wrote: > Hmm, this needs rework. Having everything on the stack is not good. Okay, I'll rework the functions whose stack size is greater than the warning threshold by using kmalloc. > Can you also create a selftest such that this bug cannot happe

Re: [uml-devel] [PATCH 1/3] um: extend _fpstate to _xstate

2016-03-13 Thread Eli Cooper
Hi Richard, On 2016/3/13 15:58, Richard Weinberger wrote: > Eli, > > Am 12.03.2016 um 08:08 schrieb Eli Cooper: >> > Hi Richard, >> > >> > On 2016/3/10 4:44, Richard Weinberger wrote: >>> >> Hmm, this needs rework. Having everything on the

[uml-devel] [PATCH] um: fix FPU register double-restore after sigreturn

2016-03-15 Thread Eli Cooper
This patch prevents userspace() from incorrectly restoring FPU registers after a sigreturn or rt_sigreturn system call, which has already restored FPU registers to the state prior to the signal handler was invoked. Fixes FPU state corruption after invoking the signal handler. Signed-off-by: Eli

[uml-devel] [PATCH v2 1/3] um: extend _fpstate to _xstate

2016-03-16 Thread Eli Cooper
Extends _fpstate to _xstate, in order to hold AVX/YMM registers. To avoid oversized stack frame, the following functions has been refactored by using (k)malloc. - copy_sc_to_user - copy_sc_from_user - sig_handler_common - timer_real_alarm_handler Signed-off-by: Eli Cooper --- arch/um/os

[uml-devel] [PATCH v2 3/3] um: fix ptrace PTRACE_GETFPREGS and PTRACE_SETFPREG support

2016-03-16 Thread Eli Cooper
-off-by: Eli Cooper --- arch/x86/um/ptrace_32.c | 5 +++-- arch/x86/um/ptrace_64.c | 16 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c index 47c78d5..ebd4dd6 100644 --- a/arch/x86/um/ptrace_32.c +++ b/arch/x86/um

[uml-devel] [PATCH v2 2/3] um: add extended processor state save/restore support

2016-03-16 Thread Eli Cooper
are unavailable, it falls back to the old PTRACE_GETFPREGS and PTRACE_SETFPREGS methods, which have been renamed to save_i387_registers() and restore_i387_registers(). Signed-off-by: Eli Cooper --- arch/um/include/shared/registers.h| 2 ++ arch/um/kernel/process.c | 2 +- arch

[uml-devel] [PATCH v2 0/3] um: Add support for extended processor state

2016-03-16 Thread Eli Cooper
results (e.g., calculating SHA256 in OpenSSL). Changes since v1: - Refactor functions with oversized stack frame - Add a tiny selftest program to the cover letter Eli Cooper (3): um: extend _fpstate to _xstate um: add extended processor state save/restore support um: fix ptrace

Re: [uml-devel] [PATCH] um: fix FPU register double-restore after sigreturn

2016-03-19 Thread Eli Cooper
Hi Richard, On 2016/3/18 6:21, Richard Weinberger wrote: > Where exactly are the FPU regs restored in the sigregturn case? > Not sure if I fully understand the error scenario. Well, sys_sigreturn() or sys_rt_sigreturn() calls copy_sc_from_user(), and the latter copies fpstate, which is the saved

[uml-devel] [PATCH v3 1/3] um: fix FPU state preservation around signal handlers

2016-03-19 Thread Eli Cooper
This patch makes UML saves/restores FPU state from/to the fpstate in pt_regs when setting up or returning from a signal stack, rather than calling ptrace directly. This ensures that FPU state is correctly preserved around signal handlers in a multi-threaded scenario. Signed-off-by: Eli Cooper

[uml-devel] [PATCH v3 0/3] um: fix and extend FPU support

2016-03-19 Thread Eli Cooper
v1: - Refactor functions with oversized stack frame - Add a tiny selftest program to the cover letter Eli Cooper (3): um: fix FPU state preservation around signal handlers um: extend fpstate to _xstate to support YMM registers um: add extended processor state save/restore support arch/um

[uml-devel] [PATCH v3 2/3] um: extend fpstate to _xstate to support YMM registers

2016-03-19 Thread Eli Cooper
Extends fpstate to _xstate, in order to hold AVX/YMM registers. To avoid oversized stack frame, the following functions have been refactored by using malloc. - sig_handler_common - timer_real_alarm_handler Signed-off-by: Eli Cooper --- arch/um/os-Linux/signal.c | 28

[uml-devel] [PATCH v3 3/3] um: add extended processor state save/restore support

2016-03-19 Thread Eli Cooper
(thus independent from HOST_FP_SIZE), and by calling save_i387_registers() and restore_i387_registers() instead of the extended save_fp_registers() and restore_fp_registers() functions. Signed-off-by: Eli Cooper --- arch/um/include/shared/registers.h| 2 ++ arch/um/kernel/process.c

Re: [uml-devel] [PATCH] um: fix FPU register double-restore after sigreturn

2016-03-20 Thread Eli Cooper
Hi Richard, On 2016/3/18 16:20, Richard Weinberger wrote: > I wonder how other architectures handle this case? > Ideally I'd like to avoid as much extra code as possible in userspace(). Please forgive my ignorance of other architectures. But to the best of my knowledge, FPU state is not saved and

Re: [uml-devel] [PATCH v3 0/3] um: fix and extend FPU support

2016-05-20 Thread Eli Cooper
On 2016/4/5 5:42, Richard Weinberger wrote: > Sorry for my late response. > I'll put this now into -next and give it some testing. Ping? It has been some time but I don't see this in -next yet. -- Mobile security can be