objtool: UACCESS validation v4
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest25 patches 32 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/25 | x86: Make SMAP 64-bit onlyarch/ | +2 | 9 replies | |
| 1/25 | sched/x86: Save [ER]FLAGS on context switcharch/ arch/ arch/ +2 more | +20 | 0 replies | |
| 2/25 | tracing: Improve "if" macro code generationinclude/ | +1 | 18 replies | |
| 3/25 | x86/ia32: Fix ia32_restore_sigcontext AC leakarch/ | +17 | 0 replies | |
| 4/25 | i915,uaccess: Fix redundant CLACdrivers/ | +4 | 0 replies | |
| 5/25 | x86/uaccess: Move copy_user_handle_tail into asmarch/ arch/ arch/ +1 more | +48 | 0 replies | |
| 6/25 | x86/uaccess: Fix up the fixuparch/ | +2 | 0 replies | |
| 7/25 | x86/nospec,objtool: Introduce ANNOTATE_IGNORE_ALTERNATIVEarch/ arch/ arch/ +1 more | +34 | 0 replies | |
| 8/25 | x86/uaccess,xen: Suppress SMAP warningsarch/ | +20 | 0 replies | |
| 9/25 | x86/uaccess: Always inline user_access_begin()arch/ | +1 | 0 replies | |
| 10/25 | x86/uaccess,signal: Fix AC=1 bloatarch/ | +17 | 0 replies | |
| 11/25 | x86/uaccess: Introduce user_access_{save,restore}()arch/ arch/ include/ | +25 | 0 replies | |
| 12/25 | x86/smap: Ditch __stringify()arch/ | +9 | 0 replies | |
| 13/25 | x86/uaccess,kasan: Fix KASAN vs SMAPmm/ mm/ mm/ | +14 | 0 replies | |
| 14/25 | x86/uaccess,ubsan: Fix UBSAN vs SMAPlib/ lib/ | +5 | 0 replies | |
| 15/25 | x86/uaccess,ftrace: Fix ftrace_likely_update() vs SMAPkernel/ | +4 | 0 replies | |
| 16/25 | x86/uaccess,kcov: Disable stack protectorkernel/ | +1 | 0 replies | |
| 17/25 | objtool: Set insn->func for alternativestools/ | +1 | 0 replies | |
| 18/25 | objtool: Handle function aliasestools/ tools/ | +12 | 0 replies | |
| 19/25 | objtool: Rewrite add_ignores()tools/ tools/ | +20 | 0 replies | |
| 20/25 | objtool: Add --backtrace supporttools/ tools/ tools/ +1 more | +25 | 0 replies | |
| 21/25 | objtool: Rewrite alt->skip_origtools/ | +10 | 0 replies | |
| 22/25 | objtool: Fix sibling call detectiontools/ | +55 | 0 replies | |
| 23/25 | objtool: Add UACCESS validationscripts/ tools/ tools/ +7 more | +196 | 2 replies | |
| 24/25 | objtool: uaccess PUSHF/POPF supporttools/ tools/ tools/ +1 more | +31 | 0 replies | |
| 25/25 | objtool: Add Direction Flag validationtools/ tools/ tools/ +1 more | +37 | 0 replies |
Reviews trailers per patch
5 of 26 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Juergen Gross | Andy Lutomirski | Steven Rostedt (VMware) | Josh Poimboeuf |
|---|---|---|---|---|
| Series | A-b | |||
| 1/25 | A-b | |||
| 1/25 | A-b | |||
| 2/25 | A-b A-b | |||
| 3/25 | ||||
| 4/25 | ||||
| 5/25 | ||||
| 6/25 | ||||
| 7/25 | ||||
| 8/25 | R-b | |||
| 9/25 | ||||
| 10/25 | R-b | |||
| 11/25 | ||||
| 12/25 | ||||
| 13/25 | ||||
| 14/25 | ||||
| 15/25 | ||||
| 16/25 | ||||
| 17/25 | ||||
| 18/25 | ||||
| 19/25 | ||||
| 20/25 | ||||
| 21/25 | ||||
| 22/25 | ||||
| 23/25 | ||||
| 24/25 | ||||
| 25/25 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH 00/25] objtool: UACCESS validation v4
Teach objtool to validate the UACCESS (SMAP, PAN) rules which are currently unenforced and (therefore obviously) violated.
UACCESS sections should be small; we want to limit the amount of code that can touch userspace. Furthermore, UACCESS state isn't scheduled, this means that anything that directly calls into the scheduler will result in random code running with UACCESS enabled and possibly getting back into the UACCESS region with UACCESS disabled and causing faults.
Forbid any CALL/RET while UACCESS is enabled; but provide a few exceptions.
This builds x86_64-allmodconfig and lots of x86_64-randconfig clean.
Changes since -v3:
- removed a bunch of functions from the UACCESS-safe list due to the removal of CONFIG_KASAN_EXTRA=y.
- hopefully addressed all the feedback from Josh
- realized objtool doesn't cover x86_32
- some added additional annotations/fixes: kcov, signal
- retains the DF check for now, Linus, do you (still) think it is worth doing that DF check?
--- arch/x86/Kconfig | 2 + arch/x86/ia32/ia32_signal.c | 29 ++- arch/x86/include/asm/alternative-asm.h | 11 + arch/x86/include/asm/alternative.h | 10 + arch/x86/include/asm/asm.h | 24 -- arch/x86/include/asm/nospec-branch.h | 28 +- arch/x86/include/asm/smap.h | 37 ++- arch/x86/include/asm/uaccess.h | 5 +- arch/x86/include/asm/uaccess_64.h | 3 - arch/x86/include/asm/xen/hypercall.h | 24 +- arch/x86/kernel/signal.c | 29 ++- arch/x86/lib/copy_user_64.S | 48 ++++ arch/x86/lib/memcpy_64.S | 3 +- arch/x86/lib/usercopy_64.c | 20 -- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 +- include/linux/compiler.h | 2 +- include/linux/uaccess.h | 2 + kernel/Makefile | 1 + kernel/trace/trace_branch.c | 4 + lib/Makefile | 1 + lib/ubsan.c | 4 + mm/kasan/Makefile | 3 + mm/kasan/common.c | 10 + mm/kasan/report.c | 3 +- scripts/Makefile.build | 3 + tools/objtool/arch.h | 8 +- tools/objtool/arch/x86/decode.c | 21 +- tools/objtool/builtin-check.c | 4 +- tools/objtool/builtin.h | 2 +- tools/objtool/check.c | 400 ++++++++++++++++++++++------- tools/objtool/check.h | 4 +- tools/objtool/elf.c | 15 +- tools/objtool/elf.h | 3 +- tools/objtool/special.c | 18 ++ tools/objtool/special.h | 1 + tools/objtool/warn.h | 8 + 36 files changed, 584 insertions(+), 212 deletions(-)