From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753460AbcIBM0Q (ORCPT ); Fri, 2 Sep 2016 08:26:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38502 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752213AbcIBM0P (ORCPT ); Fri, 2 Sep 2016 08:26:15 -0400 Date: Fri, 2 Sep 2016 14:25:39 +0200 From: Oleg Nesterov To: Ales Novak Cc: linux-kernel@vger.kernel.org, Andrew Morton , Jiri Kosina Subject: Re: [PATCH] ptrace: clear TIF_SYSCALL_TRACE on ptrace detach Message-ID: <20160902122538.GD26495@redhat.com> References: <20160901164613.GA13138@redhat.com> <1472759493-20554-1-git-send-email-alnovak@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1472759493-20554-1-git-send-email-alnovak@suse.cz> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 02 Sep 2016 12:26:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01, Ales Novak wrote: > > On __ptrace_detach(), called from do_exit()->exit_notify()-> > forget_original_parent()->exit_ptrace(), the TIF_SYSCALL_TRACE in > thread->flags of the tracee is not cleared up. This results in the > tracehook_report_syscall_* being called (though there's no longer a > tracer listening to that) upon its further syscalls. > > Example scenario - attach "strace" to a running process and kill it (the > strace) with SIGKILL. You'll see that the syscall trace hooks are still > being called. To clarify, this patch can't really fix the problem(s), The tracee can be killed by SIGTRAP in this case. Again, we do not care too much, a lot of bad things can happen if the tracer dies. But I agree, this patch makes the things better for free, Acked-by: Oleg Nesterov