Oleg Nesterov c01266b0ca posix-cpu-timers: fix race between handle_posix_cpu_timers() and posix_cpu_timer_del()
If an exiting non-autoreaping task has already passed exit_notify() and
calls handle_posix_cpu_timers() from IRQ, it can be reaped by its parent
or debugger right after unlock_task_sighand().

If a concurrent posix_cpu_timer_del() runs at that moment, it won't be
able to detect timer->it.cpu.firing != 0: cpu_timer_task_rcu() and/or
lock_task_sighand() will fail.

Add the tsk->exit_state check into run_posix_cpu_timers() to fix this.

This fix is not needed if CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y, because
exit_task_work() is called before exit_notify(). But the check still
makes sense, task_work_add(&tsk->posix_cputimers_work.work) will fail
anyway in this case.

Cc: stable@vger.kernel.org
Reported-by: Benoît Sevens <bsevens@google.com>
Fixes: 0bdd2ed4138e ("sched: run_posix_cpu_timers: Don't check ->exit_state, use lock_task_sighand()")
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2026-02-04 16:39:14 +08:00
2026-02-04 16:38:56 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2026-02-04 16:38:56 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 16:03:32 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 16:03:32 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00
2025-02-13 14:11:16 +08:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.
S
Description
No description provided
Readme
260 MiB
Languages
C 97.6%
Assembly 1%
Shell 0.5%
Python 0.3%
Makefile 0.3%