Source: dietlibc
Version: 0.34~cvs20160606-11
Severity: normal

Dear Maintainer,

The testsuite fails with the following errors:

RUN ERROR for debian/unittests/socketfns.c in variant bare (rc = 1), test 
output is:
------------------------------------------------------------
parent: setsockopt: Invalid argument
------------------------------------------------------------


RUN ERROR for debian/unittests/socketfns.c in variant pthreads (rc = 1), test 
output is:
------------------------------------------------------------
parent: setsockopt: Invalid argument
------------------------------------------------------------

make[1]: *** [debian/rules:100: override_dh_auto_test-arch] Error 1

Full bulild log is here:
https://buildd.debian.org/status/fetch.php?pkg=dietlibc&arch=hppa&ver=0.34%7Ecvs20160606-11&stamp=1572208826&raw=0

I believe the syscall argument setup is wrong for the 5th and 6th arguments.
In a syscall, these arguments are passed in registers %r22 ans %r21,
respectively.  However, these arguments are passed on the stack in the
32-bit Linux runtime.  So, we have the following code for the setsockopt
call:

=> 0x00010430 <parent+704>:     ldo f4(r3),r20
   0x00010434 <parent+708>:     ldo -20(sp),ret0
   0x00010438 <parent+712>:     ldo -14(ret0),ret0
   0x0001043c <parent+716>:     ldi 4,r19
   0x00010440 <parent+720>:     stw r19,0(ret0)
   0x00010444 <parent+724>:     copy r20,r23
   0x00010448 <parent+728>:     ldi 1002,r24
   0x0001044c <parent+732>:     depwi,z -1,31,16,r25
   0x00010450 <parent+736>:     ldo 0(r3),ret0
   0x00010454 <parent+740>:     ldo -24(ret0),ret0
   0x00010458 <parent+744>:     ldw 0(ret0),r26
   0x0001045c <parent+748>:     b,l 0x11354 <setsockopt>,rp
   0x00010460 <parent+752>:     nop

The sizeof(optlen) argument is stored to the stack in the instruction
at 0x00010440.

(gdb) disass
Dump of assembler code for function setsockopt:
=> 0x00011354 <+0>:     b,l 0x112cc <__unified_syscall>,r0
   0x00011358 <+4>:     ldi b5,r20

__unified_syscall () at parisc/unified.S:49
49      parisc/unified.S: No such file or directory.
(gdb) disass
Dump of assembler code for function __unified_syscall:
=> 0x000112cc <+0>:     be,l 100(sr2,r0),sr0,r31
   0x000112d0 <+4>:     nop
   0x000112d4 <+8>:     ldi -100,r1
   0x000112d8 <+12>:    cmpb,>>=,n r1,ret0,0x112f8 <funlockfile>
   0x000112dc <+16>:    sub r0,ret0,ret0

So, the 5th argument to the setsockopt call never gets loaded into %r22.

The test program works when glibc is used.

Regards,
Dave Anglin


-- System Information:
Debian Release: bullseye/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 4.14.152+ (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to