From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECDB0C2B9F4 for ; Sat, 26 Jun 2021 03:24:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF3F76113A for ; Sat, 26 Jun 2021 03:24:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbhFZD0b (ORCPT ); Fri, 25 Jun 2021 23:26:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhFZD03 (ORCPT ); Fri, 25 Jun 2021 23:26:29 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9053C061767 for ; Fri, 25 Jun 2021 20:24:06 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id b3so5711552plg.2 for ; Fri, 25 Jun 2021 20:24:06 -0700 (PDT) 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= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZYiH9nK6crmHzzEefhGaKJK98dSESEicqRD9TcJugLA=; b=blr161Z4RskHvIj1h2ZNFc2/FKgXJ1tqwyGeyTxTkVTEEMM6xl7hoXAHvXbBxAgpQ7 Ahsjt+/SYegeGE2z9FJ4L5FNTCnjyZ4zxfMfhTwJwq6fmQ0JvYuqWim2nWVjow9ALk3g Wpy6rL+wW1woap00Njgq0o6HWL6JXX9i3iUKTjnGbxqCTyQ0X8bzRQu6Gp3FJAm/kG+U 067eILHjWsVAJDm8uYQGvW6rrvlMJKsNs4CeIwKHHAciFX6EQKDK/N4DMv0kizWIjYXo TrFgMQ5YjOWokjKdJ8KTv0QXcYwowAFeY6N0dP4/IRDV2EDy5uqlYrTmuGwU1E1a97Pg 1Lhw== X-Gm-Message-State: AOAM530+cLypuKdU1efLDe/cYik448J2SQjCbhhvScJYIb5viVfVpekP Cd2DX61m0eAx6uges0JAQB000g== X-Google-Smtp-Source: ABdhPJzaO+QEnFQnNol01zQxJCk+8I37gEbzWkLNj3gUl/PIejMlM+53/MOUevmSyYRVKywcyg4+IA== X-Received: by 2002:a17:902:e850:b029:127:a2ed:9924 with SMTP id t16-20020a170902e850b0290127a2ed9924mr8346735plg.57.1624677846193; Fri, 25 Jun 2021 20:24:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k7sm1724628pfp.65.2021.06.25.20.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 20:24:05 -0700 (PDT) Date: Fri, 25 Jun 2021 20:24:04 -0700 From: Kees Cook 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 Subject: Re: [PATCH 4/9] signal: Factor start_group_exit out of complete_signal 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87czsb6q9r.fsf_-_@disp2133> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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