From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750924AbdDAFRS (ORCPT ); Sat, 1 Apr 2017 01:17:18 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:34418 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750792AbdDAFRQ (ORCPT ); Sat, 1 Apr 2017 01:17:16 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Oleg Nesterov Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org References: <20170213141452.GA30203@redhat.com> <20170224160354.GA845@redhat.com> <87shmv6ufl.fsf@xmission.com> <20170303173326.GA17899@redhat.com> <87tw7axlr0.fsf@xmission.com> <87d1dyw5iw.fsf@xmission.com> <87tw7aunuh.fsf@xmission.com> <87lgsmunmj.fsf_-_@xmission.com> <20170304170312.GB13131@redhat.com> <8760ir192p.fsf@xmission.com> Date: Sat, 01 Apr 2017 00:11:58 -0500 In-Reply-To: <8760ir192p.fsf@xmission.com> (Eric W. Biederman's message of "Thu, 30 Mar 2017 03:07:42 -0500") Message-ID: <878tnkpv8h.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cuBPS-0008Nx-Na;;;mid=<878tnkpv8h.fsf_-_@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.234.240;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18QpzQC9Oc/IWY7lLs7vMI3ZATcdqBIXT4= X-SA-Exim-Connect-IP: 67.3.234.240 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4999] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 T_XMHurry_00 Hurry and Do Something * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 400 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.8 (1.0%), b_tie_ro: 2.6 (0.6%), parse: 1.35 (0.3%), extract_message_metadata: 3.8 (1.0%), get_uri_detail_list: 1.22 (0.3%), tests_pri_-1000: 6 (1.6%), tests_pri_-950: 1.76 (0.4%), tests_pri_-900: 1.48 (0.4%), tests_pri_-400: 23 (5.7%), check_bayes: 21 (5.3%), b_tokenize: 8 (2.0%), b_tok_get_all: 6 (1.4%), b_comp_prob: 2.5 (0.6%), b_tok_touch_all: 2.7 (0.7%), b_finish: 0.78 (0.2%), tests_pri_0: 342 (85.5%), check_dkim_signature: 0.59 (0.1%), check_dkim_adsp: 3.8 (1.0%), tests_pri_500: 4.1 (1.0%), rewrite_mail: 0.00 (0.0%) Subject: [RFC][PATCH 0/2] exec: Fixing ptrace'd mulit-threaded hang X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I spent a little more time with this and only waiting until the killed thread are zombies (and not reaped as we do today) really looks like the right fix. Oleg the following two patches work on top of your PTRACE_EVENT_EXIT change and probably need a little more cleanup until they are ready for serious posting. That said I want to I want to post the code so I have a change at some feedback before I prepare the final round of patches. These patches only handle the case when sighand_struct is not shared between different multi-threaded processes. The general case is solvable but that is a quite a bit more code. Eric W. Biederman (2): sighand: Count each thread group once in sighand_struct exec: If possible don't wait for ptraced threads to be reaped fs/exec.c | 15 ++++++++++----- include/linux/sched/signal.h | 2 +- kernel/exit.c | 15 ++++++++++----- kernel/fork.c | 6 ++++-- kernel/signal.c | 8 ++++++-- 5 files changed, 31 insertions(+), 15 deletions(-) Eric From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: [RFC][PATCH 0/2] exec: Fixing ptrace'd mulit-threaded hang Date: Sat, 01 Apr 2017 00:11:58 -0500 Message-ID: <878tnkpv8h.fsf_-_@xmission.com> References: <20170213141452.GA30203@redhat.com> <20170224160354.GA845@redhat.com> <87shmv6ufl.fsf@xmission.com> <20170303173326.GA17899@redhat.com> <87tw7axlr0.fsf@xmission.com> <87d1dyw5iw.fsf@xmission.com> <87tw7aunuh.fsf@xmission.com> <87lgsmunmj.fsf_-_@xmission.com> <20170304170312.GB13131@redhat.com> <8760ir192p.fsf@xmission.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <8760ir192p.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> (Eric W. Biederman's message of "Thu, 30 Mar 2017 03:07:42 -0500") Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Oleg Nesterov Cc: Andrew Morton , Aleksa Sarai , Andy Lutomirski , Attila Fazekas , Jann Horn , Kees Cook , Michal Hocko , Ulrich Obergfell , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-api@vger.kernel.org I spent a little more time with this and only waiting until the killed thread are zombies (and not reaped as we do today) really looks like the right fix. Oleg the following two patches work on top of your PTRACE_EVENT_EXIT change and probably need a little more cleanup until they are ready for serious posting. That said I want to I want to post the code so I have a change at some feedback before I prepare the final round of patches. These patches only handle the case when sighand_struct is not shared between different multi-threaded processes. The general case is solvable but that is a quite a bit more code. Eric W. Biederman (2): sighand: Count each thread group once in sighand_struct exec: If possible don't wait for ptraced threads to be reaped fs/exec.c | 15 ++++++++++----- include/linux/sched/signal.h | 2 +- kernel/exit.c | 15 ++++++++++----- kernel/fork.c | 6 ++++-- kernel/signal.c | 8 ++++++-- 5 files changed, 31 insertions(+), 15 deletions(-) Eric