mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
posix-timers: Move posixtimer_exec_cleanup() out of exec.c
Move it to the POSIX timer code and provide a proper stub when POSIX timers are disabled in Kconfig. No functional change. Signed-off-by: Thomas Gleixner <tglx@kernel.org> Tested-by: Kijo Park <red993688@gmail.com> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Link: https://patch.msgid.link/20260911090541.680668094@kernel.org
This commit is contained in:
parent
acb03d3881
commit
7117334f02
13
fs/exec.c
13
fs/exec.c
|
|
@ -1115,17 +1115,6 @@ static struct file *bprm_identity_file(const struct linux_binprm *bprm)
|
|||
return bprm->file;
|
||||
}
|
||||
|
||||
static void posixtimer_exec(struct task_struct *me)
|
||||
{
|
||||
#ifdef CONFIG_POSIX_TIMERS
|
||||
spin_lock_irq(&me->sighand->siglock);
|
||||
posix_cpu_timers_exit(me);
|
||||
spin_unlock_irq(&me->sighand->siglock);
|
||||
exit_itimers(me);
|
||||
flush_itimer_signals();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Calling this is the point of no return. None of the failures will be
|
||||
* seen by userspace since either the process is already taking a fatal
|
||||
|
|
@ -1171,7 +1160,7 @@ int begin_new_exec(struct linux_binprm * bprm)
|
|||
* timer would not remove an enqueued timer because the TID lookup
|
||||
* of the old TID fails.
|
||||
*/
|
||||
posixtimer_exec(me);
|
||||
posixtimer_exec();
|
||||
|
||||
/* see the comment in check_unsafe_exec() */
|
||||
current->fs->in_exec = 0;
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
|
|||
int update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
|
||||
|
||||
#ifdef CONFIG_POSIX_TIMERS
|
||||
void posixtimer_exec(void);
|
||||
|
||||
static inline void posixtimer_putref(struct k_itimer *tmr)
|
||||
{
|
||||
if (rcuref_put(&tmr->rcuref))
|
||||
|
|
@ -259,6 +261,7 @@ static inline bool posixtimer_valid(const struct k_itimer *timer)
|
|||
return !(val & 0x1UL);
|
||||
}
|
||||
#else /* CONFIG_POSIX_TIMERS */
|
||||
static inline void posixtimer_exec(void) { }
|
||||
static inline void posixtimer_sigqueue_getref(struct sigqueue *q) { }
|
||||
static inline void posixtimer_sigqueue_putref(struct sigqueue *q) { }
|
||||
#endif /* !CONFIG_POSIX_TIMERS */
|
||||
|
|
|
|||
|
|
@ -1120,6 +1120,15 @@ void exit_itimers(struct task_struct *tsk)
|
|||
}
|
||||
}
|
||||
|
||||
void posixtimer_exec(void)
|
||||
{
|
||||
scoped_guard(spinlock_irq, ¤t->sighand->siglock)
|
||||
posix_cpu_timers_exit(current);
|
||||
|
||||
exit_itimers(current);
|
||||
flush_itimer_signals();
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
|
||||
const struct __kernel_timespec __user *, tp)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user