Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1679180pxv; Fri, 25 Jun 2021 20:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcJ4+dnPVOGKUggWxHaY8T6mnTc92jd/eymck7JpH52/qnuAtUyMyp7iap27EKEQCvOD+Z X-Received: by 2002:a05:6602:160d:: with SMTP id x13mr11103150iow.88.1624677893193; Fri, 25 Jun 2021 20:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624677893; cv=none; d=google.com; s=arc-20160816; b=VX6P65zje9iT2zuf/dYxj+tWSLBLG1XhF1dCYCcDH28SoojtS93qJ6rLxZfayM8iIs P1pxPobjZA1GcxmzlqsRw5X+vv+NVo9Dt3Ix9rVJY6zLjvKkqrUQ+HYFNyWc3UHpzkdP Yc7CM3fuAHr+o5imoMEYzQ2Hio1W8izP4/krQ6LDD0J4OZDqUO3SsRDPSu6lbcTr3zEW 09AGgKA3ljpvJ5kuNjWHtdRTTHgxY2r7K2JcYm1td14D/fZjiGNbwEU8nQDwLDJrtyT0 wfezKKpgwMIZlPQEOh48UZCmn+iWsu6cPxyB20Ar0j8v5W5GIs/Qe3N42HP1bSZJu1am +vOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZYiH9nK6crmHzzEefhGaKJK98dSESEicqRD9TcJugLA=; b=U7xZy/CEPwhM4/YTX/tf2/U6A0y3ISK/QCRuvU4qaqYg8Hos9wZT3qur1rpHj2Blv4 /tSxSGSTSJ3BYXSfmvdxxKSMAnWC5O/03ukhsHdQpqeM5n3lI5k2waoNQElC+GxMLaNt sKSc16PcUjCAkFPkHjhjNZvgj6GqHn4RUC2WR2y3C2bOGXjqsVCyZZZxAh4+qMdI7X8n RVLn7dI0spHp0/w6Yn0+C6Oi+k6uvwyPR2IwiwZ33Ryx1aDIYOWDXtrULBxZ9znQL97u g69xCHAxGovOQn2dQJrIfGjpUeKRrgmZI0q34NSh8JYVYoypgZoRdF5iXjei93zjX85x PfJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DcagL9uk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si7596524iow.92.2021.06.25.20.24.41; Fri, 25 Jun 2021 20:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DcagL9uk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbhFZD0a (ORCPT + 99 others); Fri, 25 Jun 2021 23:26:30 -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-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