From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 12/14] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
Date: Fri, 16 Oct 2026 07:54:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-173979@kernel.org> (raw)
In-Reply-To: <20261016-drm-reset-state-flag-v5-12-dad2d64b693b@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm: DRM_MODE_ATOMIC_RESET bypasses DRM lease isolation
- [High] drm/amdgpu: UAF via active plane state destruction during DRM_MODE_ATOMIC_RESET
--
commit db28ec4a7c576dd0db5528bab59644c439286807
Author: Sebastian Wick <sebastian.wick@redhat.com>
drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
Userspace currently has no atomic way to reset all KMS object states
to their defaults. To bring a display pipeline to a known state, a
compositor must explicitly set every property on every object, which
requires tracking which properties exist and what their defaults are.
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 1eebcf6f5e05b..237c7ff823523 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
[ ... ]
> @@ -1688,6 +1695,17 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
> fence_state = NULL;
> num_fences = 0;
>
> + if (arg->flags & DRM_MODE_ATOMIC_RESET) {
> + if (!drm_atomic_implements_create_state(dev)) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> +
> + ret = drm_atomic_commit_fill_with_defaults(state);
[Severity: High]
Does this new reset path allow a client with a DRM lease to bypass lease
isolation?
When a leased DRM client calls this IOCTL with DRM_MODE_ATOMIC_RESET,
drm_atomic_commit_fill_with_defaults() blindly adds every device object
to the state with its default values without validating ownership via
drm_lease_held().
This could allow an unprivileged containerized app or VR compositor to
globally disable all displays and objects on the device, including those
owned by the host compositor.
[Severity: High]
Does this expose a Use-After-Free in the AMDGPU driver's plane state
creation?
This function iterates over all planes and calls the driver's
->atomic_create_state() hook to allocate default states.
In AMDGPU, it unconditionally destroys the currently bound state if it
exists:
amdgpu_dm_plane.c:amdgpu_dm_plane_drm_plane_create_state() {
...
if (plane->state)
plane->funcs->atomic_destroy_state(plane, plane->state);
...
}
Because the state is still actively used by the DRM framework and display
hardware until the atomic commit is completely swapped (or if the commit is
rejected entirely), destroying it here leaves a dangling pointer.
Since this reset path is now user-reachable via the new DRM_MODE_ATOMIC_RESET
ioctl flag, could userspace trigger a kernel panic or data corruption?
> + if (ret)
> + goto out;
> + }
> +
> for (i = 0; i < arg->count_objs; i++) {
> uint32_t obj_id, count_props;
> struct drm_mode_object *obj;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-drm-reset-state-flag-v5-0-dad2d64b693b@kernel.org?part=12
next prev parent reply other threads:[~2026-10-16 7:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 7:31 [PATCH v5 00/14] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 01/14] drm/atomic: Switch to krealloc_array() in drm_atomic_get_private_obj_state() Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 02/14] drm/atomic: Use __GFP_ZERO instead of explicit memset " Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 03/14] drm/atomic: Use __GFP_ZERO instead of explicit memset in drm_atomic_get_connector_state() Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 04/14] drm/atomic: Create function to insert CRTC state into a commit Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 05/14] drm/atomic: Create function to insert plane " Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 06/14] drm/atomic: Create function to insert colorop " Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 07/14] drm/atomic: Create function to insert private obj " Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 08/14] drm/atomic: Create function to insert connector " Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 09/14] drm/atomic: Add drm_atomic_implements_create_state() helper Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 10/14] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 11/14] drm/tests: atomic: Add tests for drm_atomic_commit_fill_with_defaults() Maxime Ripard
2026-10-16 7:52 ` sashiko-bot
2026-10-16 7:31 ` [PATCH v5 12/14] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-10-16 7:54 ` sashiko-bot [this message]
2026-10-16 7:31 ` [PATCH v5 13/14] drm/vkms: Switch container_of helpers to container_of_const Maxime Ripard
2026-10-16 7:31 ` [PATCH v5 14/14] drm/vkms: Add driver-specific plane property for testing Maxime Ripard
2026-10-16 7:49 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-173979@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.