Skip to content

objtool: UACCESS validation v3

Peter Zijlstra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest20 patches 76 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20x86/ia32: Fix ia32_restore_sigcontext AC leakarch/x86/ia32/ia32_signal.c+17 -120 replies
2/20i915,uaccess: Fix redundant CLACdrivers/gpu/drm/i915/i915_gem_execbuffer.c+4 -20 replies
3/20x86/uaccess: Move copy_user_handle_tail into asmarch/x86/include/asm/asm.h arch/x86/include/asm/uaccess_64.h arch/x86/lib/copy_user_64.S +1 more+48 -474 replies
4/20x86/uaccess: Fix up the fixuparch/x86/lib/memcpy_64.S+2 -10 replies
5/20x86/uaccess/xen: Suppress SMAP warningsarch/x86/include/asm/xen/hypercall.h+22 -48 replies
6/20x86/uaccess: Always inline user_access_begin()arch/x86/include/asm/uaccess.h+1 -10 replies
7/20x86/uaccess: Always inline force_valid_ss()arch/x86/kernel/signal.c+1 -14 replies
8/20x86/uaccess: Introduce user_access_{save,restore}()arch/x86/include/asm/smap.h arch/x86/include/asm/uaccess.h include/linux/uaccess.h+25 -00 replies
9/20x86/uaccess,kasan: Fix KASAN vs SMAPmm/kasan/Makefile mm/kasan/common.c mm/kasan/report.c+14 -20 replies
10/20x86/uaccess,ubsan: Fix UBSAN vs SMAPlib/Makefile lib/ubsan.c+5 -00 replies
11/20x86/uaccess,ftrace: Fix ftrace_likely_update() vs SMAPkernel/trace/trace_branch.c+4 -00 replies
12/20objtool: Set insn->func for alternativestools/objtool/check.c+1 -02 replies
13/20objtool: Hande function aliasestools/objtool/elf.c tools/objtool/elf.h+12 -53 replies
14/20objtool: Rewrite add_ignores()tools/objtool/check.c tools/objtool/check.h+20 -321 reply
15/20objtool: Add --backtrace supporttools/objtool/builtin-check.c tools/objtool/builtin.h tools/objtool/check.c +1 more+25 -61 reply
16/20objtool: Rewrite alt->skip_origtools/objtool/check.c+10 -63 replies
17/20objtool: Fix sibling call detectiontools/objtool/check.c+46 -331 reply
18/20objtool: Add UACCESS validationscripts/Makefile.build tools/objtool/arch.h tools/objtool/arch/x86/decode.c +6 more+188 -1522 replies
19/20objtool: uaccess PUSHF/POPF supporttools/objtool/arch.h tools/objtool/arch/x86/decode.c tools/objtool/check.c +1 more+31 -62 replies
20/20objtool: Add Direction Flag validationtools/objtool/arch.h tools/objtool/arch/x86/decode.c tools/objtool/check.c +1 more+37 -25 replies

Reviews trailers per patch

2 of 20 patches have a Reviewed-by or Acked-by.

PatchJuergen GrossAndy Lutomirski
1/20
2/20
3/20
4/20
5/20R-b
6/20
7/20R-b
8/20
9/20
10/20
11/20
12/20
13/20
14/20
15/20
16/20
17/20
18/20
19/20
20/20

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/20] objtool: UACCESS validation v3

Teach objtool to validate the UACCESS (SMAP, PAN) rules with 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 clean, and I've only got a few randconfig failures left (GCC-8) that I'm not quite understanding.

---
 arch/x86/ia32/ia32_signal.c                |  29 ++-
 arch/x86/include/asm/asm.h                 |  24 --
 arch/x86/include/asm/nospec-branch.h       |   4 +-
 arch/x86/include/asm/smap.h                |  20 ++
 arch/x86/include/asm/uaccess.h             |   5 +-
 arch/x86/include/asm/uaccess_64.h          |   3 -
 arch/x86/include/asm/xen/hypercall.h       |  26 +-
 arch/x86/kernel/signal.c                   |   2 +-
 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/uaccess.h                    |   2 +
 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/Makefile                     |   2 +-
 tools/objtool/arch.h                       |   8 +-
 tools/objtool/arch/x86/decode.c            |  26 +-
 tools/objtool/builtin-check.c              |   4 +-
 tools/objtool/builtin.h                    |   2 +-
 tools/objtool/check.c                      | 382 ++++++++++++++++++++++-------
 tools/objtool/check.h                      |   4 +-
 tools/objtool/elf.c                        |  15 +-
 tools/objtool/elf.h                        |   3 +-
 tools/objtool/special.c                    |  10 +-
 tools/objtool/warn.h                       |   8 +
 31 files changed, 511 insertions(+), 173 deletions(-)