Skip to content

objtool: UACCESS validation

Peter Zijlstra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 35 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6x86/uaccess: Dont evaluate argument inside AC regionarch/x86/include/asm/uaccess.h+3 -16 replies
2/6x86/ia32: Fix ia32_restore_sigcontext AC leakarch/x86/ia32/ia32_signal.c+19 -106 replies
3/6objtool: Set insn->func for alternativestools/objtool/check.c+1 -00 replies
4/6objtool: Replace STACK_FRAME_NON_STANDARD annotationinclude/linux/frame.h tools/objtool/check.c tools/objtool/check.h+41 -375 replies
5/6objtool: Add UACCESS validationinclude/linux/frame.h tools/objtool/arch.h tools/objtool/arch/x86/decode.c +3 more+138 -1318 replies
6/6objtool: Add Direction Flag validationtools/objtool/arch.h tools/objtool/arch/x86/decode.c tools/objtool/check.c +1 more+33 -20 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by.

PatchAndy Lutomirski
1/6Probably-Signed-off-by
2/6
3/6
4/6
5/6
6/6

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 0/6] objtool: UACCESS validation

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 an annotation to mark (a very limited) set of functions as UACCESS-safe (eg. the planned:
unsafe_copy_{to,from}_user()).

---
 arch/x86/ia32/ia32_signal.c     |  29 ++++---
 arch/x86/include/asm/uaccess.h  |   4 +-
 include/linux/frame.h           |  49 ++++++++++-
 tools/objtool/Makefile          |   2 +-
 tools/objtool/arch.h            |   6 +-
 tools/objtool/arch/x86/decode.c |  22 ++++-
 tools/objtool/check.c           | 180 ++++++++++++++++++++++++++++++----------
 tools/objtool/check.h           |   3 +-
 tools/objtool/elf.h             |   1 +
 9 files changed, 234 insertions(+), 62 deletions(-)