lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c443e90d-6907-4a02-bab4-c1943f021a8c@kernel.org>
Date: Tue, 27 Aug 2024 10:39:44 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Philipp Stanner <pstanner@...hat.com>
Cc: Luben Tuikov <ltuikov89@...il.com>,
 Matthew Brost <matthew.brost@...el.com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
 David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
 Christian König <christian.koenig@....com>,
 dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
 stable@...r.kernel.org
Subject: Re: [PATCH] drm/sched: Fix UB pointer dereference

On 8/27/24 9:45 AM, Philipp Stanner wrote:
> In drm_sched_job_init(), commit 56e449603f0a ("drm/sched: Convert the
> GPU scheduler to variable number of run-queues") implemented a call to
> drm_err(), which uses the job's scheduler pointer as a parameter.
> job->sched, however, is not yet valid as it gets set by
> drm_sched_job_arm(), which is always called after drm_sched_job_init().
> 
> Since the scheduler code has no control over how the API-User has
> allocated or set 'job', the pointer's dereference is undefined behavior.
> 
> Fix the UB by replacing drm_err() with pr_err().
> 
> Cc: <stable@...r.kernel.org>	# 6.7+
> Fixes: 56e449603f0a ("drm/sched: Convert the GPU scheduler to variable number of run-queues")
> Reported-by: Danilo Krummrich <dakr@...hat.com>
> Closes: https://lore.kernel.org/lkml/20231108022716.15250-1-dakr@redhat.com/
> Signed-off-by: Philipp Stanner <pstanner@...hat.com>
> ---
>   drivers/gpu/drm/scheduler/sched_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 7e90c9f95611..356c30fa24a8 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -797,7 +797,7 @@ int drm_sched_job_init(struct drm_sched_job *job,
>   		 * or worse--a blank screen--leave a trail in the
>   		 * logs, so this can be debugged easier.
>   		 */
> -		drm_err(job->sched, "%s: entity has no rq!\n", __func__);
> +		pr_err("*ERROR* %s: entity has no rq!\n", __func__);

I don't think the "*ERROR*" string is necessary, it's pr_err() already.

Otherwise,

Acked-by: Danilo Krummrich <dakr@...nel.org>

>   		return -ENOENT;
>   	}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ