Skip to content

Commit b21c3b1

Browse files
author
CKI KWF Bot
committed
Merge: uprobes: Fix race in uprobe_free_utask
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7506 JIRA: https://issues.redhat.com/browse/RHEL-120479 Fix kernel panic occurring in perf user callchain code. The reason for that is the race between `uprobe_free_utask` and bpf profiler code doing the perf user stack unwind and is triggered within `uprobe_free_utask` function: - after `current->utask` is freed and - before `current->utask` is set to NULL See commit message for more details, stack trace, and reproducer. Signed-off-by: Viktor Malik <vmalik@redhat.com> Approved-by: Jay Shin <jaeshin@redhat.com> Approved-by: Gregory Bell <grbell@redhat.com> Approved-by: Jerome Marchand <jmarchan@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 6ae406c + b3a33b4 commit b21c3b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/uprobes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,7 @@ void uprobe_free_utask(struct task_struct *t)
17201720
if (!utask)
17211721
return;
17221722

1723+
t->utask = NULL;
17231724
if (utask->active_uprobe)
17241725
put_uprobe(utask->active_uprobe);
17251726

@@ -1729,7 +1730,6 @@ void uprobe_free_utask(struct task_struct *t)
17291730

17301731
xol_free_insn_slot(t);
17311732
kfree(utask);
1732-
t->utask = NULL;
17331733
}
17341734

17351735
/*

0 commit comments

Comments
 (0)