linux/drivers
Linus Torvalds c03098d4b9 gfs2: Fix mmap + page fault deadlocks
Functions gfs2_file_read_iter and gfs2_file_write_iter are both
 accessing the user buffer to write to or read from while holding the
 inode glock.  In the most basic scenario, that buffer will not be
 resident and it will be mapped to the same file.  Accessing the buffer
 will trigger a page fault, and gfs2 will deadlock trying to take the
 same inode glock again while trying to handle that fault.
 
 Fix that and similar, more complex scenarios by disabling page faults
 while accessing user buffers.  To make this work, introduce a small
 amount of new infrastructure and fix some bugs that didn't trigger so
 far, with page faults enabled.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCAAyFiEEJZs3krPW0xkhLMTc1b+f6wMTZToFAmGBPisUHGFncnVlbmJh
 QHJlZGhhdC5jb20ACgkQ1b+f6wMTZTpE6A/7BezUnGuNJxJrR8pC+vcLYA7xAgUU
 6STQ6IN7w5UHRlSkNzZxZ2XPxW4uVQ4SxSEeaLqBsHZihepjcLNFZ/8MhQ6UPSD0
 8noHOi7CoIcp6IuWQtCpxRM/xjjm2SlMt2XbVJZaiJcdzCV9gB6TU9EkBRq7Zm/X
 9WFBbv1xZF0skn9ISCJvNtiiI+VyWKgMDUKxJUiTQjmJcklyyqHcVGmQi9BjqPz4
 4s3F+WH6CoGbDKlmNk/6Y9wZ/2+sbvGswVscUxPwJVPoZWsR1xBBUdAeAmEMD1P4
 BgE/Y1J8JXyVPYtyvZKq70XUhKdQkxB7RfX87YasOk9mY4Kjd5rIIGEykh+o2vC9
 kDhCHvf2Mnw5I6Rum3B7UXyB1vemY+fECIHsXhgBnS+ztabRtcAdpCuWoqb43ymw
 yEX1KwXyU4FpRYbrRvdZT42Fmh6ty8TW+N4swg8S2TrffirvgAi5yrcHZ4mPupYv
 lyzvsCW7Wv8hPXn/twNObX+okRgJnsxcCdBXARdCnRXfA8tH23xmu88u8RA1Vdxh
 nzTvv6Dx2EowwojuDWMx29Mw3fA2IqIfbOV+4FaRU7NZ2ZKtknL8yGl27qQUsMoJ
 vYsHTmagasjQr+NDJ3vQRLCw+JQ6B1hENpdkmixFD9moo7X1ZFW3HBi/UL973Bv6
 5CmgeXto8FRUFjI=
 =WeNd
 -----END PGP SIGNATURE-----

Merge tag 'gfs2-v5.15-rc5-mmap-fault' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 mmap + page fault deadlocks fixes from Andreas Gruenbacher:
 "Functions gfs2_file_read_iter and gfs2_file_write_iter are both
  accessing the user buffer to write to or read from while holding the
  inode glock.

  In the most basic deadlock scenario, that buffer will not be resident
  and it will be mapped to the same file. Accessing the buffer will
  trigger a page fault, and gfs2 will deadlock trying to take the same
  inode glock again while trying to handle that fault.

  Fix that and similar, more complex scenarios by disabling page faults
  while accessing user buffers. To make this work, introduce a small
  amount of new infrastructure and fix some bugs that didn't trigger so
  far, with page faults enabled"

* tag 'gfs2-v5.15-rc5-mmap-fault' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Fix mmap + page fault deadlocks for direct I/O
  iov_iter: Introduce nofault flag to disable page faults
  gup: Introduce FOLL_NOFAULT flag to disable page faults
  iomap: Add done_before argument to iomap_dio_rw
  iomap: Support partial direct I/O on user copy failures
  iomap: Fix iomap_dio_rw return value for user copies
  gfs2: Fix mmap + page fault deadlocks for buffered I/O
  gfs2: Eliminate ip->i_gh
  gfs2: Move the inode glock locking to gfs2_file_buffered_write
  gfs2: Introduce flag for glock holder auto-demotion
  gfs2: Clean up function may_grant
  gfs2: Add wrapper for iomap_file_buffered_write
  iov_iter: Introduce fault_in_iov_iter_writeable
  iov_iter: Turn iov_iter_fault_in_readable into fault_in_iov_iter_readable
  gup: Turn fault_in_pages_{readable,writeable} into fault_in_{readable,writeable}
  powerpc/kvm: Fix kvm_use_magic_page
  iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value
2021-11-02 12:25:03 -07:00
..
accessibility
acpi hwmon updates for v5.16-rc1 2021-11-01 19:16:49 -07:00
amba ARM: 9119/1: amba: Properly handle device probe without IRQ domain 2021-10-19 10:30:53 +01:00
android selinux/stable-5.16 PR 20211101 2021-11-01 21:06:18 -07:00
ata libata changes for 5.16 2021-11-02 10:45:34 -07:00
atm
auxdisplay
base Core: 2021-11-02 06:20:58 -07:00
bcma bcma: drop unneeded initialization value 2021-10-05 08:32:30 +03:00
block for-5.16/inode-sync-2021-10-29 2021-11-01 10:25:27 -07:00
bluetooth Bluetooth: Rename driver .prevent_wake to .wakeup 2021-10-01 15:46:15 -07:00
bus Driver core fixes for 5.15-rc6 2021-10-17 17:17:28 -10:00
cdrom for-5.16/cdrom-2021-10-29 2021-11-01 10:09:14 -07:00
char Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-11-01 21:24:02 -07:00
clk One fix for the composite clk that broke when we changed this clk type 2021-10-30 09:55:46 -07:00
clocksource ARM: 2021-11-02 11:24:14 -07:00
comedi comedi: Fix memory leak in compat_insnlist() 2021-09-21 17:53:54 +02:00
connector
counter
cpufreq Power management fixes for 5.15-rc2 2021-09-17 12:05:04 -07:00
cpuidle - Core Frameworks 2021-09-07 12:38:59 -07:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-11-01 21:24:02 -07:00
cxl cxl/core: Replace unions with struct_group() 2021-09-25 08:20:47 -07:00
dax libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
dca
devfreq devfreq: use HZ macros 2021-09-08 11:50:26 -07:00
dio
dma dmaengine: pxa_dma: Prefer struct_size over open coded arithmetic 2021-10-20 18:35:22 -05:00
dma-buf dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER 2021-09-07 12:42:21 +05:30
edac - amd64_edac: Add support for three-rank interleaving mode which is 2021-11-01 15:02:49 -07:00
eisa
extcon
firewire Core: 2021-11-02 06:20:58 -07:00
firmware spi: Updates for v5.16 2021-11-01 19:09:04 -07:00
fpga fpga: ice40-spi: Add SPI device ID table 2021-09-27 14:00:41 -07:00
fsi
gnss
gpio gpio: mlxbf2.c: Add check for bgpio_init failure 2021-10-25 10:15:05 +02:00
gpu gfs2: Fix mmap + page fault deadlocks 2021-11-02 12:25:03 -07:00
greybus
hid overflow updates for v5.16-rc1 2021-11-01 17:12:56 -07:00
hsi net: remove single-byte netdev->dev_addr writes 2021-10-13 10:03:59 -07:00
hv hyperv-next for 5.16 2021-11-02 10:56:49 -07:00
hwmon hwmon updates for v5.16-rc1 2021-11-01 19:16:49 -07:00
hwspinlock
hwtracing coresight: syscfg: Fix compiler warning 2021-09-14 09:03:16 +02:00
i2c mailbox: pcc: Use PCC mailbox channel pointer instead of standard 2021-10-29 22:46:38 -05:00
i3c
idle
iio Staging/IIO driver fixes for 5.15-rc6 2021-10-17 17:10:00 -10:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-28 10:43:58 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2021-10-17 16:57:06 -10:00
interconnect interconnect: qcom: sdm660: Add missing a2noc qos clocks 2021-09-13 15:49:55 +03:00
iommu overflow updates for v5.16-rc1 2021-11-01 17:12:56 -07:00
ipack ipack: ipoctal: fix module reference leak 2021-09-27 17:38:49 +02:00
irqchip Merge branch irq/irq_cpu_offline into irq/irqchip-next 2021-10-28 13:34:57 +01:00
isdn mISDN: Fix return values of the probe function 2021-10-19 13:09:28 +01:00
leds leds: trigger: Disable CPU trigger on PREEMPT_RT 2021-10-13 20:07:57 +02:00
macintosh powerpc: Split memset() to avoid multi-field overflow 2021-09-25 08:20:47 -07:00
mailbox mailbox: imx: support i.MX8ULP S4 MU 2021-10-29 23:03:09 -05:00
mcb mcb: fix error handling in mcb_alloc_bus() 2021-09-14 11:22:26 +02:00
md for-5.16/passthrough-flag-2021-10-29 2021-11-01 10:12:44 -07:00
media Core: 2021-11-02 06:20:58 -07:00
memory
memstick memstick: r592: Fix a UAF bug when removing the driver 2021-10-19 13:04:42 +02:00
message mpt fusion: use dev_addr_set() 2021-10-28 12:47:49 +01:00
mfd - Core Frameworks 2021-09-07 12:38:59 -07:00
misc net: sgi-xp: use eth_hw_addr_set() 2021-10-29 13:17:21 +01:00
mmc MMC core: 2021-11-01 18:55:12 -07:00
most
mtd mtd: add add_disk() error handling 2021-10-21 09:00:56 -06:00
mux
net hyperv-next for 5.16 2021-11-02 10:56:49 -07:00
nfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-28 10:43:58 -07:00
ntb Bug fixes and clean-ups for Linux v5.15 2021-09-07 13:05:02 -07:00
nubus
nvdimm for-5.16/block-2021-10-29 2021-11-01 09:19:50 -07:00
nvme for-5.16/ki_complete-2021-10-29 2021-11-01 10:17:11 -07:00
nvmem nvmem: Fix shift-out-of-bound (UBSAN) with byte size cells 2021-10-13 15:09:58 +02:00
of ARM development for 5.16: 2021-11-02 11:33:15 -07:00
opp Merge branches 'pm-pci', 'pm-sleep', 'pm-domains' and 'powercap' 2021-08-30 19:25:42 +02:00
parisc parisc: Move pci_dev_is_behind_card_dino to where it is used 2021-09-09 12:44:31 +02:00
parport parisc architecture updates for kernel 5.15: 2021-09-02 13:16:00 -07:00
pci pci-v5.15-fixes-2 2021-10-16 09:00:46 -07:00
pcmcia Core: 2021-11-02 06:20:58 -07:00
perf arm64 updates for 5.16 2021-11-01 16:33:53 -07:00
phy net: Convert more users of mdiobus_* to mdiodev_* 2021-10-24 13:40:33 +01:00
pinctrl pinctrl: amd: disable and mask interrupts on probe 2021-10-16 23:56:59 +02:00
platform platform/x86: int1092: Fix non sequential device mode handling 2021-10-11 16:39:25 +02:00
pnp
power power supply and reset changes for the v5.15 series 2021-08-30 11:47:32 -07:00
powercap powercap: Add Power Limit4 support for Alder Lake SoC 2021-08-25 20:12:16 +02:00
pps
ps3
ptp ptp: fix code indentation issues 2021-10-28 14:42:20 +01:00
pwm pwm: mtk-disp: Implement atomic API .get_state() 2021-09-02 22:27:46 +02:00
rapidio
ras
regulator regulator: Updates for v5.16 2021-11-01 19:04:47 -07:00
remoteproc
reset reset: socfpga: add empty driver allowing consumers to probe 2021-10-05 12:23:16 +02:00
rpmsg
rtc rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 2021-09-14 10:20:19 +02:00
s390 Core: 2021-11-02 06:20:58 -07:00
sbus
scsi Core: 2021-11-02 06:20:58 -07:00
sh
siox
slimbus Driver core update for 5.15-rc1 2021-09-01 08:44:42 -07:00
soc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-22 11:41:16 +01:00
soundwire sound updates for 5.15-rc1 2021-09-01 10:29:29 -07:00
spi spi: Updates for v5.16 2021-11-01 19:09:04 -07:00
spmi
ssb
staging Core: 2021-11-02 06:20:58 -07:00
target for-5.16/ki_complete-2021-10-29 2021-11-01 10:17:11 -07:00
tc
tee tee: optee: Fix missing devices unregister during optee_remove 2021-10-12 13:24:39 +02:00
thermal thermal/drivers/tsens: Fix wrong check for tzd in irq handlers 2021-09-21 15:17:11 +02:00
thunderbolt thunderbolt: build kunit tests without structleak plugin 2021-10-06 17:53:49 -06:00
tty Serial driver fix for 5.15-rc6 2021-10-17 17:06:31 -10:00
uio Drivers: hv: vmbus: Mark vmbus ring buffer visible to host in Isolation VM 2021-10-28 11:22:23 +00:00
usb Core: 2021-11-02 06:20:58 -07:00
vdpa Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-28 10:43:58 -07:00
vfio vfio/pci: add missing identifier name in argument of function prototype 2021-09-23 14:12:36 -06:00
vhost virtio,vdpa: fixes 2021-10-17 18:17:19 -10:00
video video: fbdev: gbefb: Only instantiate device when built for IP32 2021-10-06 11:12:28 +02:00
virt
virtio virtio-ring: fix DMA metadata flags 2021-10-27 15:54:34 -04:00
visorbus
vlynq
vme
w1
watchdog watchdog: Fix OMAP watchdog early handling 2021-10-26 20:22:51 +02:00
xen xen: branch for v5.15-rc5 2021-10-08 12:55:23 -07:00
zorro
Kconfig firmware: include drivers/firmware/Kconfig unconditionally 2021-10-07 16:51:26 +02:00
Makefile remove the lightnvm subsystem 2021-08-14 15:54:09 -06:00