linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/22] x86: Remove anonymous out-of-line fixups
@ 2021-11-05 17:10 Peter Zijlstra
  2021-11-05 17:10 ` [PATCH 01/22] bitfield.h: Fix "type of reg too small for mask" test Peter Zijlstra
                   ` (21 more replies)
  0 siblings, 22 replies; 54+ messages in thread
From: Peter Zijlstra @ 2021-11-05 17:10 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, peterz, jpoimboe, mark.rutland, dvyukov, seanjc,
	pbonzini, mbenes

Hi,

Direct counterpart to the arm64 series from Mark:

  https://lkml.kernel.org/r/20211019160219.5202-1-mark.rutland@arm.com

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/20210927171812.GB9201@C02TD0UTHF1T.local/

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)."


This time things have been build tested for both i386 and x86_64
(defconfig,allyesconfig) and boot tested x86_64 and even started a guest inside
of that.

Also available here:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/wip.extable

Changes since RFC:

 - rebase to origin/master
 - Fixup missing mmx prefetch and use 3DNOWPREFETCH feature
 - renamed POP_SEG to POP_ZERO, changed size, added comment
 - added found to extable_type_reg voodoo
 - used insn-eval.c copy of pt_regs indexing
 - renamed exception_table_entry::type to ::data
 - renamed macro magic
 - removed ltype from __get_user_asm()
 - dropped ftrace patch
 - simpler kvm patch
 - rewrote all of load_unaligned_zeropad()
 - removed .fixup from objtool

---
 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 |  46 +++++++++--
 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      |  67 +++++++++++-----
 arch/x86/include/asm/xen/page.h            |  12 +--
 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                 |  14 ++--
 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, 445 insertions(+), 404 deletions(-)


^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2021-11-25  8:20 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 17:10 [PATCH 00/22] x86: Remove anonymous out-of-line fixups Peter Zijlstra
2021-11-05 17:10 ` [PATCH 01/22] bitfield.h: Fix "type of reg too small for mask" test Peter Zijlstra
2021-11-05 17:10 ` [PATCH 02/22] x86,mmx_32: Remove .fixup usage Peter Zijlstra
2021-11-05 17:10 ` [PATCH 03/22] x86,copy_user_64: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 04/22] x86,copy_mc_64: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 05/22] x86,entry_64: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 06/22] x86,entry_32: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 07/22] x86,extable: Extend extable functionality Peter Zijlstra
2021-11-05 17:10 ` [PATCH 08/22] x86,msr: Remove .fixup usage Peter Zijlstra
2021-11-05 17:10 ` [PATCH 09/22] x86,futex: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 10/22] x86,uaccess: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 11/22] x86,xen: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 12/22] x86,fpu: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 13/22] x86,segment: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 14/22] x86,vmx: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 15/22] x86,checksum_32: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 16/22] x86,sgx: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 17/22] x86,kvm: " Peter Zijlstra
2021-11-05 17:10 ` [PATCH 18/22] x86,usercopy_32: Simplify __copy_user_intel_nocache() Peter Zijlstra
2021-11-05 17:10 ` [PATCH 19/22] x86,usercopy: Remove .fixup usage Peter Zijlstra
2021-11-05 17:10 ` [PATCH 20/22] x86,word-at-a-time: " Peter Zijlstra
2021-11-05 18:01   ` Josh Poimboeuf
2021-11-05 18:07     ` Peter Zijlstra
2021-11-08 16:47   ` Josh Poimboeuf
2021-11-08 18:29     ` Peter Zijlstra
2021-11-08 18:53       ` Nick Desaulniers
2021-11-09  8:23         ` Peter Zijlstra
2021-11-09 19:22           ` Nick Desaulniers
2021-11-09 20:59             ` Bill Wendling
2021-11-09 21:21               ` Peter Zijlstra
2021-11-09 21:25                 ` Nick Desaulniers
2021-11-09 22:11                   ` Peter Zijlstra
2021-11-09 22:15                     ` Nick Desaulniers
2021-11-09 21:07             ` Peter Zijlstra
2021-11-10 10:18               ` Peter Zijlstra
2021-11-10 10:46               ` David Laight
2021-11-10 11:09                 ` Peter Zijlstra
2021-11-10 12:20                   ` David Laight
2021-11-12  1:50                     ` Josh Poimboeuf
2021-11-12  9:33                       ` Peter Zijlstra
2021-11-13  5:35                         ` Josh Poimboeuf
2021-11-15 12:36                           ` Miroslav Benes
2021-11-15 13:01                             ` Joe Lawrence
2021-11-15 23:40                               ` Josh Poimboeuf
2021-11-16  7:25                                 ` Miroslav Benes
2021-11-15 12:59                           ` Miroslav Benes
2021-11-16 21:27                             ` Josh Poimboeuf
2021-11-18  7:15                               ` Miroslav Benes
2021-11-22 17:46                       ` Petr Mladek
2021-11-24 17:42                         ` Josh Poimboeuf
2021-11-25  8:18                           ` Petr Mladek
2021-11-10 12:14               ` Segher Boessenkool
2021-11-05 17:10 ` [PATCH 21/22] x86: Remove .fixup section Peter Zijlstra
2021-11-05 17:10 ` [PATCH 22/22] objtool: Remove .fixup handling Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).