]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit - tools/objtool/check.c
objtool: Add UACCESS validation
authorPeter Zijlstra <peterz@infradead.org>
Mon, 25 Feb 2019 11:50:09 +0000 (12:50 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 3 Apr 2019 09:02:24 +0000 (11:02 +0200)
commitea24213d8088f9da73e1b6aadf7abd2435b70397
treefba1e181531f8f20ff04ed6a57e10b8bd2805343
parent54262aa2830151f89699fa8a6c5aa05f0992e672
objtool: Add UACCESS validation

It is important that UACCESS regions are as small as possible;
furthermore the UACCESS state is not scheduled, so doing anything that
might directly call into the scheduler will cause random code to be
ran with UACCESS enabled.

Teach objtool too track UACCESS state and warn about any CALL made
while UACCESS is enabled. This very much includes the __fentry__()
and __preempt_schedule() calls.

Note that exceptions _do_ save/restore the UACCESS state, and therefore
they can drive preemption. This also means that all exception handlers
must have an otherwise redundant UACCESS disable instruction;
therefore ignore this warning for !STT_FUNC code (exception handlers
are not normal functions).

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
scripts/Makefile.build
tools/objtool/arch.h
tools/objtool/arch/x86/decode.c
tools/objtool/builtin-check.c
tools/objtool/builtin.h
tools/objtool/check.c
tools/objtool/check.h
tools/objtool/elf.h
tools/objtool/special.c
tools/objtool/special.h