1
0
Fork 0
remarkable-linux/drivers
Kees Cook ea60e54b22 /dev/mem: Add bounce buffer for copy-out
[ Upstream commit 22ec1a2aea ]

As done for /proc/kcore in

  commit df04abfd18 ("fs/proc/kcore.c: Add bounce buffer for ktext data")

this adds a bounce buffer when reading memory via /dev/mem. This
is needed to allow kernel text memory to be read out when built with
CONFIG_HARDENED_USERCOPY (which refuses to read out kernel text) and
without CONFIG_STRICT_DEVMEM (which would have refused to read any RAM
contents at all).

Since this build configuration isn't common (most systems with
CONFIG_HARDENED_USERCOPY also have CONFIG_STRICT_DEVMEM), this also tries
to inform Kconfig about the recommended settings.

This patch is modified from Brad Spengler/PaX Team's changes to /dev/mem
code in the last public patch of grsecurity/PaX based on my understanding
of the code. Changes or omissions from the original code are mine and
don't reflect the original grsecurity/PaX code.

Reported-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Fixes: f5509cc18d ("mm: Hardened usercopy")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24 11:01:24 +01:00
..
accessibility License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi ACPI / bus: Parse tables as term_list for Dell XPS 9570 and Precision M5530 2018-03-08 22:41:26 -08:00
amba License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
android binder: replace "%p" with "%pK" 2018-02-25 11:07:52 +01:00
ata ahci: Add Intel Cannon Lake PCH-H PCI ID 2018-02-16 20:22:59 +01:00
atm atm: horizon: Fix irq release error 2017-12-14 09:53:13 +01:00
auxdisplay auxdisplay: img-ascii-lcd: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE 2018-02-07 11:12:20 -08:00
base dma-buf/fence: Fix lock inversion within dma-fence-array 2018-03-19 08:42:47 +01:00
bcma License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
block loop: Fix lost writes caused by missing flag 2018-03-15 10:54:32 +01:00
bluetooth Bluetooth: btqcomsmd: Fix skb double free corruption 2018-03-24 11:01:21 +01:00
bus sunxi-rsb: Include OF based modalias in device uevent 2018-01-10 09:31:19 +01:00
cdrom License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
char /dev/mem: Add bounce buffer for copy-out 2018-03-24 11:01:24 +01:00
clk clk: qcom: msm8916: fix mnd_width for codec_digcodec 2018-03-19 08:42:52 +01:00
clocksource clocksource/drivers/stm32: Fix kernel panic with multiple timers 2018-02-16 20:23:09 +01:00
connector
cpufreq cpufreq: longhaul: Revert transition_delay_us to 200 ms 2018-03-24 11:01:21 +01:00
cpuidle cpuidle: fix broadcast control when broadcast can not be entered 2017-12-25 14:26:30 +01:00
crypto crypto: caam/qi - use correct print specifier for size_t 2018-03-19 08:42:55 +01:00
dax dev/dax: fix uninitialized variable build warning 2017-12-20 10:10:34 +01:00
dca
devfreq PM / devfreq: Propagate error from devfreq_add_device() 2018-02-22 15:42:16 +01:00
dio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dma dmaengine: zynqmp_dma: Fix race condition in the probe 2018-03-24 11:01:23 +01:00
dma-buf dma-buf/fence: Fix lock inversion within dma-fence-array 2018-03-19 08:42:47 +01:00
edac EDAC, sb_edac: Fix out of bound writes during DIMM configuration on KNL 2018-03-08 22:41:20 -08:00
eisa License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extcon extcon: int3496: process id-pin first so that we start with the right status 2018-02-28 10:19:39 +01:00
firewire License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
firmware firmware/psci: Expose SMCCC version through psci_ops 2018-02-16 20:22:56 +01:00
fmc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fpga fpga: region: release of_parse_phandle nodes after use 2018-02-07 11:12:26 -08:00
fsi drivers/fsi/scom: Remove reset before every putscom 2017-08-28 17:15:16 +02:00
gpio gpio: davinci: Assign first bank regs for unbanked case 2018-02-25 11:07:56 +01:00
gpu drm/tilcdc: ensure nonatomic iowrite64 is not used 2018-03-24 11:01:24 +01:00
hid HID: elo: clear BTN_LEFT mapping 2018-03-19 08:42:47 +01:00
hsi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv x86/virt: Add enum for hypervisors to replace x86_hyper 2017-12-25 14:26:20 +01:00
hwmon x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
hwspinlock License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hwtracing License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i2c i2c: bcm2835: Set up the rising/falling edge delays 2018-02-28 10:19:39 +01:00
ide ide: ide-atapi: fix compile error with defining macro DEBUG 2017-12-17 15:08:00 +01:00
idle Revert "x86/mm: Stop calling leave_mm() in idle code" 2017-11-04 15:01:50 +01:00
iio iio: health: max30102: Add power enable parameter to get_temp function 2018-03-19 08:42:51 +01:00
infiniband RDMA/iwpm: Fix uninitialized error code in iwpm_send_mapinfo() 2018-03-24 11:01:22 +01:00
input Input: matrix_keypad - fix race when disabling interrupts 2018-03-15 10:54:32 +01:00
iommu iommu/arm-smmu-v3: Cope with duplicated Stream IDs 2018-01-10 09:31:21 +01:00
ipack
irqchip irqchip/gic-v3-its: Ensure nr_ites >= nr_lpis 2018-03-21 12:06:44 +01:00
isdn License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leds leds: pm8058: Silence pointer to integer size warning 2018-03-19 08:42:50 +01:00
lightnvm lightnvm: pblk: protect line bitmap while submitting meta io 2017-12-20 10:10:38 +01:00
macintosh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mailbox mailbox: mailbox-test: don't rely on rx_buffer content to signal data ready 2017-12-14 09:53:12 +01:00
mcb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
md dm raid: fix raid set size revalidation 2018-03-19 08:42:54 +01:00
media media: [RESEND] media: dvb-frontends: Add delay to Si2168 restart 2018-03-24 11:01:23 +01:00
memory License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
memstick License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
message License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mfd mfd: twl6040: Fix child-node lookup 2017-12-29 17:53:46 +01:00
misc mei: me: add cannon point device ids for 4th device 2018-02-25 11:08:04 +01:00
mmc mmc: block: fix logical error to avoid memory leak 2018-03-24 11:01:24 +01:00
mtd mtd: nand: ifc: update bufnum mask for ver >= 2.0.0 2018-03-19 08:42:50 +01:00
mux mux: core: fix double get_device() 2018-01-17 09:45:27 +01:00
net qmi_wwan: set FLAG_SEND_ZLP to avoid network initiated disconnect 2018-03-24 11:01:23 +01:00
nfc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ntb
nubus License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nvdimm libnvdimm, pfn: fix start_pad handling for aligned namespaces 2017-12-29 17:53:49 +01:00
nvme nvme-rdma: don't suppress send completions 2018-03-08 22:41:26 -08:00
nvmem License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
of of_mdio: avoid MDIO bus removal when a PHY is missing 2018-03-03 10:24:37 +01:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parisc parisc: Hide Diva-built-in serial aux and graphics card 2017-12-29 17:53:47 +01:00
parport License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci PCI: dwc: Fix enumeration end when reaching root subordinate 2018-03-15 10:54:32 +01:00
pcmcia License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
phy phy: cpcap-usb: Fix platform_get_irq_byname's error checking. 2018-03-03 10:24:22 +01:00
pinctrl pinctrl: sh-pfc: r8a7795-es1: Fix MOD_SEL1 bit[25:24] to 0x3 when using STP_ISEN_1_D 2018-03-19 08:42:52 +01:00
platform platform/chrome: Use proper protocol transfer function 2018-03-24 11:01:23 +01:00
pnp License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
power power: supply: ab8500_charger: Bail out in case of error in 'ab8500_charger_init_hw_registers()' 2018-03-19 08:42:50 +01:00
powercap
pps drivers/pps: use surrounding "if PPS" to remove numerous dependency checks 2017-09-08 18:26:51 -07:00
ps3
ptp License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pwm pwm: stmpe: Fix wrong register offset for hwpwm=2 case 2018-03-19 08:42:51 +01:00
rapidio drivers/rapidio/devices/rio_mport_cdev.c: fix resource leak in error handling path in 'rio_dma_transfer()' 2017-12-14 09:53:08 +01:00
ras License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
regulator regulator: stm32-vrefbuf: fix check on ready flag 2018-03-15 10:54:28 +01:00
remoteproc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reset License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rpmsg rpmsg: glink: Initialize the "intent_req_comp" completion variable 2017-12-20 10:10:29 +01:00
rtc rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() 2018-03-19 08:42:49 +01:00
s390 s390/qeth: fix IPA command submission race 2018-03-08 22:41:20 -08:00
sbus License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
scsi scsi: megaraid_sas: Do not use 32-bit atomic request descriptor for Ventura controllers 2018-03-24 11:01:21 +01:00
sfi
sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sn
soc meson-gx-socinfo: Fix package id parsing 2018-02-25 11:07:56 +01:00
spi spi: sh-msiof: Avoid writing to registers from spi_master.setup() 2018-03-24 11:01:22 +01:00
spmi spmi: pmic-arb: Move the ownership check to irq_chip callback 2017-08-28 13:52:22 +02:00
ssb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
staging staging: android: ashmem: Fix possible deadlock in ashmem_ioctl 2018-03-24 11:01:21 +01:00
target iscsi-target: make sure to wake up sleeping login worker 2018-02-22 15:42:29 +01:00
tc
tee optee: fix invalid of_node_put() in optee_driver_init() 2017-12-25 14:26:24 +01:00
thermal thermal/drivers/hisi: Fix multiple alarm interrupts firing 2017-12-25 14:26:31 +01:00
thunderbolt thunderbolt: tb: fix use after free in tb_activate_pcie_devices 2017-12-20 10:10:24 +01:00
tty serial: 8250_dw: Disable clock on error 2018-03-24 11:01:23 +01:00
uio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usb usb: dwc3: Fix GDBGFIFOSPACE_TYPE values 2018-03-21 12:06:45 +01:00
uwb License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vfio vfio: disable filesystem-dax page pinning 2018-03-08 22:41:06 -08:00
vhost vhost: use mutex_lock_nested() in vhost_dev_lock_vqs() 2018-02-25 11:07:45 +01:00
video video/hdmi: Allow "empty" HDMI infoframes 2018-03-19 08:42:47 +01:00
virt virt: Convert to using %pOF instead of full_name 2017-08-29 08:52:51 -05:00
virtio virtio_ring: fix num_free handling in error case 2018-03-15 10:54:32 +01:00
vlynq
vme License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
w1 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
watchdog watchdog: Fix kref imbalance seen if handle_boot_enabled=0 2018-03-24 11:01:23 +01:00
xen xen/gntdev: Fix partial gntdev_mmap() cleanup 2018-03-03 10:24:37 +01:00
zorro License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile usb: build drivers/usb/common/ when USB_SUPPORT is set 2018-02-25 11:07:53 +01:00