linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/25] objtool: UACCESS validation v4
@ 2019-03-18 15:38 Peter Zijlstra
  2019-03-18 15:38 ` [PATCH 01/25] x86: Make SMAP 64-bit only Peter Zijlstra
                   ` (26 more replies)
  0 siblings, 27 replies; 59+ messages in thread
From: Peter Zijlstra @ 2019-03-18 15:38 UTC (permalink / raw)
  To: torvalds, tglx, hpa, julien.thierry, will.deacon, luto, mingo,
	catalin.marinas, james.morse, valentin.schneider, brgerst,
	jpoimboe, luto, bp, dvlasenk
  Cc: linux-kernel, peterz, dvyukov, rostedt

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(-)


^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2019-05-09 19:44 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-18 15:38 [PATCH 00/25] objtool: UACCESS validation v4 Peter Zijlstra
2019-03-18 15:38 ` [PATCH 01/25] x86: Make SMAP 64-bit only Peter Zijlstra
2019-03-18 16:58   ` Linus Torvalds
2019-03-18 17:36     ` Peter Zijlstra
2019-03-18 17:51       ` Peter Zijlstra
2019-03-18 18:10         ` Linus Torvalds
2019-03-21 17:12           ` hpa
2019-03-21 17:25           ` Denys Vlasenko
2019-03-21 18:18             ` hpa
2019-03-21 21:03               ` Peter Zijlstra
2019-03-21 18:21             ` Linus Torvalds
2019-03-19 11:16   ` [PATCH 01/25] sched/x86: Save [ER]FLAGS on context switch Peter Zijlstra
2019-03-18 15:38 ` [PATCH 02/25] tracing: Improve "if" macro code generation Peter Zijlstra
2019-03-18 17:41   ` Steven Rostedt
2019-03-18 23:37   ` Josh Poimboeuf
2019-03-19 10:11     ` Peter Zijlstra
2019-03-20 11:18   ` David Laight
2019-03-20 17:26     ` Linus Torvalds
2019-03-20 17:37       ` David Laight
2019-03-20 17:38         ` Linus Torvalds
2019-03-20 18:18       ` Steven Rostedt
2019-05-09 13:00       ` Steven Rostedt
2019-05-09 16:51         ` Linus Torvalds
2019-05-09 18:29           ` Steven Rostedt
2019-05-09 18:45             ` Josh Poimboeuf
2019-05-09 18:47               ` Josh Poimboeuf
2019-05-09 18:48                 ` Randy Dunlap
2019-05-09 18:57                   ` Josh Poimboeuf
2019-05-09 19:06               ` Steven Rostedt
2019-05-09 19:28                 ` Steven Rostedt
2019-05-09 19:44                   ` Linus Torvalds
2019-03-18 15:38 ` [PATCH 03/25] x86/ia32: Fix ia32_restore_sigcontext AC leak Peter Zijlstra
2019-03-18 15:38 ` [PATCH 04/25] i915,uaccess: Fix redundant CLAC Peter Zijlstra
2019-03-18 15:38 ` [PATCH 05/25] x86/uaccess: Move copy_user_handle_tail into asm Peter Zijlstra
2019-03-18 15:38 ` [PATCH 06/25] x86/uaccess: Fix up the fixup Peter Zijlstra
2019-03-18 15:38 ` [PATCH 07/25] x86/nospec,objtool: Introduce ANNOTATE_IGNORE_ALTERNATIVE Peter Zijlstra
2019-03-18 15:38 ` [PATCH 08/25] x86/uaccess,xen: Suppress SMAP warnings Peter Zijlstra
2019-03-18 15:38 ` [PATCH 09/25] x86/uaccess: Always inline user_access_begin() Peter Zijlstra
2019-03-18 15:38 ` [PATCH 10/25] x86/uaccess,signal: Fix AC=1 bloat Peter Zijlstra
2019-03-18 15:38 ` [PATCH 11/25] x86/uaccess: Introduce user_access_{save,restore}() Peter Zijlstra
2019-03-18 15:38 ` [PATCH 12/25] x86/smap: Ditch __stringify() Peter Zijlstra
2019-03-18 15:38 ` [PATCH 13/25] x86/uaccess,kasan: Fix KASAN vs SMAP Peter Zijlstra
2019-03-18 15:38 ` [PATCH 14/25] x86/uaccess,ubsan: Fix UBSAN " Peter Zijlstra
2019-03-18 15:38 ` [PATCH 15/25] x86/uaccess,ftrace: Fix ftrace_likely_update() " Peter Zijlstra
2019-03-18 15:38 ` [PATCH 16/25] x86/uaccess,kcov: Disable stack protector Peter Zijlstra
2019-03-18 15:38 ` [PATCH 17/25] objtool: Set insn->func for alternatives Peter Zijlstra
2019-03-18 15:38 ` [PATCH 18/25] objtool: Handle function aliases Peter Zijlstra
2019-03-18 15:38 ` [PATCH 19/25] objtool: Rewrite add_ignores() Peter Zijlstra
2019-03-18 15:39 ` [PATCH 20/25] objtool: Add --backtrace support Peter Zijlstra
2019-03-18 15:39 ` [PATCH 21/25] objtool: Rewrite alt->skip_orig Peter Zijlstra
2019-03-18 15:39 ` [PATCH 22/25] objtool: Fix sibling call detection Peter Zijlstra
2019-03-18 15:39 ` [PATCH 23/25] objtool: Add UACCESS validation Peter Zijlstra
2019-03-18 23:51   ` Josh Poimboeuf
2019-05-07 11:52   ` Peter Zijlstra
2019-03-18 15:39 ` [PATCH 24/25] objtool: uaccess PUSHF/POPF support Peter Zijlstra
2019-03-18 15:39 ` [PATCH 25/25] objtool: Add Direction Flag validation Peter Zijlstra
2019-03-18 23:57 ` [PATCH 00/25] objtool: UACCESS validation v4 Josh Poimboeuf
2019-03-19 11:20   ` Peter Zijlstra
2019-03-19 11:17 ` [PATCH 26/25] sched/x86_64: Don't save flags on context switch Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).