lkml.org 
[lkml]   [2019]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[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(-)

\
 
 \ /
  Last update: 2019-03-18 16:54    [W:0.374 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site