Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920234 - dev-libs/nettle-3.9.1[asm] - test failures (chacha, chacha-poly1305) and runtime failures (e.g. wget[19849]: illegal instruction (4) at 3fff882c2754 nip 3fff882c2754 lr 3fff882c24e8 code 1 in libnettle.so.8.8) on machines with less than POWER7 cpu
Summary: dev-libs/nettle-3.9.1[asm] - test failures (chacha, chacha-poly1305) and runt...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks:
 
Reported: 2023-12-18 01:13 UTC by ernsteiswuerfel
Modified: 2023-12-18 21:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (nettle-3.9.1_20231218-003727.log,251.53 KB, text/plain)
2023-12-18 01:13 UTC, ernsteiswuerfel
Details
emerge --info (file_920234.txt,6.49 KB, text/plain)
2023-12-18 01:14 UTC, ernsteiswuerfel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2023-12-18 01:13:13 UTC
Created attachment 879767 [details]
build.log

I experienced runtime failures on my PowerMac G5 like these:

 # eselect repository list
--2023-12-18 01:25:27--  https://qa-reports.gentoo.org/output/repos/repositories.xml
Resolving qa-reports.gentoo.org... 146.75.121.91, 2a04:4e42:8e::347
Connecting to qa-reports.gentoo.org|146.75.121.91|:443... connected.
/usr/share/eselect/modules/repository.eselect: line 45: 19849 Illegal instruction     wget -N -P "${REMOTE_LIST_CACHEDIR}" "${REMOTE_LIST_URI}"
!!! Error: unable to fetch repositories.xml

dmesg showing:
wget[19849]: illegal instruction (4) at 3fff882c2754 nip 3fff882c2754 lr 3fff882c24e8 code 1 in libnettle.so.8.8[3fff882a6000+6e000]
wget[19849]: code: 3842b5e0 38c00010 38e00020 39000030 1090038c 10ac038c 10c8038c 10e7038c 
wget[19849]: code: 39200000 7d89480c 11a3030c 118c6cc4 <7c002619> 7c262619 7c472619 7c682619


So I took a closer look on dev-libs/nettle-3.9.1. It builds just fine on the G5 but when additionally running FEATURES="test" the problem becomes more obvious. It seems to use >=POWER7 assembly on my G5 (POWER4 + Altivec) which can't work.

[...]
configure: summary of build options:

  Version:           nettle 3.9.1
  Host type:         powerpc64-gentoo-linux-musl
  ABI:               64
  Assembly files:    powerpc64/p7 powerpc64
  Install prefix:    /usr
  Library directory: /usr/lib
  Compiler:          powerpc64-gentoo-linux-musl-gcc
  Static libraries:  no
  Shared libraries:  yes
  Public key crypto: yes
  Using mini-gmp:    no
  Documentation:     no

>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-libs/nettle-3.9.1/work/nettle-3.9.1 ...
 * .ppc64: running multilib-minimal_abi_src_compile
make -j3 -l2 
make all-here
[...]
PASS: aes
PASS: aes-keywrap
PASS: arcfour
PASS: arctwo
PASS: balloon
PASS: blowfish
PASS: bcrypt
PASS: cast128
PASS: base16
PASS: base64
PASS: camellia
Illegal instruction
FAIL: chacha
[...]
PASS: poly1305
Illegal instruction
FAIL: chacha-poly1305
[...]
PASS: nettle-pbkdf2
powerpc64-gentoo-linux-musl-nm: '../libnettle.a': No such file
powerpc64-gentoo-linux-musl-nm: '../libnettle.a': No such file
PASS: symbols
PASS: dlopen
=====================
2 of 117 tests failed
=====================
make[1]: *** [Makefile:126: check] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-libs/nettle-3.9.1/work/nettle-3.9.1-.ppc64/testsuite'
make: *** [Makefile:48: check] Error 2
 * ERROR: dev-libs/nettle-3.9.1::gentoo failed (test phase):
 *   Make check failed. See above for details.
Comment 1 ernsteiswuerfel archtester 2023-12-18 01:14:34 UTC
Created attachment 879768 [details]
emerge --info
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-18 06:54:53 UTC
Yeah, in https://git.lysator.liu.se/nettle/nettle/-/tree/master/powerpc64, the minimum is p7.

Upstream need to add a configure check to bail out / disable asm on <p7.

On our side, it's maybe a bit more intesting about how we should handle (detect) it. Unfortunately the CHOST isn't enough.
Comment 3 ernsteiswuerfel archtester 2023-12-18 21:20:59 UTC
I did some testing with upstream nettle from git. Turns out the >=P7 assembly problem only shows up on the G5 as long as --disable-fat is set in ./configure.

I mimicked configure options from the failing nettle-3.9.1 Gentoo ebuild and used them on git nettle_3.9.1_release_20230601 but without --disable-fat:

./.bootstrap
./configure --disable-dependency-tracking CC_FOR_BUILD=powerpc64-unknown-linux-gnu-gcc --disable-arm-neon --disable-arm64-crypto --enable-power-altivec --disable-power-crypto-ext --disable-power9 --disable-x86-aesni --disable-x86-sha-ni --disable-x86-pclmul --disable-s390x-vf --disable-s390x-msa --enable-assembler --disable-documentation --enable-public-key --enable-static --disable-openssl
make -j3
make -j3 check

This builds ok and passes tests on my G5 without throwing up illegal instructions.

When --disable-fat is set in ./configure I get:

chacha-test[232102]: illegal instruction (4) at 3fffa56ef714 nip 3fffa56ef714 lr 3fffa56cb604 code 1 in libnettle.so[3fffa56b0000+5a000]
chacha-test[232102]: code: 38c00010 38e00020 39000030 3941ffc0 7e8051ce 7ea651ce 7ec751ce 7ee851ce 
chacha-test[232102]: code: 1210038c 122c038c 1248038c 1267038c <7c002619> 7c862619 7d072619 7d882619 
chacha-poly1305[232473]: illegal instruction (4) at 3fffa0b9b90c nip 3fffa0b9b90c lr 3fffa0b9ba60 code 1 in libnettle.so[3fffa0b80000+5a000]
chacha-poly1305[232473]: code: 80050000 38c00010 38e00020 39000030 1090038c 10ac038c 10c8038c 10e7038c 
chacha-poly1305[232473]: code: 39200000 7d89480c 11a3030c 118c6cc4 <7c002619> 7c262619 7c472619 7c682619