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: <20241127055610.7076-3-adamli@os.amperecomputing.com>
Date: Wed, 27 Nov 2024 05:56:09 +0000
From: Adam Li <adamli@...amperecomputing.com>
To: peterz@...radead.org,
	mingo@...hat.com,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	vschneid@...hat.com,
	linux-kernel@...r.kernel.org,
	patches@...erecomputing.com,
	cl@...ux.com,
	christian.loehle@....com,
	vineethr@...ux.ibm.com,
	Adam Li <adamli@...amperecomputing.com>
Subject: [PATCH v2 2/3] sched/fair: Fix panic if pick_eevdf() returns NULL

pick_eevdf() may return NULL, which triggers NULL pointer
dereference at pick_next_entity():
	struct sched_entity *se = pick_eevdf(cfs_rq);
	if (se->sched_delayed)

    [  297.371198] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000051
    [  297.406112] CPU: 116 UID: 0 PID: 10328 Comm: Grizzly-worker( Tainted: G        W   E      6.12.0.adam+ #1
    [  297.597362] Call trace:
    [  297.599795]  pick_task_fair+0x50/0x150 (P)
    [  297.603879]  pick_task_fair+0x50/0x150 (L)
    [  297.607963]  pick_next_task_fair+0x30/0x3c0
    [  297.612134]  __pick_next_task+0x4c/0x220
    [  297.616045]  pick_next_task+0x44/0x980
    [  297.619782]  __schedule+0x3d0/0x628
    [  297.623259]  do_task_dead+0x50/0x60
    [  297.626736]  do_exit+0x28c/0x410
    [  297.629955]  do_group_exit+0x3c/0xa0
    [  297.633518]  get_signal+0x8c4/0x8d0
    [  297.636996]  do_signal+0x9c/0x270
    [  297.640299]  do_notify_resume+0xe0/0x198
    [  297.644212]  el0_svc+0xf4/0x170
    [  297.647342]  el0t_64_sync_handler+0x10c/0x138
    [  297.651687]  el0t_64_sync+0x1ac/0x1b0
    [  297.655339] Code: d503201f 1400002a aa1403e0 97ffda0b (39414401)
    [  297.661439] ---[ end trace 0000000000000000 ]---
    [  297.726593] Kernel panic - not syncing: Oops: Fatal exception

Signed-off-by: Adam Li <adamli@...amperecomputing.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index cd1188b7f3df..d5a3b5589e4e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5623,7 +5623,7 @@ pick_next_entity(struct rq *rq, struct cfs_rq *cfs_rq)
 	}
 
 	struct sched_entity *se = pick_eevdf(cfs_rq);
-	if (se->sched_delayed) {
+	if (se && se->sched_delayed) {
 		dequeue_entities(rq, se, DEQUEUE_SLEEP | DEQUEUE_DELAYED);
 		/*
 		 * Must not reference @se again, see __block_task().
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ