linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/80] drm/bufs: Fix Spectre v1 vulnerability
@ 2019-01-28 16:22 Sasha Levin
  2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 02/80] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Sasha Levin
                   ` (78 more replies)
  0 siblings, 79 replies; 80+ messages in thread
From: Sasha Levin @ 2019-01-28 16:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gustavo A. R. Silva, Daniel Vetter, Sasha Levin, dri-devel

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

[ Upstream commit a37805098900a6e73a55b3a43b7d3bcd987bb3f4 ]

idx can be indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/gpu/drm/drm_bufs.c:1420 drm_legacy_freebufs() warn: potential
spectre issue 'dma->buflist' [r] (local cap)

Fix this by sanitizing idx before using it to index dma->buflist

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181016095549.GA23586@embeddedor.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/drm_bufs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index f1a204d253cc..ac22b8d86249 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -36,6 +36,8 @@
 #include <drm/drmP.h>
 #include "drm_legacy.h"
 
+#include <linux/nospec.h>
+
 static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
 						  struct drm_local_map *map)
 {
@@ -1332,6 +1334,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
 				  idx, dma->buf_count - 1);
 			return -EINVAL;
 		}
+		idx = array_index_nospec(idx, dma->buf_count);
 		buf = dma->buflist[idx];
 		if (buf->file_priv != file_priv) {
 			DRM_ERROR("Process %d freeing buffer not owned\n",
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 80+ messages in thread

end of thread, other threads:[~2019-01-28 16:41 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 16:22 [PATCH AUTOSEL 4.4 01/80] drm/bufs: Fix Spectre v1 vulnerability Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 02/80] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 03/80] ASoC: Intel: mrfld: fix uninitialized variable access Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 04/80] ath9k: dynack: use authentication messages for 'late' ack Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 05/80] scsi: lpfc: Correct LCB RJT handling Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 06/80] platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 07/80] ARM: 8808/1: kexec:offline panic_smp_self_stop CPU Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 08/80] dlm: Don't swamp the CPU with callbacks queued during recovery Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 09/80] x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux) Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 10/80] powerpc/pseries: add of_node_put() in dlpar_detach_node() Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 11/80] serial: fsl_lpuart: clear parity enable bit when disable parity Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 12/80] serial: core: Allow processing sysrq at port unlock time Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 13/80] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 14/80] staging:iio:ad2s90: Make probe handle spi_setup failure Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 15/80] staging: iio: ad7780: update voltage on read Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 16/80] ARM: OMAP2+: hwmod: Fix some section annotations Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 17/80] modpost: validate symbol names also in find_elf_symbol Sasha Levin
2019-01-28 16:22 ` [PATCH AUTOSEL 4.4 18/80] perf tools: Add Hygon Dhyana support Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 19/80] soc/tegra: Don't leak device tree node reference Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 20/80] f2fs: move dir data flush to write checkpoint process Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 21/80] f2fs: fix wrong return value of f2fs_acl_create Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 22/80] sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 23/80] nfsd4: fix crash on writing v4_end_grace before nfsd startup Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 24/80] arm64: ftrace: don't adjust the LR value Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 25/80] ARM: dts: mmp2: fix TWSI2 Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 26/80] ARM: mmp/mmp2: dt: enable the clock Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 27/80] x86/fpu: Add might_fault() to user_insn() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 28/80] media: DaVinci-VPBE: fix error handling in vpbe_initialize() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 29/80] smack: fix access permissions for keyring Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 30/80] usb: hub: delay hub autosuspend if USB3 port is still link training Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 31/80] timekeeping: Use proper seqcount initializer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 32/80] ARM: dts: Fix OMAP4430 SDP Ethernet startup Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 33/80] mips: bpf: fix encoding bug for mm_srlv32_op Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 34/80] tracing: Have trace_stack nr_entries compare not be so subtle Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 35/80] iommu/arm-smmu-v3: Use explicit mb() when moving cons pointer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 36/80] sata_rcar: fix deferred probing Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 37/80] clk: imx6sl: ensure MMDC CH0 handshake is bypassed Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 38/80] cpuidle: big.LITTLE: fix refcount leak Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 39/80] i2c-axxia: check for error conditions first Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 40/80] udf: Fix BUG on corrupted inode Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 41/80] ARM: pxa: avoid section mismatch warning Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 42/80] ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8M Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 43/80] ARM: mmp: fix timer_init calls Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 44/80] memstick: Prevent memstick host from getting runtime suspended during card detection Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 45/80] tty: serial: samsung: Properly set flags in autoCTS mode Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 46/80] KVM: s390: unregister debug feature on failing arch init Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 47/80] arm64: KVM: Skip MMIO insn after emulation Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 48/80] powerpc/uaccess: fix warning/error with access_ok() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 49/80] mac80211: fix radiotap vendor presence bitmap handling Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 50/80] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 51/80] Bluetooth: Fix unnecessary error message for HCI request completion Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 52/80] cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 53/80] drbd: narrow rcu_read_lock in drbd_sync_handshake Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 54/80] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 55/80] drbd: skip spurious timeout (ping-timeo) when failing promote Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 56/80] drbd: Avoid Clang warning about pointless switch statment Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 57/80] video: clps711x-fb: release disp device node in probe() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 58/80] fbdev: fbmem: behave better with small rotated displays and many CPUs Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 59/80] igb: Fix an issue that PME is not enabled during runtime suspend Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 60/80] fbdev: fbcon: Fix unregister crash when more than one framebuffer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 61/80] KVM: x86: svm: report MSR_IA32_MCG_EXT_CTL as unsupported Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 62/80] NFS: nfs_compare_mount_options always compare auth flavors Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 63/80] hwmon: (lm80) fix a missing check of the status of SMBus read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 64/80] hwmon: (lm80) fix a missing check of bus read in lm80 probe Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 65/80] seq_buf: Make seq_buf_puts() null-terminate the buffer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 66/80] crypto: ux500 - Use proper enum in cryp_set_dma_transfer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 67/80] crypto: ux500 - Use proper enum in hash_set_dma_transfer Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 68/80] cifs: check ntwrk_buf_start for NULL before dereferencing it Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 69/80] um: Avoid marking pages with "changed protection" Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 70/80] niu: fix missing checks of niu_pci_eeprom_read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 71/80] scripts/decode_stacktrace: only strip base path when a prefix of the path Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 72/80] mm/page_owner: clamp read count to PAGE_SIZE Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 73/80] ocfs2: don't clear bh uptodate for block read Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 74/80] isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw() Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 75/80] gdrom: fix a memory leak bug Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 76/80] block/swim3: Fix -EBUSY error when re-opening device after unmount Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 77/80] HID: lenovo: Add checks to fix of_led_classdev_register Sasha Levin
2019-01-28 16:23 ` [PATCH AUTOSEL 4.4 78/80] kernel/hung_task.c: break RCU locks based on jiffies Sasha Levin
2019-01-28 16:24 ` [PATCH AUTOSEL 4.4 79/80] fs/epoll: drop ovflist branch prediction Sasha Levin
2019-01-28 16:24 ` [PATCH AUTOSEL 4.4 80/80] exec: load_script: don't blindly truncate shebang string Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).