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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1725AC433EF for ; Mon, 2 May 2022 08:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383982AbiEBJCn (ORCPT ); Mon, 2 May 2022 05:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349574AbiEBJCi (ORCPT ); Mon, 2 May 2022 05:02:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 398E058381; Mon, 2 May 2022 01:59:10 -0700 (PDT) Date: Mon, 2 May 2022 10:59:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651481948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tE8bHALEKS0L2/v1Lp1llDGgaerV2t8eIdyy202maEg=; b=R8GqeD4q9yGtuxW10I/6RxqT3yBABJzLKUsEwMR6w1rlwYx96USpyN8JR1qYEgZVMNP70d mTboi/rIU00uQUoE0VPAhwacfpX1ARTnpv9xo+yi8VyPCbWwV4LBLz31VmTXteCsUPc4hp rng2xpol+ZmzFUzyefKgvuaCW3He3PDJ/0dguqft93CTZeotAQdJrPjMS1OxLeLgGnwNHk xPajG0v/C4xu8nJjVy8o4dEk++3uxrEXMF/NWtNHX+PBuxOUCNp303oGxHhdLfTQQPXti+ VIWalHOEJDTLHKrNQFspJW6cbVrEBMoDzivBRkab4oqCavSqgH9vplpT6cz/kw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651481948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tE8bHALEKS0L2/v1Lp1llDGgaerV2t8eIdyy202maEg=; b=8KSodmjQOQccxvmMaJUizCpTDmLEa00B/0Ux39kqbRMt2i0qlX3JZb6P4UdPvLliDVLdOF cQjmiDyNH3INWcAQ== From: Sebastian Andrzej Siewior To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, Oleg Nesterov , mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, Will Deacon , tj@kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linux-ia64@vger.kernel.org Subject: Re: [PATCH v2 07/12] ptrace: Don't change __state Message-ID: References: <87k0b7v9yk.fsf_-_@email.froward.int.ebiederm.org> <20220429214837.386518-7-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220429214837.386518-7-ebiederm@xmission.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-04-29 16:48:32 [-0500], Eric W. Biederman wrote: > Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace > command is executing. > > Instead TASK_WAKEKILL from the definition of TASK_TRACED, and > implemention a new jobctl flag TASK_PTRACE_FROZEN. This new This new Instead adding TASK_WAKEKILL to the definition of TASK_TRACED, implement a new jobctl flag TASK_PTRACE_FROZEN for this. This new > flag is set in jobctl_freeze_task and cleared when ptrace_stop is > awoken or in jobctl_unfreeze_task (when ptrace_stop remains asleep). > > In singal_wake_up add __TASK_TRACED to state along with TASK_WAKEKILL signal_wake_up > when it is indicated a fatal signal is pending. Skip adding +that ? > __TASK_TRACED when TASK_PTRACE_FROZEN is not set. This has the same > effect as changing TASK_TRACED to __TASK_TRACED as all of the wake_ups , > that use TASK_KILLABLE go through signal_wake_up. , > Don't set TASK_TRACED if fatal_signal_pending so that the code > continues not to sleep if there was a pending fatal signal before > ptrace_stop is called. With TASK_WAKEKILL no longer present in > TASK_TRACED signal_pending_state will no longer prevent ptrace_stop > from sleeping if there is a pending fatal signal. > > Previously the __state value of __TASK_TRACED was changed to > TASK_RUNNING when woken up or back to TASK_TRACED when the code was > left in ptrace_stop. Now when woken up ptrace_stop now clears > JOBCTL_PTRACE_FROZEN and when left sleeping ptrace_unfreezed_traced > clears JOBCTL_PTRACE_FROZEN. > > Signed-off-by: "Eric W. Biederman" Sebastian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRti-000UWS-N5 for linux-um@lists.infradead.org; Mon, 02 May 2022 08:59:16 +0000 Date: Mon, 2 May 2022 10:59:06 +0200 From: Sebastian Andrzej Siewior Subject: Re: [PATCH v2 07/12] ptrace: Don't change __state Message-ID: References: <87k0b7v9yk.fsf_-_@email.froward.int.ebiederm.org> <20220429214837.386518-7-ebiederm@xmission.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220429214837.386518-7-ebiederm@xmission.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, Oleg Nesterov , mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, Will Deacon , tj@kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linux-ia64@vger.kernel.org On 2022-04-29 16:48:32 [-0500], Eric W. Biederman wrote: > Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace > command is executing. > > Instead TASK_WAKEKILL from the definition of TASK_TRACED, and > implemention a new jobctl flag TASK_PTRACE_FROZEN. This new This new Instead adding TASK_WAKEKILL to the definition of TASK_TRACED, implement a new jobctl flag TASK_PTRACE_FROZEN for this. This new > flag is set in jobctl_freeze_task and cleared when ptrace_stop is > awoken or in jobctl_unfreeze_task (when ptrace_stop remains asleep). > > In singal_wake_up add __TASK_TRACED to state along with TASK_WAKEKILL signal_wake_up > when it is indicated a fatal signal is pending. Skip adding +that ? > __TASK_TRACED when TASK_PTRACE_FROZEN is not set. This has the same > effect as changing TASK_TRACED to __TASK_TRACED as all of the wake_ups , > that use TASK_KILLABLE go through signal_wake_up. , > Don't set TASK_TRACED if fatal_signal_pending so that the code > continues not to sleep if there was a pending fatal signal before > ptrace_stop is called. With TASK_WAKEKILL no longer present in > TASK_TRACED signal_pending_state will no longer prevent ptrace_stop > from sleeping if there is a pending fatal signal. > > Previously the __state value of __TASK_TRACED was changed to > TASK_RUNNING when woken up or back to TASK_TRACED when the code was > left in ptrace_stop. Now when woken up ptrace_stop now clears > JOBCTL_PTRACE_FROZEN and when left sleeping ptrace_unfreezed_traced > clears JOBCTL_PTRACE_FROZEN. > > Signed-off-by: "Eric W. Biederman" Sebastian _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Andrzej Siewior Date: Mon, 02 May 2022 08:59:06 +0000 Subject: Re: [PATCH v2 07/12] ptrace: Don't change __state Message-Id: List-Id: References: <87k0b7v9yk.fsf_-_@email.froward.int.ebiederm.org> <20220429214837.386518-7-ebiederm@xmission.com> In-Reply-To: <20220429214837.386518-7-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, Oleg Nesterov , mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, Will Deacon , tj@kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Kees Cook , Jann Horn , linux-ia64@vger.kernel.org On 2022-04-29 16:48:32 [-0500], Eric W. Biederman wrote: > Stop playing with tsk->__state to remove TASK_WAKEKILL while a ptrace > command is executing. > > Instead TASK_WAKEKILL from the definition of TASK_TRACED, and > implemention a new jobctl flag TASK_PTRACE_FROZEN. This new This new Instead adding TASK_WAKEKILL to the definition of TASK_TRACED, implement a new jobctl flag TASK_PTRACE_FROZEN for this. This new > flag is set in jobctl_freeze_task and cleared when ptrace_stop is > awoken or in jobctl_unfreeze_task (when ptrace_stop remains asleep). > > In singal_wake_up add __TASK_TRACED to state along with TASK_WAKEKILL signal_wake_up > when it is indicated a fatal signal is pending. Skip adding +that ? > __TASK_TRACED when TASK_PTRACE_FROZEN is not set. This has the same > effect as changing TASK_TRACED to __TASK_TRACED as all of the wake_ups , > that use TASK_KILLABLE go through signal_wake_up. , > Don't set TASK_TRACED if fatal_signal_pending so that the code > continues not to sleep if there was a pending fatal signal before > ptrace_stop is called. With TASK_WAKEKILL no longer present in > TASK_TRACED signal_pending_state will no longer prevent ptrace_stop > from sleeping if there is a pending fatal signal. > > Previously the __state value of __TASK_TRACED was changed to > TASK_RUNNING when woken up or back to TASK_TRACED when the code was > left in ptrace_stop. Now when woken up ptrace_stop now clears > JOBCTL_PTRACE_FROZEN and when left sleeping ptrace_unfreezed_traced > clears JOBCTL_PTRACE_FROZEN. > > Signed-off-by: "Eric W. Biederman" Sebastian