From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pedro Alves Subject: Re: Compat 32-bit syscall entry from 64-bit task!? Date: Thu, 26 Jan 2012 09:51:10 +0000 Message-ID: <4F21220E.9080404@redhat.com> References: <20120125193635.GA30311@redhat.com> <201201260032.57937.vda.linux@googlemail.com> <20120126005901.GC18613@jl-vm1.vm.bytemark.co.uk> <4F210D9B.3030808@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Pedro Alves , Jamie Lokier , Oleg Nesterov , Linus Torvalds , Indan Zupancic , Andi Kleen , Andrew Lutomirski , Will Drewry , linux-kernel@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, serge.hallyn@canonical.com, coreyb@linux.vnet.ibm.com, pmoore@redhat.com, eparis@redhat.com, djm@mindrot.org, segoon@openwall.com, rostedt@goodmis.org, jmorris@namei.org, scarybeasts@gmail.com, avi@redhat.com, penberg@cs.helsinki.fi, viro@zeniv.linux.org.uk, mingo@elte.hu, akpm@linux-foundation.org, khilman@ti.com, borislav.petkov@amd.com, amwang@redhat.com, ak@linux.intel.com, eric.dumazet@gmail.com, gregkh@suse.de, dhowells@redhat.com, daniel.lezcano@free.fr, linux-fsdevel@vger.kernel.org, linux-security-mod To: Denys Vlasenko Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 01/26/2012 08:53 AM, Denys Vlasenko wrote: > On Thu, Jan 26, 2012 at 9:23 AM, Pedro Alves wrote: >> On 01/26/2012 12:59 AM, Jamie Lokier wrote: >>> Tracers mainly want to know if it's a 32-bit or 64-bit syscall, not >>> whether it's compat as such. >> >> Another idea, avoiding new PTRACE_EVENTs per arch, would be to make >> the abi32/abi64/compat/whatnot discriminator retrievable with PTRACE_GETEVENTMSG >> instead. So you'd get PTRACE_EVENT_SYSCALL_ENTRY|EXIT, or the regular old >> 0x80|SIGTRAP, you'd still fetch the syscall number from $orig_ax (or whatever means >> for other archs), as usual, then have extra syscall info in PTRACE_GETEVENTMSG. >> I don't know if it'd be simple to make it possible to do PTRACE_GETEVENTMSG >> on a 0x80|SIGTRAP trap, but I imagine it so. >> >> -> wait >> <- 0x80|SIGTRAP (or PTRACE_EVENT_SYSCALL_ENTRY) >> -> read regs, find out syscall number >> -> PTRACE_GETEVENTMSG, figure out which entry mode was used. > > This would require additional ptrace op per syscall entry. > Linus' method and event method wouldn't. Yes. In any case, ptrace events leave recording the state in core files behind; possibly also important for userspace c/r. Linus' method or a new regset don't have that drawback. A new regset requires an additional ptrace op too, while the former abuses an architecture register, possibly leading to headaches later on. -- Pedro Alves