x86: Remove anonymous out-of-line fixups
Status from this message: The following commit has been merged into the x86/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest23 patches 18 repliesApplied
- v122 patches 31 repliesSuperseded
Changes in v2 from the cover letter
- Dropped using __cold on labels, because clang. Also gcc doesn't actually generate different code with it. The intent was for the code to end up in .text.cold but that doesn't happen.
- Fixed the vmread constraints to disallow %0 == %1.
- Added a asm-goto-output variant to vmx's vmread implementation.
- Audited Xen and FPU code and converted them from -1 to -EFAULT, as a concequence EX_TYPE_NEG_REG no longer exists.
- Fixed the EX_DATA_*_MASK macros to include an explicit 'int' cast, such that FIELD_GET() will sign-extend the top field.
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/23 | bitfield.h: Fix "type of reg too small for mask" testinclude/ | +18 | 0 replies | |
| 2/23 | x86,mmx_32: Remove .fixup usagearch/ | +30 | 0 replies | |
| 2/23 | x86/mmx_32: Remove X86_USE_3DNOWarch/ arch/ arch/ +8 more | +1 | 1 reply | |
| 3/23 | x86,copy_user_64: Remove .fixup usagearch/ | +11 | 1 reply | |
| 4/23 | x86,copy_mc_64: Remove .fixup usagearch/ | +4 | 1 reply | |
| 5/23 | x86,entry_64: Remove .fixup usagearch/ | +6 | 2 replies | |
| 6/23 | x86,entry_32: Remove .fixup usagearch/ arch/ arch/ | +24 | 0 replies | |
| 7/23 | x86,extable: Extend extable functionalityarch/ arch/ arch/ +4 more | +141 | 0 replies | |
| 8/23 | x86,msr: Remove .fixup usagearch/ arch/ arch/ | +47 | 0 replies | |
| 9/23 | x86,futex: Remove .fixup usagearch/ arch/ | +10 | 0 replies | |
| 10/23 | x86,uaccess: Remove .fixup usagearch/ | +17 | 0 replies | |
| 11/23 | x86,xen: Remove .fixup usagearch/ | +3 | 6 replies | |
| 11/23 | x86,xen: Remove .fixup usagearch/ | +3 | 0 replies | |
| 12/23 | x86,fpu: Remove .fixup usagearch/ arch/ | +2 | 0 replies | |
| 13/23 | x86,segment: Remove .fixup usagearch/ arch/ | +2 | 0 replies | |
| 14/23 | x86,kvm: Remove .fixup usagearch/ arch/ | +5 | 0 replies | |
| 15/23 | x86,vmx: Remove .fixup usagearch/ | +7 | 0 replies | |
| 16/23 | x86,vmx: Provide asm-goto-output vmreadarch/ | +27 | 4 replies | |
| 17/23 | x86,checksum_32: Remove .fixup usagearch/ | +3 | 0 replies | |
| 18/23 | x86,sgx: Remove .fixup usagearch/ arch/ arch/ +1 more | +35 | 0 replies | |
| 19/23 | x86,usercopy_32: Simplify __copy_user_intel_nocache()arch/ | +20 | 0 replies | |
| 20/23 | x86,usercopy: Remove .fixup usagearch/ arch/ arch/ +1 more | +22 | 2 replies | |
| 21/23 | x86,word-at-a-time: Remove .fixup usagearch/ | +47 | 0 replies | |
| 22/23 | x86: Remove .fixup sectionarch/ arch/ | +0 | 0 replies | |
| 23/23 | objtool: Remove .fixup handlingtools/ | +2 | 0 replies |
Reviews trailers per patch
9 of 25 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Paolo Bonzini | Juergen Gross | Josh Poimboeuf | Borislav Petkov | Lai Jiangshan |
|---|---|---|---|---|---|
| Series | R-b | ||||
| 1/23 | |||||
| 2/23 | A-b | ||||
| 2/23 | A-b | ||||
| 3/23 | R-b | ||||
| 4/23 | R-b | ||||
| 5/23 | R-b | R-b | |||
| 6/23 | |||||
| 7/23 | |||||
| 8/23 | |||||
| 9/23 | |||||
| 10/23 | |||||
| 11/23 | R-b | ||||
| 11/23 | R-b | ||||
| 12/23 | |||||
| 13/23 | |||||
| 14/23 | |||||
| 15/23 | R-b | ||||
| 16/23 | R-b | ||||
| 17/23 | |||||
| 18/23 | |||||
| 19/23 | |||||
| 20/23 | |||||
| 21/23 | |||||
| 22/23 | |||||
| 23/23 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.
Cover letter [PATCH v2 00/23] x86: Remove anonymous out-of-line fixups
Hi,
Direct counterpart to the arm64 series from Mark:
https://lkml.kernel.org/r/[email protected]
Since he already put it rather well:
"We recently realised that out-of-line extable fixups cause a number of problems for backtracing (mattering both for developers and for RELIABLE_STACKTRACE and LIVEPATCH). Dmitry spotted a confusing backtrace, which we identified was due to problems with unwinding fixups, as summarized in:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
The gist is that while backtracing through a fixup, the fixup gets symbolized as an offset from the nearest prior symbol (which happens to be __entry_tramp_text_end), and we the backtrace misses the function that was being fixed up (because the fixup handling adjusts the PC, then the fixup does a direct branch back to the original function). We can't reliably map from an arbitrary PC in the fixup text back to the original function.
The way we create fixups is a bit unfortunate: most fixups are generated from common templates, and only differ in register to be poked and the address to branch back to, leading to redundant copies of the same logic that must pollute Since the fixups are all written in assembly, and duplicated for each fixup site, we can only perform very simple fixups, and can't handle any complex triage that we might need for some exceptions (e.g. MTE faults)."
Also available here:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.extable
Changes since v1:
- Dropped using __cold on labels, because clang. Also gcc doesn't actually generate different code with it. The intent was for the code to end up in .text.cold but that doesn't happen.
- Fixed the vmread constraints to disallow %0 == %1.
- Added a asm-goto-output variant to vmx's vmread implementation.
- Audited Xen and FPU code and converted them from -1 to -EFAULT, as a concequence EX_TYPE_NEG_REG no longer exists.
- Fixed the EX_DATA_*_MASK macros to include an explicit 'int' cast, such that FIELD_GET() will sign-extend the top field.
--- arch/x86/entry/entry_32.S | 28 ++----- arch/x86/entry/entry_64.S | 13 ++- arch/x86/entry/vdso/vdso-layout.lds.S | 1 - arch/x86/include/asm/asm.h | 33 ++++++++ arch/x86/include/asm/extable.h | 6 +- arch/x86/include/asm/extable_fixup_types.h | 50 ++++++++++-- arch/x86/include/asm/futex.h | 28 ++----- arch/x86/include/asm/insn-eval.h | 2 + arch/x86/include/asm/msr.h | 26 ++---- arch/x86/include/asm/segment.h | 9 +-- arch/x86/include/asm/sgx.h | 18 +++++ arch/x86/include/asm/uaccess.h | 39 ++++----- arch/x86/include/asm/word-at-a-time.h | 66 ++++++++++----- arch/x86/include/asm/xen/page.h | 14 +--- arch/x86/kernel/cpu/sgx/encls.h | 36 ++------- arch/x86/kernel/fpu/legacy.h | 6 +- arch/x86/kernel/fpu/xstate.h | 6 +- arch/x86/kernel/vmlinux.lds.S | 1 - arch/x86/kvm/emulate.c | 16 +--- arch/x86/kvm/vmx/vmx_ops.h | 43 +++++++--- arch/x86/lib/checksum_32.S | 19 +---- arch/x86/lib/copy_mc_64.S | 12 +-- arch/x86/lib/copy_user_64.S | 32 +++----- arch/x86/lib/insn-eval.c | 66 +++++++++------ arch/x86/lib/mmx_32.c | 86 +++++++------------- arch/x86/lib/usercopy_32.c | 66 ++++++--------- arch/x86/lib/usercopy_64.c | 8 +- arch/x86/mm/extable.c | 124 ++++++++++++++++++++++------- arch/x86/net/bpf_jit_comp.c | 2 +- include/linux/bitfield.h | 19 ++++- tools/objtool/check.c | 8 +- 31 files changed, 477 insertions(+), 406 deletions(-)