linux/arch
Kees Cook 4fc265a9c9 x86/mtrr: Require CAP_SYS_ADMIN for all access
Zhang Xiaoxu noted that physical address locations for MTRR were visible
to non-root users, which could be considered an information leak.
In discussing[1] the options for solving this, it sounded like just
moving the capable check into open() was the first step.

If this breaks userspace, then we will have a test case for the more
conservative approaches discussed in the thread. In summary:

- MTRR should check capabilities at open time (or retain the
  checks on the opener's permissions for later checks).

- changing the DAC permissions might break something that expects to
  open mtrr when not uid 0.

- if we leave the DAC permissions alone and just move the capable check
  to the opener, we should get the desired protection. (i.e. check
  against CAP_SYS_ADMIN not just the wider uid 0.)

- if that still breaks things, as in userspace expects to be able to
  read other parts of the file as non-uid-0 and non-CAP_SYS_ADMIN, then
  we need to censor the contents using the opener's permissions. For
  example, as done in other /proc cases, like commit

  51d7b12041 ("/proc/iomem: only expose physical resource addresses to privileged users").

[1] https://lore.kernel.org/lkml/201911110934.AC5BA313@keescook/

Reported-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: James Morris <jamorris@linux.microsoft.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-security-module@vger.kernel.org
Cc: Matthew Garrett <mjg59@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: x86-ml <x86@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/201911181308.63F06502A1@keescook
2019-12-09 09:24:24 +01:00
..
alpha alpha: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:14 -08:00
arc ARC updates for 5.5-rc1 2019-12-04 19:06:18 -08:00
arm ARM fixes for 5.5-rc: 2019-12-06 16:12:39 -08:00
arm64 ARM: SoC fixes 2019-12-06 14:19:37 -08:00
c6x c6x: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:15 -08:00
csky
h8300
hexagon
ia64 drm msm + fixes for 5.5-rc1 2019-12-06 10:28:09 -08:00
m68k Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-12-05 12:20:42 -08:00
microblaze microblaze: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
mips arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
nds32 nds32: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
nios2
openrisc
parisc parisc/hugetlb: use pgtable-nopXd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
powerpc powerpc updates for 5.5 #2 2019-12-06 13:36:31 -08:00
riscv Second set of RISC-V updates for v5.5-rc1 2019-12-04 11:07:00 -08:00
s390 powerpc updates for 5.5 #2 2019-12-06 13:36:31 -08:00
sh Additional power management updates for 5.5-rc1 2019-12-04 10:48:09 -08:00
sparc sparc32: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:15 -08:00
um um: add support for folded p4d page tables 2019-12-04 19:44:15 -08:00
unicore32
x86 x86/mtrr: Require CAP_SYS_ADMIN for all access 2019-12-09 09:24:24 +01:00
xtensa arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
.gitignore
Kconfig arch/Kconfig: fix indentation 2019-12-04 19:44:12 -08:00