Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2429295imj; Mon, 18 Feb 2019 05:58:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IZVm02ibh4x2YkO+yaMf99sJ2wK/KT9QS4FXtDgzgo+BlHYGiF2e60OrCYO0VC9WluVdqJW X-Received: by 2002:a62:e519:: with SMTP id n25mr24182855pff.151.1550498301892; Mon, 18 Feb 2019 05:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498301; cv=none; d=google.com; s=arc-20160816; b=MALrXaj+iMDrUEVTH6mPAAypmbnR+wROQu8Dgo9vlrr1Bqzty2wuJ6OmzJeE3vvl4S gKbZRvmGR1BzplGHiW9grIC0wTO5/lGsNQBIasoLID/wg8JKYrdpSo1vcGmIHiUG+jNG s2S+FhB2P11YEj+VAu7XJ3X1DWGFhR7gJWJrCOqiIAD96wraO4ybEz+Igo9M2Au6ROPA czpaiW+aWkNgEWEyVdAWPfCBueyvgxhds7qTPW8pX73WiyJ5iz4FN683op28vkZKfcPr 8B8jRrVYe5iClXfRq6aX5r2XFcN9ymofHWESAO79P8wj/vaGbiGpG7RIBv8H/Rg5m6pK Wpsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r0GvNdCHN1EvCnPwQcGBPfZgLfLyZxOrvKwQO11GjD0=; b=OxlQquLIX9VLLqeYrgb76b5+WCjL77hAQ/oaCf2vyrlvDfQyoxe0STHMfbmeNo1rtD A++RRq3ehOdZZGG48bdjRGW8ulbrkW9xmBKZoQ9J6g+rs74CEpxzTzxqU1b1Yn4KHInq UDZIb1jPP7vQPiMYE2So4U6GItQjjJgRxPocJ/vjuf4nausNMZ0vi/Xj9gx/asXAWt1+ 3yC/XHCZkLjy6kfj++jF3baVbZz9QxyFW0BjoDTjnaxydDi23aDYL+JvGbh0Lvzg8fL0 D0XP+jMvP5dX+cMf5CCPvPY8p+NXg7UEMZvDir9r9K9vdplvseSn9cXJ+9X4u78f9UIU SoDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1XNPgsjm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12223983pfz.86.2019.02.18.05.58.06; Mon, 18 Feb 2019 05:58:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1XNPgsjm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732408AbfBRN4i (ORCPT + 99 others); Mon, 18 Feb 2019 08:56:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:36848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730949AbfBRN4g (ORCPT ); Mon, 18 Feb 2019 08:56:36 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 10A062077B; Mon, 18 Feb 2019 13:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498195; bh=DTLFsRnA83Z9uEdRks2Gm+ZSlt1B8b0rM/4tOPI7ls8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XNPgsjmdch60nU+xhsD6CYAqfyxN0UCvGIVlwqpcSigbNxULNUMhbGIf0/z6LR55 kaFooWXt/YvoNE4aZXockOOihjZWt1ja1AC435/EarBnS3BgxDCAqTGjmLnrAMB/us /nOVxO2deY122m0yW2IFAZQoLXPeMZLF6KykUMBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleg Nesterov , Ivan Delalande , "Eric W. Biederman" Subject: [PATCH 4.14 54/62] signal: Restore the stop PTRACE_EVENT_EXIT Date: Mon, 18 Feb 2019 14:44:00 +0100 Message-Id: <20190218133510.407139360@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric W. Biederman commit cf43a757fd49442bc38f76088b70c2299eed2c2f upstream. In the middle of do_exit() there is there is a call "ptrace_event(PTRACE_EVENT_EXIT, code);" That call places the process in TACKED_TRACED aka "(TASK_WAKEKILL | __TASK_TRACED)" and waits for for the debugger to release the task or SIGKILL to be delivered. Skipping past dequeue_signal when we know a fatal signal has already been delivered resulted in SIGKILL remaining pending and TIF_SIGPENDING remaining set. This in turn caused the scheduler to not sleep in PTACE_EVENT_EXIT as it figured a fatal signal was pending. This also caused ptrace_freeze_traced in ptrace_check_attach to fail because it left a per thread SIGKILL pending which is what fatal_signal_pending tests for. This difference in signal state caused strace to report strace: Exit of unknown pid NNNNN ignored Therefore update the signal handling state like dequeue_signal would when removing a per thread SIGKILL, by removing SIGKILL from the per thread signal mask and clearing TIF_SIGPENDING. Acked-by: Oleg Nesterov Reported-by: Oleg Nesterov Reported-by: Ivan Delalande Cc: stable@vger.kernel.org Fixes: 35634ffa1751 ("signal: Always notice exiting tasks") Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- kernel/signal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2268,9 +2268,12 @@ relock: } /* Has this task already been marked for death? */ - ksig->info.si_signo = signr = SIGKILL; - if (signal_group_exit(signal)) + if (signal_group_exit(signal)) { + ksig->info.si_signo = signr = SIGKILL; + sigdelset(¤t->pending.signal, SIGKILL); + recalc_sigpending(); goto fatal; + } for (;;) { struct k_sigaction *ka;