Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp783321imu; Tue, 11 Dec 2018 07:31:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/XKUgQla7WdAd6Miv3NUSNFvgVaqFEKPHFrXEFCjv9uuMPy4rt+sFAPueJONEqQHQPYjdi6 X-Received: by 2002:a63:5455:: with SMTP id e21mr15111108pgm.316.1544542295751; Tue, 11 Dec 2018 07:31:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544542295; cv=none; d=google.com; s=arc-20160816; b=UqwPORqIs8+9OxkrRd1ILUKFc6dw1mRacynBSsvoh8ZfYUeEEhLb6hZHsxuL0PBlj5 7+xQyaFHF9yOrUz754PGTc5i+xkNpqfFneDQ4Q7rVK2X2Cdmugo+4azUG4/UlchpSojn hkcFvOFYclQtHUyge/qydKE5doQBAVd6VcIgLEFWieJ+jCGO2EC2O/t8eGQNJF559XsG g/Jj+I5WcVQwqv1lfCy/r7SoEADOT/TDRIgnfSPPnd0OZGuiCRsrlQMuEcVxy2WBkgPh GARfnZOmeRteXHcyF4bGzNuReJVp77NmKc+KdAopsYcWrRFIpi61Ri0bm9XVbKy6wJ8e yjFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pSNK5baW6rPpouqtkD9njYPmeg4ni4OOi8+sD/xxPa0=; b=Yik9vZIg7IbjfXn1FG/IWE4WYFrXfnqnscJ3lYha5sKWFXjSVp3S/aNXh8xvPONh/5 U30NxRBO0LEosySXILCloaQvXon5pA9HjY+Bd1smaE92EV2eNHlEpSotIr/IPy6qEGbw komF9ZzUJ04Mg4y3L3ZTODi158gyUHlpbgLHFa2UiZR3UKksDty5uqyCJrSlAb2KZ3iT qRdENg3lq/daxAgkyIKub1uES8m4++ROETRKIypyrr3QvS/vrSraqG3pHQn5PosH5xo9 49dhrvdnB5YkFrrWDCyGk7RvCIU47ZJ3aFiOsIg7fLeMCGFJMqHYv/jgFIRxziuMtmus gw+Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c191si13491817pfg.72.2018.12.11.07.31.21; Tue, 11 Dec 2018 07:31:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727047AbeLKP35 (ORCPT + 99 others); Tue, 11 Dec 2018 10:29:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39235 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726839AbeLKP35 (ORCPT ); Tue, 11 Dec 2018 10:29:57 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04DAB3001582; Tue, 11 Dec 2018 15:29:57 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.131]) by smtp.corp.redhat.com (Postfix) with SMTP id 0FA15608F7; Tue, 11 Dec 2018 15:29:54 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 11 Dec 2018 16:29:56 +0100 (CET) Date: Tue, 11 Dec 2018 16:29:54 +0100 From: Oleg Nesterov To: "Dmitry V. Levin" Cc: Andy Lutomirski , Elvira Khabirova , Eugene Syromyatnikov , Kees Cook , Jann Horn , linux-api@vger.kernel.org, strace-devel@lists.strace.io, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 24/25] ptrace: add PTRACE_GET_SYSCALL_INFO request Message-ID: <20181211152953.GA8504@redhat.com> References: <20181210042352.GA6092@altlinux.org> <20181210043126.GX6131@altlinux.org> <20181210141107.GB4177@redhat.com> <20181210162131.GG14149@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181210162131.GG14149@altlinux.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 11 Dec 2018 15:29:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10, Dmitry V. Levin wrote: > > On Mon, Dec 10, 2018 at 03:11:07PM +0100, Oleg Nesterov wrote: > > On 12/10, Dmitry V. Levin wrote: > > > > > > +struct ptrace_syscall_info { > > > + __u8 op; /* PTRACE_SYSCALL_INFO_* */ > > > + __u8 __pad0[3]; > > > + __u32 arch; > > > + __u64 instruction_pointer; > > > + __u64 stack_pointer; > > > + __u64 frame_pointer; > > > + union { > > > + struct { > > > + __u64 nr; > > > + __u64 args[6]; > > > + } entry; > > > + struct { > > > + __s64 rval; > > > + __u8 is_error; > > > + __u8 __pad1[7]; > > > + } exit; > > > + struct { > > > + __u64 nr; > > > + __u64 args[6]; > > > + __u32 ret_data; > > > + __u8 __pad2[4]; > > > + } seccomp; > > > + }; > > > +}; > > > > Could you explain why ptrace_syscall_info needs __pad{0,1,2} ? I simply can't > > understand why... > > I suppose the idea behind the use of these pads was to make the structure > arch-independent. Still can't understand... are you saying that without (say) __pad2[4] sizeof(ptrace_syscall_info) or offsetofend(ptrace_syscall_info, seccomp) will depend on arch? Or what? I am just curious. > I don't think we really need to keep it exactly the same on all > architectures - the only practical requirement is to avoid any compat > issues, but I don't mind keeping the structure arch-independent. OK, but may be you can add a short comment to explain these pads. Oleg.