Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754664Ab1EWMLt (ORCPT ); Mon, 23 May 2011 08:11:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50734 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426Ab1EWMLs (ORCPT ); Mon, 23 May 2011 08:11:48 -0400 Date: Mon, 23 May 2011 14:10:11 +0200 From: Oleg Nesterov To: Denys Vlasenko Cc: Tejun Heo , jan.kratochvil@redhat.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, indan@nul.nu Subject: Re: Ptrace documentation, draft #1 Message-ID: <20110523121011.GA5799@redhat.com> References: <201105152235.32073.vda.linux@googlemail.com> <20110516153122.GA15856@redhat.com> <20110519194908.GA26584@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1824 Lines: 47 On 05/20, Denys Vlasenko wrote: > > On Thu, May 19, 2011 at 9:49 PM, Oleg Nesterov wrote: > > Once again, PTRACE_KILL == ptrace(PTRACE_CONT, SIGKILL), except it > > doesn't return the error if the tracee is not stopped. > > Oleg, this doesn't explain the resulting behavior in terms understandable > to mere mortals. *What will happen* when user does ptrace(PTRACE_KILL)? > > Yes, it's obvious that the tracee gets SIGKILLed, No, it is not necessarily killed. Once again, it is equivalent to PTRACE_CONT except it returns 0 (but does nothing) if the tracee is not stopped. "does nothing" is not 100% true, it does wake_up_process() but this shouldn't be documented, this should be fixed. > >> >> ??? can this SIGTRAP be distinguished from "real" user-generated SIGTRAP > >> >> ? ? by looking at its siginfo? > >> > > >> > Afaics no. Well, except .si_pid shows that the signal was sent by the > >> > tracing process to itself. > >> > >> What about si_code? Is it set to SI_KERNEL for this signal? > > > > No, SI_USER. > > This is stupid. This signal is sent by kernel. Why is it flagged as "from user"? > Maybe we should change it? Well, may be... I dunno actually. Hmm. On a second thought you are probably right. ptrace_report_syscall() does send_sig() too, but it sets SI_KERNEL. I am starting to think, at least they should use the same si_code. > (BTW, where is it generated in the kernel source? I found > PTRACE_EVENT_EXEC generation, but failed to find > "old-school SIGTRAP" generation code...) tracehook_report_exec()->send_sig(SIGTRAP). Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/