x86/entry: Entry/exception code rework, preparatory patches
Status from this message: The following commit has been merged into the locking/kcsan branch of tip:
Get series with b4
b4 am [email protected]Versions newest first
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/36 | rcu: Add comments marking transitions between RCU watching and notkernel/ | +25 | 0 replies | |
| 2/36 | x86/hw_breakpoint: Prevent data breakpoints on cpu_entry_areaarch/ | +25 | 5 replies | |
| 3/36 | sched: Clean up scheduler_ipi()kernel/ kernel/ kernel/ | +36 | 10 replies | |
| 4/36 | sched: Make scheduler_ipi inlineinclude/ kernel/ | +9 | 1 reply | |
| 5/36 | x86/entry: Flip _TIF_SIGPENDING and _TIF_NOTIFY_RESUME handlingarch/ | +4 | 15 replies | |
| 6/36 | compiler: Simple READ/WRITE_ONCE() implementationsinclude/ | +8 | 4 replies | |
| 7/36 | locking/atomics: Flip fallbacks and instrumentationarch/ arch/ arch/ +25 more | +2403 | 3 replies | |
| 8/36 | x86/doublefault: Remove memmove() callarch/ | +6 | 1 reply | |
| 9/36 | x86/entry/64: Avoid pointless code when CONTEXT_TRACKING=narch/ | +2 | 0 replies | |
| 10/36 | x86/entry: Remove the unused LOCKDEP_SYSEXIT cruftarch/ arch/ | +0 | 1 reply | |
| 11/36 | x86/kvm: Handle async page faults directly through do_page_fault()arch/ arch/ arch/ +5 more | +57 | 2 replies | |
| 12/36 | x86/kvm: Sanitize kvm_async_pf_task_wait()arch/ arch/ arch/ | +144 | 5 replies | |
| 13/36 | x86/kvm: Restrict ASYNC_PF to user spacearch/ | +7 | 2 replies | |
| 14/36 | x86/entry: Get rid of ist_begin/end_non_atomic()arch/ arch/ arch/ | +4 | 6 replies | |
| 15/36 | kprobes: Lock kprobe_mutex while showing kprobe_blacklistkernel/ | +7 | 1 reply | |
| 16/36 | kprobes: Support __kprobes blacklist in modulesinclude/ kernel/ kernel/ | +50 | 1 reply | |
| 17/36 | kprobes: Support NOKPROBE_SYMBOL() in modulesinclude/ kernel/ kernel/ | +22 | 1 reply | |
| 18/36 | samples/kprobes: Add __kprobes and NOKPROBE_SYMBOL() for handlers.samples/ samples/ | +6 | 1 reply | |
| 19/36 | x86/entry: Exclude low level entry code from sanitizingarch/ | +8 | 4 replies | |
| 20/36 | vmlinux.lds.h: Create section for protection against instrumentationinclude/ include/ include/ +2 more | +29 | 3 replies | |
| 21/36 | kprobes: Prevent probes in .noinstr.text sectioninclude/ kernel/ kernel/ | +23 | 1 reply | |
| 22/36 | tracing: Provide lockdep less trace_hardirqs_on/off() variantsinclude/ kernel/ | +41 | 2 replies | |
| 23/36 | bug: Annotate WARN/BUG/stackfail as noinstr safearch/ include/ kernel/ | +13 | 1 reply | |
| 24/36 | lockdep: Prepare for noinstr sectionsinclude/ include/ kernel/ +2 more | +59 | 2 replies | |
| 25/36 | rcu/tree: Mark the idle relevant functions noinstrkernel/ kernel/ kernel/ | +52 | 8 replies | |
| 26/36 | printk: Prepare for nested printk_nmi_enter()kernel/ kernel/ | +7 | 0 replies | |
| 27/36 | arm64: Prepare arch_nmi_enter() for recursionarch/ | +59 | 6 replies | |
| 28/36 | hardirq/nmi: Allow nested nmi_enter()arch/ arch/ arch/ +2 more | +16 | 0 replies | |
| 29/36 | x86/mce: Send #MC singal from task workarch/ include/ | +37 | 12 replies | |
| 30/36 | lockdep: Always inline lockdep_{off,on}()include/ kernel/ | +21 | 1 reply | |
| 31/36 | printk: Disallow instrumenting print_nmi_enter()kernel/ | +3 | 0 replies | |
| 32/36 | sh/ftrace: Move arch_ftrace_nmi_{enter,exit} into nmi exceptionDocumentation/ arch/ arch/ +2 more | +12 | 1 reply | |
| 33/36 | x86,tracing: Robustify ftrace_nmi_enter()arch/ arch/ include/ +2 more | +8 | 1 reply | |
| 34/36 | sched,rcu,tracing: Avoid tracing before in_nmi() is correctinclude/ | +11 | 0 replies | |
| 35/36 | x86: Replace ist_enter() with nmi_enter()arch/ arch/ arch/ +2 more | +24 | 5 replies | |
| 36/36 | rcu: Make RCU IRQ enter/exit functions rely on in_nmi()kernel/ | +15 | 2 replies |
Reviews trailers per patch
26 of 36 patches have a Reviewed-by or Acked-by.
| Patch | Alexandre Chartre | Frederic Weisbecker | Andy Lutomirski | Steven Rostedt (VMware) | Marc Zyngier | Will Deacon | Mark Rutland | Paul E. McKenney | Paolo Bonzini | Borislav Petkov | Masami Hiramatsu | Lai Jiangshan | Joel Fernandes (Google) | Peter Zijlstra (Intel) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1/36 | ||||||||||||||
| 2/36 | R-b | R-b | R-b | |||||||||||
| 3/36 | R-b | |||||||||||||
| 4/36 | R-b | |||||||||||||
| 5/36 | R-b | |||||||||||||
| 6/36 | R-b | |||||||||||||
| 7/36 | A-b | |||||||||||||
| 8/36 | R-b | A-b | ||||||||||||
| 9/36 | R-b | A-b | A-b | |||||||||||
| 10/36 | R-b | |||||||||||||
| 11/36 | R-b | A-b | ||||||||||||
| 12/36 | R-b | A-b | ||||||||||||
| 13/36 | R-b | A-b | ||||||||||||
| 14/36 | R-b | |||||||||||||
| 15/36 | R-b | |||||||||||||
| 16/36 | R-b | |||||||||||||
| 17/36 | R-b | |||||||||||||
| 18/36 | R-b | |||||||||||||
| 19/36 | R-b | |||||||||||||
| 20/36 | ||||||||||||||
| 21/36 | A-b | |||||||||||||
| 22/36 | ||||||||||||||
| 23/36 | ||||||||||||||
| 24/36 | ||||||||||||||
| 25/36 | A-b | R-b | A-b | |||||||||||
| 26/36 | ||||||||||||||
| 27/36 | ||||||||||||||
| 28/36 | A-b | A-b | ||||||||||||
| 29/36 | R-b | R-b | ||||||||||||
| 30/36 | ||||||||||||||
| 31/36 | ||||||||||||||
| 32/36 | A-b | |||||||||||||
| 33/36 | A-b | R-b | ||||||||||||
| 34/36 | R-b | |||||||||||||
| 35/36 | ||||||||||||||
| 36/36 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 14 reviewers.
Cover letter [patch V4 part 1 00/36] x86/entry: Entry/exception code rework, preparatory patches
Folks!
This is the hopefully final version of the rework of the entry and exception code to ensure that instrumentation cannot touch the fragile parts of the hardware induced entry and exception code trainwreck. It further ensures correctness vs. RCU and moves quite some code out of the assembly code into C.
V3 can befound here:
https://lore.kernel.org/r/[email protected]
The protection against instrumentation is based on moving the fragile code parts into a special text section: .noinstr.text which is excluded from any form of instrumentation
The correctness is validated via objtool extensions. The necessary updates to objtool are available here:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git objtool/core
The series has a total of 138 patches and is split into 5 parts. It's based on v5.7-rc3 with the objtool/core and the locking/kcsan branches of the tip tree merged on top. The base tree is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-base
The full series with all parts applied is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v4-part-5
The first part, i.e. this series is available from:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry-v4-part-1
This part contains preparatory patches and fixes of various sorts which have been either developed in course of this project or have been collected from previous versions and related discussions about the whole entry vs. RCU vs. instrumentation correctness problem.
- Prevention of breakpoints in the entry code
- Splitting the scheduler IPI
- Correct ordering of user space exit work
- Cleanup and restriction of the async page fault handling
- Kprobes support for noinstr sections in built-in and modules code
- The introduction of noinstr.text section
- Preparatory work in tracing, lockdep and RCU
- The nmi_enter() consolidation
- Atomic fallback interaction
The largest patch of this series is the atomic fallback rework which is necessary to address the interaction with KCSAN and pending work from Will Deacon in that area. The header file is autogenerated, but actually included in tree because regenerating on every build is too expensive.
The objtool check for the noinstr.text correctness is not yet added to the build machinery and has to be invoked manually for now:
objtool check -fal vmlinux.o
The checking only works for builtin code as objtool cannot do a combined analysis of vmlinux.o and a module.o
Thanks,
tglx
8<----------
Documentation/trace/ftrace-design.rst | 8 arch/arm64/include/asm/atomic.h | 6 arch/arm64/include/asm/hardirq.h | 78 arch/arm64/kernel/sdei.c | 14 arch/arm64/kernel/traps.c | 8 arch/powerpc/kernel/traps.c | 22 arch/sh/Kconfig | 1 arch/sh/kernel/traps.c | 12 arch/x86/entry/Makefile | 8 arch/x86/entry/common.c | 8 arch/x86/entry/entry_32.S | 8 arch/x86/entry/entry_64.S | 6 arch/x86/entry/thunk_64.S | 5 arch/x86/include/asm/atomic.h | 17 arch/x86/include/asm/atomic64_32.h | 9 arch/x86/include/asm/atomic64_64.h | 15 arch/x86/include/asm/bug.h | 3 arch/x86/include/asm/irqflags.h | 24 arch/x86/include/asm/kvm_para.h | 23 arch/x86/include/asm/paravirt.h | 2 arch/x86/include/asm/traps.h | 5 arch/x86/include/asm/x86_init.h | 2 arch/x86/kernel/cpu/mce/core.c | 65 arch/x86/kernel/cpu/mce/p5.c | 5 arch/x86/kernel/cpu/mce/winchip.c | 5 arch/x86/kernel/hw_breakpoint.c | 25 arch/x86/kernel/kvm.c | 158 - arch/x86/kernel/traps.c | 117 - arch/x86/kernel/tsc.c | 4 arch/x86/kernel/x86_init.c | 1 arch/x86/kvm/mmu/mmu.c | 2 arch/x86/mm/fault.c | 19 include/asm-generic/bug.h | 9 include/asm-generic/sections.h | 3 include/asm-generic/vmlinux.lds.h | 4 include/linux/atomic-arch-fallback.h | 2291 +++++++++++++++++++++++++++ include/linux/atomic-fallback.h | 8 include/linux/atomic.h | 11 include/linux/compiler.h | 25 include/linux/compiler_types.h | 4 include/linux/ftrace_irq.h | 15 include/linux/hardirq.h | 18 include/linux/irqflags.h | 6 include/linux/lockdep.h | 23 include/linux/module.h | 8 include/linux/preempt.h | 4 include/linux/sched.h | 17 kernel/kprobes.c | 85 - kernel/locking/lockdep.c | 89 - kernel/module.c | 10 kernel/panic.c | 4 kernel/printk/internal.h | 8 kernel/printk/printk_safe.c | 9 kernel/rcu/tree.c | 139 - kernel/rcu/tree_plugin.h | 4 kernel/rcu/update.c | 7 kernel/sched/core.c | 66 kernel/sched/fair.c | 5 kernel/sched/sched.h | 6 kernel/trace/Kconfig | 10 kernel/trace/trace_clock.c | 3 kernel/trace/trace_hwlat.c | 2 kernel/trace/trace_preemptirq.c | 39 lib/debug_locks.c | 2 samples/kprobes/kprobe_example.c | 6 samples/kprobes/kretprobe_example.c | 2 scripts/atomic/fallbacks/acquire | 4 scripts/atomic/fallbacks/add_negative | 6 scripts/atomic/fallbacks/add_unless | 6 scripts/atomic/fallbacks/andnot | 4 scripts/atomic/fallbacks/dec | 4 scripts/atomic/fallbacks/dec_and_test | 6 scripts/atomic/fallbacks/dec_if_positive | 6 scripts/atomic/fallbacks/dec_unless_positive | 6 scripts/atomic/fallbacks/fence | 4 scripts/atomic/fallbacks/fetch_add_unless | 8 scripts/atomic/fallbacks/inc | 4 scripts/atomic/fallbacks/inc_and_test | 6 scripts/atomic/fallbacks/inc_not_zero | 6 scripts/atomic/fallbacks/inc_unless_negative | 6 scripts/atomic/fallbacks/read_acquire | 2 scripts/atomic/fallbacks/release | 4 scripts/atomic/fallbacks/set_release | 2 scripts/atomic/fallbacks/sub_and_test | 6 scripts/atomic/fallbacks/try_cmpxchg | 4 scripts/atomic/gen-atomic-fallback.sh | 29 scripts/atomic/gen-atomics.sh | 5 scripts/mod/modpost.c | 2 88 files changed, 3146 insertions(+), 611 deletions(-)