From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754124AbdCNC5l (ORCPT ); Mon, 13 Mar 2017 22:57:41 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:36928 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752696AbdCNC5j (ORCPT ); Mon, 13 Mar 2017 22:57:39 -0400 Date: Tue, 14 Mar 2017 05:57:35 +0300 From: "Dmitry V. Levin" To: Andrew Lutomirski Cc: Elvira Khabirova , Denys Vlasenko , Linus Torvalds , Indan Zupancic , Oleg Nesterov , Andi Kleen , Jamie Lokier , Will Drewry , Kees Cook , John Johansen , pmoore@redhat.com, Eric Paris , djm@mindrot.org, segoon@openwall.com, Steven Rostedt , James Morris , Chris Evans , Avi Kivity , penberg@cs.helsinki.fi, Al Viro , Ingo Molnar , Andrew Morton , Andi Kleen , Eric Dumazet , dhowells@redhat.com, daniel.lezcano@free.fr, Linux FS Devel , linux-security-module , olofj@chromium.org, Michael Halcrow , Roland McGrath , linux-kernel@vger.kernel.org Subject: Re: Compat 32-bit syscall entry from 64-bit task!? Message-ID: <20170314025735.GA18046@altlinux.org> References: <201201260032.57937.vda.linux@googlemail.com> <201201260209.54513.vda.linux@googlemail.com> <20170308234154.GA2352@altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=x-unknown; protocol="application/pgp-signature"; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 08, 2017 at 08:39:55PM -0800, Andrew Lutomirski wrote: > On Wed, Mar 8, 2017 at 3:41 PM, Dmitry V. Levin wrote: [...] > > Is there any progress with this (or any alternative) solution? > > > > I see the kernel side has changed a bit, and the strace part > > is in a better shape than 5 years ago (although I'm biased of course), > > but I don't see any kernel interface that would allow strace to reliably > > recognize this 0x80 case. >=20 > I am strongly opposed to fudging registers to half-arsedly slightly > improve the epicly crappy ptrace(2) interface for syscalls. >=20 > To fix this right, please just add PTRACE_GET_SYSCALL_INFO or similar > to, in one shot, read out all the syscall details. This means: arch, > no, arg0..arg5, and *whether it's entry or exit*. I propose returning > this structure: >=20 > struct ptrace_syscall_info { > u8 op; /* 0 for entry, 1 for exit */ > u8 pad0; > u16 pad1; > u32 pad2; > union { > struct seccomp_data syscall_entry; > s64 syscall_exit_retval; > }; > }; >=20 > because struct seccomp_data already gets this right. There's plenty > of opportunity to fine-tune this. Now it works on all architectures. Unfortunately, the API is missing. Unlike syscall_get_nr(), syscall_get_arch() works with the current task only so there is no API to get the arch identifier for the given task that would work on all architectures. --=20 ldv --HcAYCG3uE/tztfnV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJYx1wfAAoJEAVFT+BVnCUIE0YQAMwBNQ238H2WqEt6Jf5lZsuF SU78iSKLaJ7/riNyGC7Ja0/jsB68ZpoTPAnmWePMeejOtWeT1MaeeLTCZ0AC1flT sdA0fWv57ACp4fz+VkHXnz660B3EaV2BkP/chQYrvgWWcUAhAVvf1215eEp+IPK3 6KIngZsE4MQ4tJbz+y6FTz7AGp949lCvDLsSkHhbhl+7hvO2R76282jB0ncNu2Pu ylWZVLlNo0kvMbqy0e+qKLy64X0qPJaiw5R5UzBrsWcbU2iXC3srUBGi1Xt9rVqF X71YRj2lgFqDp3RjEpbxdE2IbcyTtI5pvN+ZFPMqdzWxNsar34FlMgsldWU8MvUl 9IHO5ZaJti0an3udQ5f6848JX66NFdor19yn8nkdGLGKIOKxSOxxLLbAuishKkFW xjKv5G4mg1YHIfHmryz1fGetl7gZM4Qd2pmKTQCke4xcGv5DuiaoOdnGHhbHQBuG aBegwGqzbzIQMB5c30VlkMM/kELNw9uM+lBImILoc4u5Qkp0/1KG4T2ZQK12je6S crL2vQIKqu2tFCshdmg/jI0T4pfYebkgNbK0kP6TrDmipB5BBGF4z6Vnfj2ZUODy UE1MoDlZwStgtWAbZ4ao7zv0ObOSJk8whNEVRmaHDViEwmneqf9R4PFyCGVMAYz0 63n+4cfLrfhQ5TUAbXRp =U4Bx -----END PGP SIGNATURE----- --HcAYCG3uE/tztfnV--