Re: [patch V3 16/18] posix-timers: Dont iterate /proc/$PID/timers with sighand:: Siglock held
From: Cyrill Gorcunov
Date: Sat Mar 08 2025 - 17:39:09 EST
On Sat, Mar 08, 2025 at 05:48:45PM +0100, Thomas Gleixner wrote:
...
>
> static int show_timer(struct seq_file *m, void *v)
> {
> - struct k_itimer *timer;
> - struct timers_private *tp = m->private;
> - int notify;
> static const char * const nstr[] = {
> + [SIGEV_SIGNAL] = "signal",
> + [SIGEV_NONE] = "none",
> + [SIGEV_THREAD] = "thread",
> };
>
...
> - seq_printf(m, "notify: %s/%s.%d\n",
> - nstr[notify & ~SIGEV_THREAD_ID],
> + seq_printf(m, "notify: %s/%s.%d\n", nstr[notify & ~SIGEV_THREAD_ID],
> (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
> pid_nr_ns(timer->it_pid, tp->ns));
...
Btw this nstr[notify & ~SIGEV_THREAD_ID] has been always fishy since ~SIGEV_THREAD_ID
doesn't give a proper mask over nstr size :-) It just happen to work but if for some
reason ::it_sigev_notify get screwed we will get a surprise. I think later (not in this
series) we better provide an explicit bitwise mask here.
Cyrill