lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250921081947.GC16684@1wt.eu>
Date: Sun, 21 Sep 2025 10:19:47 +0200
From: Willy Tarreau <w@....eu>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Benjamin Berg <benjamin@...solutions.net>, linux-um@...ts.infradead.org,
        linux-kselftest@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        linux-kernel@...r.kernel.org, Benjamin Berg <benjamin.berg@...el.com>
Subject: Re: [PATCH v2 10/11] tools/nolibc: add ptrace support

On Sat, Sep 20, 2025 at 11:27:19AM +0200, Thomas Weißschuh wrote:
> > +/*
> > + * long ptrace(int op, pid_t pid, void *addr, void *data);
> > + *
> > + * However, addr may also be an integer in some cases.
> 
> This comment is a bit confusing. It reads like it can be an integer as
> in 'int' datatype. But the kernel expects an integer compatible with
> 'void *', so 'unsigned long'. I think we can drop the comment.

Or if the point is to insist that void* is not strictly required, a
comment might as well say "types for addr and data are ignored and
will be cast to void*". But given that the man page indicates two
void*, I think that callers are expected to cast ints to void* in
any case, and if so maybe indeed not saying anything about it would
be better.

> > + */
> > +static __attribute__((unused))
> > +long sys_vptrace(int op, pid_t pid, va_list args)
> > +{
> > +	return my_syscall4(__NR_ptrace, op, pid,
> > +			   va_arg(args, void *), va_arg(args, void *));
> > +}
> > +
> > +static __attribute__((unused))
> > +ssize_t sys_ptrace(int op, pid_t pid, ...)
> 
> ptrace(2) does not document addr and data to be optional.
> While it does acknowledge the fact that it is variadic on glibc,
> users are still recommended to always supply all arguments.
> I'd prefer to keep it simple and avoid the va_list.

The man indeed says they are *ignored*, not optional. I agree then that
it would be better not doing simpler than the standard and have to roll
back later. Let's just pass unused arguments to the system.

Thanks,
Willy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ