* [PATCH v2] drm/sched: Don't crash kernel on wrong params
@ 2025-11-12 9:18 Philipp Stanner
2025-11-12 9:46 ` Tvrtko Ursulin
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stanner @ 2025-11-12 9:18 UTC (permalink / raw)
To: Matthew Brost, Philipp Stanner, Christian König,
Maarten Lankhorst, tursulin
Cc: dri-devel, linux-kernel
drm_sched_job_arm() just panics the kernel with BUG_ON() in case of an
entity being NULL. If the entity is NULL, subsequent accesses will crash
the particular CPU anyways with a NULL pointer exception backtrace.
Remove the BUG_ON().
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
Changes in v2:
- Drop BUG_ON() instead of replacing it. (Tvrtko)
---
drivers/gpu/drm/scheduler/sched_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 1d4f1b822e7b..05eb50d4cf08 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -857,7 +857,6 @@ void drm_sched_job_arm(struct drm_sched_job *job)
struct drm_gpu_scheduler *sched;
struct drm_sched_entity *entity = job->entity;
- BUG_ON(!entity);
drm_sched_entity_select_rq(entity);
sched = entity->rq->sched;
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/sched: Don't crash kernel on wrong params
2025-11-12 9:18 [PATCH v2] drm/sched: Don't crash kernel on wrong params Philipp Stanner
@ 2025-11-12 9:46 ` Tvrtko Ursulin
2025-11-12 12:09 ` Philipp Stanner
0 siblings, 1 reply; 3+ messages in thread
From: Tvrtko Ursulin @ 2025-11-12 9:46 UTC (permalink / raw)
To: Philipp Stanner, Matthew Brost, Christian König,
Maarten Lankhorst
Cc: dri-devel, linux-kernel
On 12/11/2025 09:18, Philipp Stanner wrote:
> drm_sched_job_arm() just panics the kernel with BUG_ON() in case of an
> entity being NULL. If the entity is NULL, subsequent accesses will crash
> the particular CPU anyways with a NULL pointer exception backtrace.
>
> Remove the BUG_ON().
>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>
> ---
> Changes in v2:
> - Drop BUG_ON() instead of replacing it. (Tvrtko)
The option of removing the BUG_ON was conditional on brainstorming a bit
whether we think the null pointer dereference is the worst that can
happen or not.
Other option was "WARN_ON_ONCE() return" in arm and push.
Problem being, if we allow it to continue, are we opening up the
possibly to mess up the kernel in a worse way.
For example push job writes to the entity. Okay offsets are low so is
the zero page always safe to write? I don't know but sounds scary. From
that point of view BUG_ON or WARN_ON_ONCE with exit are safer options.
Regards,
Tvrtko
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 1d4f1b822e7b..05eb50d4cf08 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -857,7 +857,6 @@ void drm_sched_job_arm(struct drm_sched_job *job)
> struct drm_gpu_scheduler *sched;
> struct drm_sched_entity *entity = job->entity;
>
> - BUG_ON(!entity);
> drm_sched_entity_select_rq(entity);
> sched = entity->rq->sched;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/sched: Don't crash kernel on wrong params
2025-11-12 9:46 ` Tvrtko Ursulin
@ 2025-11-12 12:09 ` Philipp Stanner
0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stanner @ 2025-11-12 12:09 UTC (permalink / raw)
To: Tvrtko Ursulin, Philipp Stanner, Matthew Brost,
Christian König, Maarten Lankhorst
Cc: dri-devel, linux-kernel
On Wed, 2025-11-12 at 09:46 +0000, Tvrtko Ursulin wrote:
>
> On 12/11/2025 09:18, Philipp Stanner wrote:
> > drm_sched_job_arm() just panics the kernel with BUG_ON() in case of an
> > entity being NULL. If the entity is NULL, subsequent accesses will crash
> > the particular CPU anyways with a NULL pointer exception backtrace.
> >
> > Remove the BUG_ON().
> >
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
> > ---
> > Changes in v2:
> > - Drop BUG_ON() instead of replacing it. (Tvrtko)
>
> The option of removing the BUG_ON was conditional on brainstorming a bit
> whether we think the null pointer dereference is the worst that can
> happen or not.
>
> Other option was "WARN_ON_ONCE() return" in arm and push.
>
Maybe even WARN_ON() is OK to make it noticable.
I mostly care about getting rid of BUG_ON().
P.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-12 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-12 9:18 [PATCH v2] drm/sched: Don't crash kernel on wrong params Philipp Stanner
2025-11-12 9:46 ` Tvrtko Ursulin
2025-11-12 12:09 ` Philipp Stanner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox