From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: Re: [PATCH 4/9] signal: Factor start_group_exit out of complete_signal Date: Fri, 25 Jun 2021 20:24:04 -0700 Message-ID: <202106252022.79A9A1A@keescook> References: <87a6njf0ia.fsf@disp2133> <87tulpbp19.fsf@disp2133> <87zgvgabw1.fsf@disp2133> <875yy3850g.fsf_-_@disp2133> <87czsb6q9r.fsf_-_@disp2133> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZYiH9nK6crmHzzEefhGaKJK98dSESEicqRD9TcJugLA=; b=DcagL9ukyAri4GHOF/R0Zf3Iu0Lo6msYVkx5FGprR+PMGBy9p9RQixD9ErVc1gzXH6 mSli7Te1XBpclsd+1tAr6ijhr8hce6Hp3XBsdEJyda/f94I0H+WZ5DnF+oq1N6s+TGRd RJdvcGL/FQ4D2d/B27HhdT/IBBdxghruULKz4= Content-Disposition: inline In-Reply-To: <87czsb6q9r.fsf_-_@disp2133> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Eric W. Biederman" Cc: Linus Torvalds , Al Viro , Michael Schmitz , linux-arch , Jens Axboe , Oleg Nesterov , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Ley Foon Tan , Tejun Heo On Thu, Jun 24, 2021 at 02:01:20PM -0500, Eric W. Biederman wrote: > +static void start_group_exit_locked(struct signal_struct *signal, int exit_code) > +{ > + /* > + * Start a group exit and wake everybody up. > + * This way we don't have other threads > + * running and doing things after a slower > + * thread has the fatal signal pending. > + */ > + struct task_struct *t; > + > + signal->flags = SIGNAL_GROUP_EXIT; > + signal->group_exit_code = exit_code; > + signal->group_stop_count = 0; > + __for_each_thread(signal, t) { > + task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); > + > + /* Don't bother with already dead threads */ > + if (t->exit_state) > + continue; > + sigaddset(&t->pending.signal, SIGKILL); > + signal_wake_up(t, 1); > + } This both extracts it and changes it. For ease-of-review, maybe split this patch into the move and then the logic changes? -- Kees Cook