[Bug 8611] New: syscalls with 6 arguments broken on x86 32bit

bugzilla at busybox.net bugzilla at busybox.net
Fri Jan 15 14:30:20 UTC 2016


            Bug ID: 8611
           Summary: syscalls with 6 arguments broken on x86 32bit
           Product: uClibc
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: Other
          Assignee: unassigned at uclibc.org
          Reporter: ronald.wahl at raritan.com
                CC: uclibc-cvs at uclibc.org

Created attachment 6281
  --> https://bugs.busybox.net/attachment.cgi?id=6281&action=edit
fix/workaround for broken syscall6 on x86 32bit

Syscalls with 6 arguments are currently broken or at least fragile on x86
This becomes a larger issue especially when using linux 4.3+ where the socket
calls like sendto() are directly accessible.

In case of sendto the address len parameter is not correctly pushed to the
kernel (can be checked with a recent version of strace that supports the new
direct syscalls). This may sometimes not lead to malfunctioning code

Copying the comment I added in the code here:

Syscalls with 6 arguments on x86/32bit arch need the 6th argument in the ebp
register. This register must been saved on the stack before assigning the
argument value. This actually happens inside inline assembler code. The actual
argument to be placed in ebp may itself being referenced via esp register.
Since pushing ebp will change esp behind gcc's back the value stored in ebp may
be wrong. It looks like gcc uses ebp when refering to stack arguments in case
of an existing frame pointer. So we enforce frame pointers in that case. We
also need to specify the noinline attribute.

The attached patch is just a workaround that is working for me with gcc 4.8.3
but is no guarantee that it works on all cases and all affected syscalls.

As far as I know glibc used a special hack for 6arg-syscalls by using a helper
macro that gets the first args in registers and all additional args via a
structure or array and the helper does the register setup for the actual

You are receiving this mail because:
You are on the CC list for the bug.

More information about the uClibc-cvs mailing list