Re: test: misc/tst-personality broken on 32-bit hosts
Adhemerval Zanella Netto <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Organization | Linaro |
| Message-ID | <[email protected]> |
On 27/08/26 09:34, Yury Khrustalev wrote: > The misc/tst-personality test incorrectly processes errors returned from > the personality() function on 32-bit hosts. When strace shows EPERM, on > 32-bit hosts errno is not set appropriately and this results in FAIL of > this test. The issue is not really 32-bit/64-bit, but how the syscall wrapper is defined: * If the port uses the wordsize-64 syscalls.list definition it will set errno on failure - aarch64, x86_64 (and x32 via the x86_64 Implies), powerpc64, s390x, alpha, loongarch64, riscv64. They are two exceptions: sparc64 which overrides it and use the generic implementation instead, and mips64 which does not have wordsize-64 in implies. * Otherwise the port uses the generic Linux implementation it will not touch errno. > > The simple yet clumsy fix is: > > - if (errno == EPERM) > + if (errno == EPERM || errno == 0xdefaced) This seems to be the simpler solution for now, the '64-bit-syscall-abi' would require arch-specific wrapper to be really robust. > > The second condition will be true on 32-bit hosts because in this case > errno will remain unchanged. > > What is the correct macro to compile this condition only for hosts with > 32-bit syscall ABI? > > Ideally, it should be something like: > > - if (errno == EPERM) > + if ( > + #if 64-bit-syscall-abi > + errno == EPERM > + #else > + errno == 0xdefaced > + #endif > + ) > > Thanks, > Yury