From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751926AbdFFTMj (ORCPT ); Tue, 6 Jun 2017 15:12:39 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:49893 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbdFFTMg (ORCPT ); Tue, 6 Jun 2017 15:12:36 -0400 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Ingo Molnar , Thomas Gleixner , Kees Cook , Roland McGrath , Al Viro , David Howells , "Michael Kerrisk (man-pages)" , "Eric W. Biederman" Date: Tue, 6 Jun 2017 14:03:22 -0500 Message-Id: <20170606190338.28347-10-ebiederm@xmission.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170606190338.28347-1-ebiederm@xmission.com> References: <877f0pym71.fsf@xmission.com> <20170606190338.28347-1-ebiederm@xmission.com> X-XM-SPF: eid=1dIJtw-0006wd-O0;;;mid=<20170606190338.28347-10-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.121.81.159;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+JyZoY2PbK6JFf8wYI40UzNFnzJkooPCM= X-SA-Exim-Connect-IP: 97.121.81.159 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 * 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.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 5576 ms - load_scoreonly_sql: 0.27 (0.0%), signal_user_changed: 6 (0.1%), b_tie_ro: 3.7 (0.1%), parse: 2.9 (0.1%), extract_message_metadata: 32 (0.6%), get_uri_detail_list: 2.4 (0.0%), tests_pri_-1000: 14 (0.2%), tests_pri_-950: 2.7 (0.0%), tests_pri_-900: 2.2 (0.0%), tests_pri_-400: 32 (0.6%), check_bayes: 30 (0.5%), b_tokenize: 12 (0.2%), b_tok_get_all: 7 (0.1%), b_comp_prob: 4.2 (0.1%), b_tok_touch_all: 2.9 (0.1%), b_finish: 0.89 (0.0%), tests_pri_0: 385 (6.9%), check_dkim_signature: 1.08 (0.0%), check_dkim_adsp: 5 (0.1%), tests_pri_500: 5090 (91.3%), poll_dns_idle: 5072 (90.9%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 10/26] ptrace: Simplify ptrace_detach & exit_ptrace 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 in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call __ptrace_unlink not __ptrace_detach. As it is guaranteed that ptrace_detach will never be called on a process that has or may exit. Rename __ptrace_detach __exit_ptrace as exit_ptrace is now it's only caller and the corrected name is less confusing. Signed-off-by: "Eric W. Biederman" --- kernel/ptrace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 266ddcc1d8bb..490333db9e21 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -495,7 +495,7 @@ static int ignoring_children(struct sighand_struct *sigh) * reap it now, in that case we must also wake up sub-threads sleeping in * do_wait(). */ -static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p) +static bool __exit_ptrace(struct task_struct *tracer, struct task_struct *p) { bool dead; @@ -539,7 +539,7 @@ static int ptrace_detach(struct task_struct *child, unsigned int data) * the comment in ptrace_resume(). */ child->exit_code = data; - __ptrace_detach(current, child); + __ptrace_unlink(child); write_unlock_irq(&tasklist_lock); proc_ptrace_connector(child, PTRACE_DETACH); @@ -559,7 +559,7 @@ void exit_ptrace(struct task_struct *tracer, struct list_head *dead) if (unlikely(p->ptrace & PT_EXITKILL)) send_sig_info(SIGKILL, SEND_SIG_FORCED, p); - if (__ptrace_detach(tracer, p)) + if (__exit_ptrace(tracer, p)) list_add(&p->ptrace_entry, dead); } } -- 2.10.1