linux/arch/x86/entry/vdso
Andy Lutomirski bd902c5362 x86/vdso: Disallow vvar access to vclock IO for never-used vclocks
It makes me uncomfortable that even modern systems grant every
process direct read access to the HPET.

While fixing this for real without regressing anything is a mess
(unmapping the HPET is tricky because we don't adequately track
all the mappings), we can do almost as well by tracking which
vclocks have ever been used and only allowing pages associated
with used vclocks to be faulted in.

This will cause rogue programs that try to peek at the HPET to
get SIGBUS instead on most systems.

We can't restrict faults to vclock pages that are associated
with the currently selected vclock due to a race: a process
could start to access the HPET for the first time and race
against a switch away from the HPET as the current clocksource.
We can't segfault the process trying to peek at the HPET in this
case, even though the process isn't going to do anything useful
with the data.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/e79d06295625c02512277737ab55085a498ac5d8.1451446564.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-01-12 11:59:35 +01:00
..
vdso32 x86/entry: Restore traditional SYSENTER calling convention 2015-12-21 16:05:01 +01:00
.gitignore
checkundef.sh
Makefile x86/vdso: Define BUILD_VDSO while building and emit .eh_frame in asm 2015-10-09 09:41:05 +02:00
vclock_gettime.c x86/vdso: Enable vdso pvclock access on all vdso variants 2015-12-11 08:56:03 +01:00
vdso2c.c x86/vdso: Get pvclock data from the vvar VMA instead of the fixmap 2015-12-11 08:56:03 +01:00
vdso2c.h x86/vdso: Use .fault for the vDSO text mapping 2016-01-12 11:59:34 +01:00
vdso32-setup.c x86/vdso: Remove runtime 32-bit vDSO selection 2015-10-07 11:34:08 +02:00
vdso-layout.lds.S x86/vdso: Get pvclock data from the vvar VMA instead of the fixmap 2015-12-11 08:56:03 +01:00
vdso-note.S
vdso.lds.S
vdsox32.lds.S
vgetcpu.c
vma.c x86/vdso: Disallow vvar access to vclock IO for never-used vclocks 2016-01-12 11:59:35 +01:00