[PATCH] Add SYSCALL_LONG/SYSCALL_ULONG to pass long to syscall [BZ #25810]

H.J. Lu hjl.tools@gmail.com
Sat Apr 11 13:26:08 GMT 2020


On Sat, Apr 11, 2020 at 3:01 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > For inline syscalls, SYSCALL_LONG and SYSCALL_ULONG are introduced as
> > wrappers for long and unsigned long arguments.
>
> Do the arguments have the correct types?  Then I think you can do the

Yes, they have correct types.  But it is not the problem.  Take this example:

int munmap(void *addr, size_t length);

The type of length is unsigned int (size_t) for x32 and is unsigned long
(64bit) in kernel.  We have no way to know the type which kernel expects.

> adjustment in the guts of INLINE_SYSCALL machinery, and we do not have
> to remember to annotate each and every call site with the new macros.
>
> Changes to sysdeps/unix/make-syscalls.sh and syscalls.list appear
> unavoidable, but I think tget should be made to the global Linux
> version, not the x32 variant, so that other targets with the same

Will do.

> issue can benefit from them.  (I have not reviewed the
> make-syscalls.sh changes.)
>
> The core problem is that the psABI has a different calling convention
> than the syscall interface, right?  This looks like a cautionary tale
> that one should not do this.

Something to consider for the new kernel interface.

-- 
H.J.


More information about the Libc-alpha mailing list