All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RFC 8/8] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag
Date: Wed, 08 Jul 2026 16:26:28 +0000	[thread overview]
Message-ID: <20260708162628.C3B6B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-drm-reset-state-flag-v1-8-c37dc985485d@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] The newly added DRM_MODE_ATOMIC_RESET flag allows userspace to crash the kernel by unconditionally dereferencing an unimplemented `atomic_create_state` hook on CRTCs, planes, and connectors.
- [High] The DRM_MODE_ATOMIC_RESET flag bypasses DRM lease boundaries, allowing a restricted client to reset all displays on the device.
--

--- Patch [8]: [PATCH RFC 8/8] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag ---
commit f7802a930a44f2b2c525a72c03344afc1a5cba57
Author: Sebastian Wick <sebastian.wick@redhat.com>
Subject: drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag

Introduce DRM_MODE_ATOMIC_RESET (0x0800) which, when passed to the
atomic ioctl, fills the commit with default states for all KMS objects
before applying the properties supplied in the request. The flag cannot
be combined with DRM_MODE_PAGE_FLIP_ASYNC.

> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 1050dddadb17e..cdcc6efb9a00f 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
[ ... ]
> @@ -1675,6 +1682,12 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	fence_state = NULL;
>  	num_fences = 0;
>  
> +	if (arg->flags & DRM_MODE_ATOMIC_RESET) {
> +		ret = drm_atomic_commit_fill_with_defaults(state);

[Severity: Critical]
Can this cause a NULL pointer dereference for drivers that don't implement the
atomic_create_state hook?

When userspace passes DRM_MODE_ATOMIC_RESET, this calls
drm_atomic_commit_fill_with_defaults(), which unconditionally calls the
atomic_create_state hook for CRTCs, planes, and connectors:

drivers/gpu/drm/drm_atomic.c:drm_atomic_commit_fill_with_defaults() {
	...
	drm_for_each_crtc(crtc, dev) {
		...
		crtc_state = crtc->funcs->atomic_create_state(crtc);
		...
	}
	...
}

If a driver doesn't implement this optional hook, will this dereference a NULL
pointer?


[Severity: High]
Does this bypass DRM lease boundaries?

When called here, drm_atomic_commit_fill_with_defaults() iterates globally over
all CRTCs, planes, and connectors on the device without checking file_priv or
enforcing lease boundaries.

Could a restricted client use this flag to break lease isolation and forcibly
reset or turn off all displays on the system?

> +		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/20260708-drm-reset-state-flag-v1-0-c37dc985485d@kernel.org?part=8

  reply	other threads:[~2026-07-08 16:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 16:08 [PATCH RFC 0/8] drm: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 1/8] drm/atomic: colorop: Rename state to state_to_destroy Maxime Ripard
2026-07-08 16:16   ` sashiko-bot
2026-07-08 16:08 ` [PATCH RFC 2/8] drm/atomic: Create function to insert CRTC state into a commit Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 3/8] drm/atomic: Create function to insert plane " Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 4/8] drm/atomic: Create function to insert colorop " Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 5/8] drm/atomic: Create function to insert private obj " Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 6/8] drm/atomic: Create function to insert connector " Maxime Ripard
2026-07-08 16:08 ` [PATCH RFC 7/8] drm/atomic: Allow filling a commit with pristine object states Maxime Ripard
2026-07-08 16:24   ` sashiko-bot
2026-07-08 16:08 ` [PATCH RFC 8/8] drm/atomic-uapi: Add DRM_MODE_ATOMIC_RESET flag Maxime Ripard
2026-07-08 16:26   ` sashiko-bot [this message]
2026-07-08 18:25 ` [PATCH RFC 0/8] drm: " Xaver Hugl
2026-07-10 17:01 ` Michel Dänzer
2026-07-13  7:11   ` Maxime Ripard

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=20260708162628.C3B6B1F000E9@smtp.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.