linux/drivers/gpu/drm
Linus Torvalds 22a78a2543 Merge __{get,put}_user() removal branch
This is long over-due: the __get_user() and __put_user() functions are
entirely historical, and are never the rigth thing to use any more.  And
when mis-used (read: every case) they are not only slower than the right
thing, but also insecure because they don't check the user address
range.

Most of the usage sites have been converted long ago, but various
left-overs remained.  So this started out as a single patch that I wrote
as a "show people how to convert __{get,put}_user() to modern code".

In particular, Thomas last year implemented the very nice new scoped
user access region helpers (see commit e497310b4ffb: "uaccess: Provide
scoped user access regions") that makes the modern interfaces
particularly easy to use and really removes any excuse for the old
horrors.

That small example patch then grew to this, partly using Claude as a
glorified coccinelle script to apply the pattern to other places.

There were a few different reasons for using __put_user() and
__get_user() rather than the alternatives, but the original historical
one was performance: when doing multiple accesses off the same base
pointer, doing a single range check followed by multiple non-checked
accesses used to create smaller and faster code.

The keyword here is "used to".  It hasn't been true for years, because
the range check isn't actually the real cost these days.  The real cost
of user accesses on modern hardware is turning the user accesses on and
off in the first place (on x86, using the STAC/CLAC instructions).

Those sequences get turned into 'scoped_user_read_access() { }' blocks,
see for example that first patch in the series: "signal: use scoped user
access for old-style sigaction".

Another, historical reason for using __get_user() and friends is that
you actually want to do a kernel pointer access, but the pointer might
not be entirely reliable (typically during fault handling), so you want
to have exception handling for the kernel access.

The modern way to do that kind of non-faulting kernel access is using
"get_kernel_nofault()", but some code predates that helper existing at
all, and used __get_user() as a way to just get a memory access with
exception handling.  For that pattern, see for example "alpha: use
get_kernel_nofault() in dik_show_code()"

A third bad reason for using __get_user() and friends was that the
proper get_user() had a "might_fault()" in it, and code that ran in
atomic regions but hadn't disabled page faults would result in a
warning.  That kind of code needs to explicitly disable page faults,
because "atomic region" is not well defined at run-time and can be
invisible (eg a preempt-off region in a non-preemptible kernel).

See "vdpa_sim: disable page faults around vringh_need_notify_iotlb()"
for an example of that pattern, where the local_bh_disable() now also
grows a pagefault_disable(), which makes the normal get_user() no longer
warn about the user access in non-process context, because it can see
that the potential page fault will not cause problems.

And finally, the really nasty reason to use __get_user() and friends:
pointers that can be either kernel pointers or user pointers.  We've
gotten rid of almost all such cases, but a couple remained.  See for
example "x86/sev: Use explicit user-or-kernel accessors for #VC memory
operands".

NOTE! This series removes all __get/put_user() calls from generic code
but only does the final removal of the whole interface on x86.  Other
architectures have not been entirely converted, for a variety of reasons:

 - arm64 makes __{get,put}_user() be exactly the same as
   {get,put}_user() so it's harmless and didn't have the dangers of the
   legacy use cases.

 - any architecture that uses <asm-generic/uaccess.h> will still use
   __{get,put}_user as the underlying helper function name

 - several architectures had some legacy uses that weren't entirely
   trivial and I didn't want to extend this patch series to things that
   I don't know and that don't really matter.

but I did do a couple of the obvious "follows the exact same pattern"
just because it could be done mindlessly and automatically.

Let's see if I broke anything, but we should have done this years ago.

* uaccess-cleanups: (48 commits)
  drm/i915/gem: ignore errors on presumed_offset write-back
  powerpc/align: use get_user_instr() for a user-mode instruction
  powerpc/signal64: use scoped user access in setup_trampoline()
  powerpc/signal64: use get_user() for the single context reads
  powerpc/signal32: use get_user() for the single context reads
  KVM: PPC: Book3S HV: use get_user()/put_user() for the HPT fd
  powerpc/powernv: use get_user()/put_user() in the LPC debugfs files
  s390: use get_user()/put_user() instead of the unchecked variants
  ARM: OABI: use scoped user access in epoll_put_uevent()
  ARM: signal: stop using __put_user() for the signal frame
  ARM: signal: check the FDPIC function descriptor address
  alpha: split the prefetch check in do_page_fault() by mode
  openrisc: use get_kernel_nofault() in show_registers()
  alpha: use get_kernel_nofault() in dik_show_code()
  nios2: use scoped user access for the signal frame
  nios2: check the signal frame address before writing to it
  hexagon: use scoped user access for the signal frame
  alpha: use scoped user access when setting up signal frames
  alpha: use scoped user access in the sigreturn path
  alpha: use scoped user access in osf_sigaction()
  ...
2026-10-21 07:19:30 -10:00
..
adp drm/adp: Drop the select of the nonexistent CONFIG_DRM_KMS_DMA_HELPER 2026-09-08 15:36:03 +02:00
amd drm/amdgpu/sdma3: Work around POLL_REGMEM / FENCE hang 2026-10-15 12:46:58 -04:00
arm drm/arm/komeda: fix error handling for clk_prepare_enable() and callers 2026-06-30 15:26:54 +01:00
armada
aspeed drm/aspeed: Balance the display clock enable on teardown 2026-10-01 14:40:38 +02:00
ast drm/ast: create blend mode property on cursor plane 2026-09-08 15:12:26 +02:00
atmel-hlcdc
bridge drm/bridge: th1520-dw-hdmi: Fix remove() callback 2026-09-28 15:32:46 +08:00
ci drm/ci: Update xfails for kms_cursor_legacy regression 2026-09-09 09:58:16 -07:00
clients drm/client: fix restore of partially initialized client 2026-09-17 16:52:17 +02:00
display drm/dp: don't mark the AUX backlight enabled when enabling failed 2026-09-30 13:04:33 -07:00
etnaviv drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
exynos drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
fsl-dcu drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
gma500 drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
gud drm/gud: don't keep a connector without a CRTC as connector_state 2026-10-06 13:26:50 +01:00
hisilicon drm-misc-next for 7.3: 2026-07-07 09:34:04 +10:00
hyperv drm/hyperv: Move MODULE_DEVICE_TABLE to the device_id arrays 2026-07-20 10:33:49 -04:00
i915 drm/i915/gem: ignore errors on presumed_offset write-back 2026-10-21 07:13:59 -10:00
imagination drm/imagination: Size page table preallocation by device address 2026-10-08 10:32:31 +01:00
imx drm: fix missing header include for drm_panel_put() 2026-07-22 13:50:27 +02:00
ingenic drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
kmb
lima Linux 7.2 2026-08-20 10:58:44 +10:00
logicvc drm/logicvc: Drop the select of the nonexistent CONFIG_DRM_KMS_DMA_HELPER 2026-09-08 15:36:18 +02:00
loongson drm/loongson: Create blend mode property for cursor plane 2026-09-17 15:12:26 +08:00
mcde drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
mediatek drm/mediatek: Fix ovl adaptor platform device leak 2026-10-01 23:06:43 +00:00
meson drm-misc-next for 7.3: 2026-07-07 09:34:04 +10:00
mgag200
msm vfs-7.4-rc1.file 2026-10-19 17:35:50 -10:00
mxsfb drm: fix missing header include for drm_panel_put() 2026-07-22 13:50:27 +02:00
nouveau drm/nouveau: Skip the Turing CE workaround object for non-GR channels 2026-10-08 18:14:46 -04:00
nova drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
omapdrm drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
panel Linux 7.2 2026-08-20 10:58:44 +10:00
panfrost Linux 7.2 2026-08-20 10:58:44 +10:00
panthor drm/panthor: fix immortalis condition 2026-10-14 16:57:52 +01:00
pl111 drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
qxl drm/qxl: create blend mode property on primary and cursor planes 2026-09-08 15:12:26 +02:00
radeon drm/radeon: Read the VRAM VBIOS signature with readb() 2026-10-01 17:18:05 -04:00
renesas drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
rockchip drm/rockchip: rk3066_hdmi: Add missing Kconfig selects 2026-09-03 18:19:49 +02:00
scheduler drm/sched: Fix virtual runtime race 2026-09-16 09:17:51 +02:00
sitronix
solomon drm/ssd130x: Add per-family update backlight logic 2026-08-06 14:55:55 +02:00
sprd Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
sti drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
stm drm: fix missing header include for drm_panel_put() 2026-07-22 13:50:27 +02:00
sun4i drm/sun4i: hdmi-phy: Fix H6 8-bit MPLL config at 594 MHz 2026-08-06 14:22:50 +08:00
sysfb Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
tegra Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
tests Linux 7.2 2026-08-20 10:58:44 +10:00
tidss drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
tilcdc treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
tiny Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
ttm drm/ttm: apply the swapout bulk_move fix to the intended condition 2026-09-10 18:01:41 +02:00
tve200 drm/tve200: add OF module alias for autoloading 2026-07-24 09:21:03 +02:00
tyr drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
udl
v3d Linux 7.2 2026-08-20 10:58:44 +10:00
vboxvideo drm/vboxvideo: create blend mode property on planes 2026-09-08 15:12:27 +02:00
vc4 drm/vc4: hdmi: Move packet RAM enable to PM runtime 2026-10-12 08:23:07 -03:00
verisilicon drm/verisilicon: remove ARGB formats from primary plane 2026-09-16 17:41:25 +08:00
vgem
virtio drm/virtio: Reset device before deleting virtqueues on freeze 2026-10-14 01:24:53 +03:00
vkms treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
vmwgfx drm/vmwgfx: Add blend mode property 2026-09-28 10:55:40 -04:00
xe configfs: Updates for v7.4 2026-10-20 16:25:43 -10:00
xen mm: introduce vma_get_page_prot() and use it 2026-08-06 18:57:03 -07:00
xlnx drm/xlnx: zynqmp_dp: Switch to atomic_create_state 2026-06-22 11:24:56 +02:00
drm_atomic_helper.c
drm_atomic_state_helper.c drm/atomic-state-helper: set pixel_blend_mode to prop default on reset 2026-09-02 15:40:52 -03:00
drm_atomic_uapi.c drm: Fix drm_pending_vblank_event leak in error path for out_fence_ptr 2026-09-11 11:14:50 -03:00
drm_atomic.c drm/bridge: rename drm_for_each_bridge_in_chain_scoped() to drm_for_each_bridge_in_chain() 2026-07-14 17:55:51 +02:00
drm_auth.c
drm_blend.c drm/drm_blend: allow blend mode property without PREMULTI 2026-07-14 19:22:48 +01:00
drm_bridge_helper.c
drm_bridge.c drm/bridge: Fix unlocked list access in drm_bridge_attach() 2026-09-30 12:49:01 +02:00
drm_buddy.c
drm_cache.c x86/cpu: Hide and rename static_cpu_has() 2026-07-06 21:34:26 -07:00
drm_client_event.c
drm_client_modeset.c
drm_client_sysrq.c
drm_client.c
drm_color_mgmt.c mm.git review status for mm-hotfixes-stable..mm-nonmm-stable 2026-06-21 13:20:19 -07:00
drm_colorop.c drm-misc-next for 7.3: 2026-07-06 17:38:49 +10:00
drm_connector.c drm-misc-next for 7.3: 2026-07-06 17:38:49 +10:00
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h
drm_crtc.c
drm_damage_helper.c
drm_debugfs_crc.c
drm_debugfs.c
drm_displayid_internal.h Merge drm/drm-next into drm-misc-next 2026-06-30 10:16:00 +02:00
drm_displayid.c
drm_draw_internal.h
drm_draw.c
drm_drv.c DRM Rust changes for v7.3-rc1 2026-08-10 14:48:11 +10:00
drm_dumb_buffers.c drm-misc-next for 7.3: 2026-07-06 17:38:49 +10:00
drm_edid_load.c
drm_edid.c Merge drm/drm-next into drm-misc-next 2026-06-30 10:16:00 +02:00
drm_eld.c
drm_encoder.c
drm_exec.c drm/exec: don't immediately add prelocked obj to array of locked objs 2026-10-14 13:57:14 +02:00
drm_fb_dma_helper.c
drm_fb_helper.c drm/fb-helper: defer setup when fbdev_probe() fails, not just on -EAGAIN 2026-10-01 14:36:09 +02:00
drm_fbdev_dma.c
drm_fbdev_shmem.c
drm_fbdev_ttm.c
drm_file.c
drm_flip_work.c
drm_format_helper.c
drm_format_internal.h
drm_fourcc.c
drm_framebuffer.c
drm_gem_atomic_helper.c
drm_gem_dma_helper.c mm: introduce vma_get_page_prot() and use it 2026-08-06 18:57:03 -07:00
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c
drm_gem.c drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
drm_gpusvm.c drm for 7.3-rc1 2026-08-21 08:41:00 -07:00
drm_gpuvm.c drm/gpuvm: Remove dead code 2026-07-03 23:32:55 +02:00
drm_internal.h
drm_ioc32.c
drm_ioctl.c drm: Guard DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 2026-07-07 14:57:10 +02:00
drm_kms_helper_common.c
drm_lease.c
drm_managed.c
drm_mipi_dbi.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c drm: use drm_warn() in validate_blend_mode_for_alpha_formats() 2026-08-14 14:43:23 +01:00
drm_mode_object.c
drm_modes.c drm/modes: Add DRM_MODE_MATCH_TIMINGS_VRR 2026-06-24 18:54:10 +03:00
drm_modeset_helper.c
drm_modeset_lock.c drm: remove dead WARN_ON NULL check after GFP_NOFAIL allocation 2026-08-05 11:20:13 -07:00
drm_of.c drm/panel: of_drm_find_panel() return a counted reference 2026-07-20 15:07:22 +02:00
drm_pagemap_util.c
drm_pagemap.c drm/pagemap: Fix folio allocation fallback and use-after-put 2026-09-02 12:25:32 -07:00
drm_panel_backlight_quirks.c drm/amd/display: Force PWM backlight on Lenovo Legion 5 15ARH05 2026-07-17 17:41:15 -04:00
drm_panel_orientation_quirks.c
drm_panel.c drm/panel: find_panel_by_fwnode() return a counted reference 2026-07-20 15:08:08 +02:00
drm_panic_qr.rs drm/panic: clean new clippy::needless_range_loop lint for Rust 1.100.0 2026-09-04 00:54:41 +02:00
drm_panic.c
drm_pci.c
drm_plane_helper.c
drm_plane.c
drm_prime.c drm/prime: use dma_buf_fd_install() to preserve export tracing 2026-08-24 14:19:43 +02:00
drm_print.c
drm_privacy_screen_x86.c
drm_privacy_screen.c
drm_probe_helper.c drm: Send per-connector hotplug events 2026-07-21 17:06:42 +01:00
drm_property.c
drm_ras_genl_family.c
drm_ras_nl.c
drm_ras_nl.h
drm_ras.c
drm_rect.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_suballoc.c
drm_syncobj.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank_helper.c
drm_vblank_work.c
drm_vblank.c
drm_vma_manager.c
drm_writeback.c
Kconfig
Kconfig.debug
Makefile gpu: build nova-core and nova-drm from drivers/gpu/Makefile 2026-06-29 11:28:38 +02:00