lkml.org 
[lkml]   [2021]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch V4 2/2] signal: Allow tasks to cache one sigqueue struct
Date
On Tue, Mar 23 2021 at 19:04, Oleg Nesterov wrote:
> On 03/22, Thomas Gleixner wrote:
>> +static void sigqueue_cache_or_free(struct sigqueue *q, bool cache)
>> + if (q) {
>> + tsk->sigqueue_cache = NULL;
>> + /* If task is self reaping, don't cache it back */
>> + sigqueue_cache_or_free(q, tsk != current);
> ^^^^^^^^^^^^^^
> Still not right or I am totally confused.
>
> tsk != current can be true if an exiting (and autoreaping) sub-thread
> releases its group leader.
>
> IOW. Suppose a process has 2 threads, its parent ignores SIGCHLD.
>
> The group leader L exits. Then its sub-thread T exits too and calls
> release_task(T). In this case the tsk != current is false.
>
> But after that T calls release_task(L) and L != T is true.

Bah. yes.

> I'd suggest to free tsk->sigqueue_cache in __exit_signal() unconditionally and
> remove the "bool cache" argument from sigqueue_cache_or_free().

That's what you get from trying to be clever, dammit.

Thanks for walking me through the oddities of exit !

tglx

\
 
 \ /
  Last update: 2021-03-23 20:26    [W:0.075 / U:1.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site