From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387354; b=ijsKEpNMvEMJo6Iw/bUjxwoMGZ0fkksjzFDRyVXP03icdgZC48Ryusids1Sb6OFbLRqD /2fwZmLQMkXldkF/ey5dUESIDt+U0Z0EtiGWCSl0JTi0Qh3j5jIorg0VSkAkEdEolAAd1 wE5aA2Hel7BEAo/mwD+NQiRC+RFNgqFuTPuYvBDz5VLEZaOQci3sZa+1v9i6Ry5W/7/lh qbO3NajEb6QyTee0gEbtflsfSbtPDgO+GB7rJf+fYAfTbagYypmsx3BfbeeuSUuJbEYBX isqm29Ra3XIEWXF7X46dYyoWE3P+XdCuRfjaILTxaadxLMDnT457NNll+JIbVj/VPLg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387354; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=8hIg2IWbm0onnfIKqpgi8Lbq6MdvaAB4khWaNOBBCTI=; b=QtjPl74CByk9TegUgOxi6UU3M2FCOc120V9hPE/EQ/iH3cf3lMRq3pJpYXYqfRrGD1vc r/Ewk3Dz4ywSbw882DhmXiqtOh9RfIOnwZdGR9ZXmtm+LeL0xuXlXPSjzbyQlIFbsRSho 0OWzbLYCLj5pRo6XU3JxQSjKYVnK5ylukQSodKYBC0E3+Ci0gDTs5/LquF2sE1KERl1iM N4bpwrfYt/o6vBFktVO75/W9tY/YQhYZDgXL4fHYIRQwoF+DaTVO0D/Fo/NJEI1uA4luu JyzIMGgwLjSnGTLT+KGwleCzVoABDAIRS25vThyGCcPq7gD77F/XbfA4ewkPE2KfkEw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Z051rkxT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92848606A322; Fri, 4 Dec 2026 12:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Z051rkxT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EEBB1F000C2; Fri, 4 Dec 2026 12:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387354; bh=8hIg2IWbm0onnfIKqpgi8Lbq6MdvaAB4khWaNOBBCTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Z051rkxTyp3Dl0dHkDjTJ5pY3URM1cY/22kiAUEi13t0O2kg4jUv2MgoiryT8ZMN7 U/HhRXkcKFJwyMscVCnS6kAefEZa2vYGDuwb8CRRVhASwjT4uoDsZILs0mUWCOePYp VDzZOMySWTTOUox2Xa0UFCjoyiKIFwAA08Y62RVs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oleg Nesterov , "Christian Brauner (Amutable)" , Sasha Levin Subject: [PATCH 6.1 0210/1059] ptrace: refuse to change the signal mask of a user worker Date: Fri, 4 Dec 2026 18:55:41 +0900 Message-ID: <20261204100649.715109096@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Brauner [ Upstream commit cabc249e6560bee7bdfee9fbcb7ce4e951dcfd41 ] A user worker is created with every signal other than SIGKILL and SIGSTOP blocked. It never runs user code and that mask is what keeps get_signal() from dequeuing anything else for it. complete_signal() never picks a thread that blocks the signal, tkill() queues on the worker but nothing dequeues it. ptrace_signal() requeues an injected signal that the tracee blocks. PTRACE_SETSIGMASK is the only way to change that mask from the outside. A tracer that clears it makes the worker eligible for every signal. Whatever the worker then dequeues it can only act on by leaving. Refuse PTRACE_SETSIGMASK for a user worker with -EPERM, the way ptrace_attach() refuses a kernel thread. A worker is guaranteed to only ever dequeue SIGKILL or SIGSTOP and an injected signal stays pending on it, which is what already happens when the mask isn't touched. Taking the request and quietly leaving the mask alone was the other option, the way set_current_blocked() keeps SIGKILL and SIGSTOP unblocked whatever userspace asks for. But then a tracer gets success back with nothing changed and no way to tell that apart from a mask that took effect. Fixes: e8b33b8cfafc ("Revert "kernel: treat PF_IO_WORKER like PF_KTHREAD for ptrace/signals"") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260921-work-coredump-fixes-v3-9-8e4adb1619e6@kernel.org Acked-by: Oleg Nesterov Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Sasha Levin --- kernel/ptrace.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 435848809ebcd..5bedbeb3eaf6d 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -1105,6 +1105,12 @@ int ptrace_request(struct task_struct *child, long request, case PTRACE_SETSIGMASK: { sigset_t new_set; + /* A user worker only ever takes SIGKILL and SIGSTOP. */ + if (child->flags & PF_USER_WORKER) { + ret = -EPERM; + break; + } + if (addr != sizeof(sigset_t)) { ret = -EINVAL; break; -- 2.53.0