Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3200358imu; Fri, 23 Nov 2018 23:58:27 -0800 (PST) X-Google-Smtp-Source: AFSGD/V7Cg/8Ab4rDSqDSCbA8S95HewDkAGVC6lB6XaxvzdY4G8E1ICEJwvpIMiItpKiAEHgVZ4X X-Received: by 2002:a63:8441:: with SMTP id k62mr16953054pgd.392.1543046307277; Fri, 23 Nov 2018 23:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543046307; cv=none; d=google.com; s=arc-20160816; b=itCGiFXnDT7JTEXyDGuR6cqY53Vs9kOPADOOREZeKuZWzQDcfsrXh4cAbVY0p6ZX/O vhXxA5EiupXp9wBC87TnjmifnFAg7if/EpikrZ/xh4zRNL/2rY+KkkZAL+oeLWZCsDcO 46Kr4ciKmhBMnyABOr4Mua5NxdOdSOgbbvQ+6haDG0D/It+9c/CDFoth379H4jgAthh2 ZWxbBEy99Juk8lMltJ9BElrwe13rSvsar55y6Q68e/Mo66iEQNmXVNJogCanKEqyjPtB m1MV1/d0DXmRuvEzx/HRhXwQ9a+M9D0uEbRC5JzKNw4HApWSxiT8gt+FyH083G7ZMAsE OC+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Was99znkrhsjjKn//QPsSKZHr9bVzct2kwVhAAQyL/g=; b=eAc5lo/ceFFKTaTnEgupxCs9/Hmu6ai/1YatvfJ8OZhzpGPPsqmvYmdbSyRhmE0Cjq yiNmjn8G+ysfHWmA2KwhC/c9epT0E2lIn1RQbbJZZ4V2Mqox/c+wKTMgm6pE6zZ/V9DF IRA7U0MC3BMGAPQpxuovBQ82NYg07CL/2MOwWmYDtRPPVSEXf2kGQNq/TmlBQaSEC444 niaODm4eSCN3A6B/gPYrW2g8I7lkeR3az/nfgf6yNJYQMWZ1euEjXDCo1610LJK1ySCv +MyxwmmAEZ/F3w86vM7TeDYIgV7ilRBwVacKW8a0TN2xGTtjQBt1/Ar93/my04wvhfq6 XOhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si16704842pfv.181.2018.11.23.23.58.12; Fri, 23 Nov 2018 23:58:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408053AbeKWOoL (ORCPT + 99 others); Fri, 23 Nov 2018 09:44:11 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:55562 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730785AbeKWOoL (ORCPT ); Fri, 23 Nov 2018 09:44:11 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 7A5C672CC61; Fri, 23 Nov 2018 07:01:40 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 4A5727CD20A; Fri, 23 Nov 2018 07:01:40 +0300 (MSK) Date: Fri, 23 Nov 2018 07:01:40 +0300 From: "Dmitry V. Levin" To: Andy Lutomirski Cc: Elvira Khabirova , Kees Cook , Linux API , Jann Horn , Oleg Nesterov , Steven Rostedt , Ingo Molnar , LKML , Eugene Syromiatnikov , strace-devel@lists.strace.io Subject: Re: [RFC PATCH v2] ptrace: add PTRACE_GET_SYSCALL_INFO request Message-ID: <20181123040139.GB2572@altlinux.org> References: <20181121165806.07da7c98@akathisia> <20181121235634.GA14146@altlinux.org> <20181122191504.GB27204@altlinux.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ADZbWkCsHQ7r3kzd" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ADZbWkCsHQ7r3kzd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 22, 2018 at 04:19:10PM -0800, Andy Lutomirski wrote: > On Thu, Nov 22, 2018 at 11:15 AM Dmitry V. Levin wrote: > > > > On Thu, Nov 22, 2018 at 06:55:29AM -0800, Andy Lutomirski wrote: > > > On Wed, Nov 21, 2018 at 3:56 PM Dmitry V. Levin wrote: > > > > On Wed, Nov 21, 2018 at 02:56:57PM -0800, Andy Lutomirski wrote: > > > > > Please cc linux-api@vger.kernel.org for future versions. > > > > > > > > > > On Wed, Nov 21, 2018 at 7:58 AM Elvira Khabirova wrote: > > > > > > > > > > > > struct ptrace_syscall_info { > > > > > > __u8 op; /* 0 for entry, 1 for exit */ > > > > > > > > > > Can you add proper defines, like: > > > > > > > > > > #define PTRACE_SYSCALL_ENTRY 0 > > > > > #define PTRACE_SYSCALL_EXIT 1 > > > > > #define PTRACE_SYSCALL_SECCOMP 2 > > > > > > > > > > and make seccomp work from the start? I'd rather we don't merge = an > > > > > implementation that doesn't work for seccomp and then have to rew= ork > > > > > it later. > > > > > > > > What's the difference between PTRACE_EVENT_SECCOMP and syscall-entr= y-stop > > > > with regards to PTRACE_GET_SYSCALL_INFO request? At least they hav= e the > > > > same entry_info to return. > > > > > > I'm not sure there's any material difference. > > > > In that case we don't really need PTRACE_SYSCALL_SECCOMP: op field > > describes the structure inside the union to use, not the ptrace stop. >=20 > Unless we think the structures might diverge in the future. If these structures ever diverge, then a seccomp structure will be added to the union, and a portable userspace code will likely look this way: #include =2E.. struct ptrace_syscall_info info; long rc =3D ptrace(PTRACE_GET_SYSCALL_INFO, pid, (void *) sizeof(info), &in= fo); =2E.. switch (info.op) { case PTRACE_SYSCALL_INFO_ENTRY: /* handle info.entry */ case PTRACE_SYSCALL_INFO_EXIT: /* handle info.exit */ #ifdef PTRACE_SYSCALL_INFO_SECCOMP case PTRACE_SYSCALL_INFO_SECCOMP: /* handle info.seccomp */ #endif default: /* handle unknown info.op */ } In other words, it would be better if PTRACE_SYSCALL_INFO_* selector constants were introduced along with corresponding structures in the union. --=20 ldv --ADZbWkCsHQ7r3kzd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJb93ujAAoJEAVFT+BVnCUI2jsQAIepMxxYXPxMW/R7MJz1eL/2 c5Y/scQkQ/JhQBIk8trAhW6iNwfsVcmVy2JnhkkZ+ZPvsFg1QFTgPMySGWAwlUvo cHwhy4uGsiQ4gwiZTg1YSleIAQccIsq0+R6+dW2oHu9FuN7S72WfBtNnp+wLHdhH PsOHpHgfhr6vsUrCOrAzsmMNzhxu8+cgPT04y5dUNCREBrr3uoFKKy/5u7WykLqC 6A8ryanu8QJgM3jQ11N0gp0gds0VSzSDk60n8SHvhxaczqn1SEg40ZKfdQ57d/8F YBiWm3H5sLCodHYPW2cGpgcqNlTPrSAu1dC+p4rKITi3jdlCw6RUPQQ/vhSghEkE 2ioM+BtE180n7qRL1gMlYTXah34qOvW6FDiFjgp5TmXjbaG3FTn0wC4esCz9bGqJ MEvYiR6d6a6Ow4cpTL0OF5I1dTfy/HyJZToaiN/iYZ0UQAQamYYn4lx0ZX0NZKWj KxQXATYMmnR0/6W+uq26VwUs6pE8nNoKe2jR/um2QE/AjZe/zbWikIUrL+3s/dz7 znc4kYzzBIU97vEDSIyElVdH7eUbPDY1+ifNK/U/dAUtHfpcTmVmEt/ToDFAFb+V v6l1M+u1bGuCr6iL7GXgNHldCfCPFhjsF2QrfU/gAKDiqMkGi15V7/xg11czkQf9 FdOM5gtadWSiVdFuGO1m =+cWe -----END PGP SIGNATURE----- --ADZbWkCsHQ7r3kzd--