lkml.org 
[lkml]   [2018]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 24/25] ptrace: add PTRACE_GET_SYSCALL_INFO request
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.

\
 
 \ /
  Last update: 2018-12-11 16:31    [W:0.100 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site