#
a89583ca |
| 25-Feb-2023 |
riastradh <riastradh@NetBSD.org> |
x86: Mitigate MXCSR Configuration Dependent Timing in kernel FPU use.
In fpu_kern_enter, make sure all the MXCSR exception status bits are set when we start using the FPU, so that instructions which
x86: Mitigate MXCSR Configuration Dependent Timing in kernel FPU use.
In fpu_kern_enter, make sure all the MXCSR exception status bits are set when we start using the FPU, so that instructions which exhibit MCDT are unaffected by it.
While here, zero all the other FPU registers in fpu_kern_enter.
In principle we could skip this step on future CPUs that fix the MCDT bug, but there's probably not much benefit -- workloads that do a lot of crypto in the kernel are probably better off using kthread_fpu_enter or WQ_FPU to skip the fpu_kern_enter/leave cycles in the first place.
For details, see: https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/mxcsr-configuration-dependent-timing.html
show more ...
|
#
c2ad96ff |
| 26-Jun-2019 |
mgorny <mgorny@NetBSD.org> |
Implement PT_GETXSTATE and PT_SETXSTATE
Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE, that provide access to the extended (and extensible) set of FPU registers on amd64 and i38
Implement PT_GETXSTATE and PT_SETXSTATE
Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE, that provide access to the extended (and extensible) set of FPU registers on amd64 and i386. At the moment, this covers AVX (YMM) and AVX-512 (ZMM, opmask) registers. It can be easily extended to cover further register types without breaking backwards compatibility.
PT_GETXSTATE issues the XSAVE instruction with all kernel-supported extended components enabled. The data is copied into 'struct xstate' (which -- unlike the XSAVE area itself -- has stable format and offsets).
PT_SETXSTATE issues the XRSTOR instruction to restore the register values from user-provided 'struct xstate'. The function replaces only the specific XSAVE components that are listed in 'xs_rfbm' field, making it possible to issue partial updates.
Both syscalls take a 'struct iovec' pointer rather than a direct argument. This requires the caller to explicitly specify the buffer size. As a result, existing code will continue to work correctly when the structure is extended (performing partial reads/updates).
show more ...
|
#
7d804506 |
| 23-May-2018 |
maxv <maxv@NetBSD.org> |
Clean up the FPU headers.
|
#
23966a93 |
| 08-Nov-2017 |
maxv <maxv@NetBSD.org> |
remove vestige
|
#
08499079 |
| 31-Oct-2017 |
maxv <maxv@NetBSD.org> |
Remove outdated comment.
|
#
d3526213 |
| 31-Oct-2017 |
maxv <maxv@NetBSD.org> |
Don't embed our own values in the reserved fields of the XSAVE area, it really is a bad idea. Move them into the PCB.
|
#
5905ff7f |
| 31-Oct-2017 |
maxv <maxv@NetBSD.org> |
Add xsh_xcomp_bv and fx_zero, and use uint8_t instead.
|
#
5fd17e53 |
| 10-Aug-2017 |
maxv <maxv@NetBSD.org> |
Remove the svr4/ibcs2 fpu flags.
|
#
34c4cf73 |
| 18-Aug-2016 |
maxv <maxv@NetBSD.org> |
KNF and simplify.
|
#
3a107b0a |
| 25-Feb-2014 |
dsl <dsl@NetBSD.org> |
Add support for saving the AVX-256 ymm registers during FPU context switches. Add support for the forthcoming AVX-512 registers. Code compiled with -mavx seems to work, but I've not tested context
Add support for saving the AVX-256 ymm registers during FPU context switches. Add support for the forthcoming AVX-512 registers. Code compiled with -mavx seems to work, but I've not tested context switches with live ymm registers. There is a small cost on fork/exec (a larger area is copied/zerod), but I don't think the ymm registers are read/written unless they have been used. The code use XSAVE on all cpus, I'm not brave enough to enable XSAVEOPT.
show more ...
|
#
ae3b84a6 |
| 18-Feb-2014 |
dsl <dsl@NetBSD.org> |
It seems that firefox includes machine/fpu.h on amd64. Add the file back so that the firwfox source doesn't have to depend on the version of netbsd it is being compiled for. (The i386 version doesn't
It seems that firefox includes machine/fpu.h on amd64. Add the file back so that the firwfox source doesn't have to depend on the version of netbsd it is being compiled for. (The i386 version doesn't play the same games in its SIGFPE handler.)
show more ...
|
#
b9df3e93 |
| 15-Feb-2014 |
dsl <dsl@NetBSD.org> |
Remove all references to MDL_USEDFPU and deferred fpu initialisation. The cost of zeroing the save area on exec is minimal. This stops the FP registers of a random process being used the first time
Remove all references to MDL_USEDFPU and deferred fpu initialisation. The cost of zeroing the save area on exec is minimal. This stops the FP registers of a random process being used the first time an lwp uses the fpu. sendsig_siginfo() and get_mcontext() now unconditionally copy the FP registers. I'll remove the double-copy for signal handlers soon. get_mcontext() might have been leaking kernel memory to userspace - and may still do so if i386_use_fxsave is false (short copies).
show more ...
|
#
1a42f747 |
| 13-Feb-2014 |
dsl <dsl@NetBSD.org> |
Check the argument types for the fpu asm functions.
|
#
e405c625 |
| 12-Feb-2014 |
dsl <dsl@NetBSD.org> |
Change i386 to use x86/fpu.c instead of i386/isa/npx.c This changes the trap10 and trap13 code to call directly into fpu.c, removing all the code for T_ARITHTRAP, T_XMM and T_FPUNDA from i386/trap.
Change i386 to use x86/fpu.c instead of i386/isa/npx.c This changes the trap10 and trap13 code to call directly into fpu.c, removing all the code for T_ARITHTRAP, T_XMM and T_FPUNDA from i386/trap.c Not all of the code thate appeared to handle fpu traps was ever called! Most of the changes just replace the include of machine/npx.h with x86/fpu.h (or remove it entirely).
show more ...
|
#
43beae7c |
| 09-Feb-2014 |
dsl <dsl@NetBSD.org> |
Add compatibility for some userspace code (eg firefox) that seems to look inside the ucontext structure passed to signal handlers to modify the xmm registers. This should make the code compile -
Add compatibility for some userspace code (eg firefox) that seems to look inside the ucontext structure passed to signal handlers to modify the xmm registers. This should make the code compile - I'm not at all sure it works as expected, the interactions between FP and signal handlers aren't at all clear. AFAICT the FP state is saved on the user stack when the handler is called, however the FP trap code can already done odd things to the FPU....
show more ...
|
#
36d63726 |
| 08-Feb-2014 |
dsl <dsl@NetBSD.org> |
Add bit defs for more of the x87 status register.
|
#
519a6119 |
| 07-Feb-2014 |
dsl <dsl@NetBSD.org> |
Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu definitions match those of i386. Mostly just structure and field renames, in addition: 1) process_xmm_to_s87() and process_s8
Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu definitions match those of i386. Mostly just structure and field renames, in addition: 1) process_xmm_to_s87() and process_s87_to_xmm() moved into x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code. 2) The linux signal code simplified to use a structure copy for ths fxsave data - it matches the hardware definition and won't change.
show more ...
|
#
27a8f3e1 |
| 07-Feb-2014 |
dsl <dsl@NetBSD.org> |
Move all the hardware register layout for the x86 cpus into a header that can also be used by amd64. Add in skeleton definitions for XSAVE and AVX. Update some comments to match reality.
|