From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex =?utf-8?Q?Benn=C3=A9e?= Subject: Re: Exposing host debug capabilities to userspace Date: Fri, 21 Nov 2014 11:23:19 +0000 Message-ID: <87y4r4dcgo.fsf@linaro.org> References: <87mw7l3j7x.fsf@linaro.org> <20141121100823.GT19598@cbox> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Will Deacon , Marc Zyngier , Peter Maydell , Paolo Bonzini , kvmarm@slist.cs.columbia.edu, KVM devel mailing list To: Christoffer Dall Return-path: Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:46444 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbaKULXT (ORCPT ); Fri, 21 Nov 2014 06:23:19 -0500 In-reply-to: <20141121100823.GT19598@cbox> Sender: kvm-owner@vger.kernel.org List-ID: Christoffer Dall writes: > On Thu, Nov 20, 2014 at 04:55:14PM +0000, Alex Benn=C3=A9e wrote: >>=20 >> * ptrace(PTRACE_GETREGSET, NT_ARM_HW_WATCH) >>=20 >> This is used by GDB to access the host details in debug-monitors. >> However the ptrace API really wants you to attach to a process befor= e >> calling PTRACE_GETREGSET. Currently I've tried attaching to the >> thread_id of the vCPU but this fails with EPERM, I suspect because >> attaching to your own threads likely upsets the kernel. > > Can you confirm your suspicion? This seems like a rather good approa= ch > so we should really investigate why this doesn't work and explore way= s > to get it working. =46rom ptrace_attach: retval =3D -EPERM; if (unlikely(task->flags & PF_KTHREAD)) goto out; if (same_thread_group(task, current)) goto out; I think this is what is triggering my EPERM. I'm going to dig into the history of code around that bit. While I can see it might be undesirabl= e I'm not sure if it has to be verbotten... --=20 Alex Benn=C3=A9e