alistair23-linux/drivers/char
Ard Biesheuvel 06c35ef1fd drivers/char: kmem: disable on arm64
As it turns out, arm64 deviates from other architectures in the way it
maps the VMALLOC region: on most (all?) other architectures, it resides
strictly above the kernel's direct mapping of DRAM, but on arm64, this
is the other way around. For instance, for a 48-bit VA configuration,
we have

  modules : 0xffff000000000000 - 0xffff000008000000   (   128 MB)
  vmalloc : 0xffff000008000000 - 0xffff7dffbfff0000   (129022 GB)
  ...
  vmemmap : 0xffff7e0000000000 - 0xffff800000000000   (  2048 GB maximum)
            0xffff7e0000000000 - 0xffff7e0003ff0000   (    63 MB actual)
  memory  : 0xffff800000000000 - 0xffff8000ffc00000   (  4092 MB)

This has mostly gone unnoticed until now, but it does appear that it
breaks an assumption in the kmem read/write code, which does something
like

  if (p < (unsigned long) high_memory) {
    ... use straight copy_[to|from]_user() using p as virtual address ...
  }
  ...
  if (count > 0) {
    ... use vread/vwrite for accesses past high_memory ...
  }

The first condition will inadvertently hold for the VMALLOC region if
VMALLOC_START < PAGE_OFFSET [which is the case on arm64], but the read
or write will subsequently fail the virt_addr_valid() check, resulting
in a -ENXIO return value.

Given how kmem seems to be living in borrowed time anyway, and given
the fact that nobody noticed that the read/write interface is broken
on arm64 in the first place, let's not bother trying to fix it, but
simply disable the /dev/kmem interface entirely for arm64.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2017-06-20 12:42:42 +01:00
..
agp agp: use set_memory.h header 2017-05-08 17:15:13 -07:00
hw_random Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-05-02 15:53:46 -07:00
ipmi Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
mwave Annotate hardware config module parameters in drivers/char/mwave/ 2017-04-20 12:02:32 +01:00
pcmcia lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
tpm char/misc patches for 4.12-rc1 2017-05-04 19:15:35 -07:00
xilinx_hwicap char: xilinx_hwicap: Remove pointless local variables 2017-01-25 11:41:44 +01:00
xillybus
apm-emulation.c
applicom.c Annotate hardware config module parameters in drivers/char/ 2017-04-20 12:02:32 +01:00
applicom.h
bfin-otp.c
bsr.c
ds1302.c
ds1620.c
dsp56k.c format-security: move static strings to const 2017-05-08 17:15:14 -07:00
dtlk.c
efirtc.c
generic_nvram.c
hangcheck-timer.c hangcheck-timer: Fix typo in comment 2017-04-08 18:08:54 +02:00
hpet.c hpet: Make cmd parameter of hpet_ioctl_common() unsigned 2017-03-17 15:10:49 +09:00
Kconfig drivers/char: kmem: disable on arm64 2017-06-20 12:42:42 +01:00
lp.c char: lp: fix possible integer overflow in lp_setup() 2017-05-16 23:05:20 +02:00
Makefile
mbcs.c
mbcs.h
mem.c drivers: char: mem: Check for address space wraparound with mmap() 2017-05-18 16:53:55 +02:00
misc.c drivers: char: misc: Replace printk with pr_err. 2017-04-08 17:53:06 +02:00
mmtimer.c time: Change k_clock timer_set() and timer_get() to use timespec64 2017-04-14 21:49:56 +02:00
mspec.c drivers, char: convert vma_data.refcnt from atomic_t to refcount_t 2017-03-23 13:57:19 +01:00
nsc_gpio.c
nvram.c
nwbutton.c drivers/char/nwbutton: Fix build breakage caused by include file reshuffling 2017-03-07 08:35:49 +01:00
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c ppdev: fix registering same device name 2017-03-16 17:32:21 +09:00
ps3flash.c
random.c random: move random_min_urandom_seed into CONFIG_SYSCTL ifdef block 2017-02-06 20:46:49 -05:00
raw.c
rtc.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
scx200_gpio.c
snsc.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
snsc.h
snsc_event.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
sonypi.c scripts/spelling.txt: add "initialiazation" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
tb0219.c
tile-srom.c
tlclk.c
toshiba.c
ttyprintk.c
uv_mmtimer.c
virtio_console.c virtio: fixes, cleanups, performance 2017-05-10 11:33:08 -07:00