Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.98k stars 560 forks source link

Solaris 11.3: perl-5.32.0 failed 9 tests out of 2468 #17978

Open noloader opened 4 years ago

noloader commented 4 years ago

Description

I am building Perl 5.32.0 on Solaris 11.3 i86 pc. Perl configuration and build appears OK, but Perl finishes with:

Failed 9 tests out of 2468, 99.64% okay.
        ../cpan/Compress-Raw-Zlib/t/01version.t
        ../cpan/Compress-Raw-Zlib/t/02zlib.t
        ../cpan/Compress-Raw-Zlib/t/18lvalue.t
        ../cpan/Compress-Raw-Zlib/t/19nonpv.t
        ../cpan/IO-Compress/t/cz-01version.t
        ../cpan/IO-Compress/t/cz-03zlib-v1.t
        ../cpan/IO-Compress/t/cz-06gzsetp.t
        ../cpan/IO-Compress/t/cz-08encoding.t
        ../cpan/IO-Compress/t/cz-14gzopen.t

Steps to Reproduce

Build Perl 5.32.0 on Solaris 11.3. Be sure to run make check.

Expected behavior

Successful tests.

Perl configuration

$ perl-5.32.0$  find . -name perl
./perl
./t/lib/warnings/perl
./t/perl
$ perl-5.32.0$ ./perl -V
ld.so.1: perl: fatal: libperl.so: open failed: No such file or directory
Killed

I can provide remote access to this box if a VM is not handy.

You can also find access to Solaris machines at the GCC Compile Farm. Accounts are free to FOSS developers.


This may have something to do with the failure. I see the runpath problem is still present.

gcc -o libperl.so -shared -m64 -L/export/home/jwalton/tmp/ok2delete/lib -Wl,-R,/../lib -Wl,-R,/export/home/jwalton/tmp/ok2delete/lib -L/usr/local/lib -L/usr/gnu/lib -fstack-protector op.o     perl.o  gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o caretx.o dquote.o time64.o   DynaLoader.o -lpthread -lsocket -lnsl -ldl -lm -lc 
gcc -o perl -L/export/home/jwalton/tmp/ok2delete/lib -m64 -Wl,-R,/../lib -Wl,-R,/export/home/jwalton/tmp/ok2delete/lib -Wl,-z,now -Wl,-z,origin -fstack-protector -L/usr/local/lib -L/usr/gnu/lib -m64  -R /export/home/jwalton/tmp/ok2delete/lib/perl5/5.32.0/i86pc-solaris-64/CORE perlmain.o   libperl.so `cat ext.libs` -lpthread -lsocket -lnsl -ldl -lm -lc 
Can't locate File/Spec.pm in @INC (you may need to install the File::Spec module) (@INC contains: lib . /export/home/jwalton/Build-Scripts/perl-5.32.0/lib /export/home/jwalton/tmp/ok2delete/lib/perl5/site_perl/5.32.0/i86pc-solaris-64 /export/home/jwalton/tmp/ok2delete/lib/perl5/site_perl/5.32.0 /export/home/jwalton/tmp/ok2delete/lib/perl5/5.32.0/i86pc-solaris-64 /export/home/jwalton/tmp/ok2delete/lib/perl5/5.32.0) at lib/CPAN.pm line 10.
BEGIN failed--compilation aborted at lib/CPAN.pm line 10.
Compilation failed in require.
BEGIN failed--compilation aborted.
gmake: [extras.make] Error 2 (ignored)
noloader commented 4 years ago

Yeah, this is the runpath problem. When LDFLAGS uses a runpath of:

-Wl,-R,'$ORIGIN/../lib' -Wl,-R,/export/home/jwalton/tmp/ok2delete/lib

Perl screws it up. When I run elfdump on the resulting binaries, Perl has munged it to:

perl-5.32.0$ find . -name '*.so*' | head -n 1
./lib/auto/POSIX/POSIX.so
perl-5.32.0$ elfdump lib/auto/POSIX/POSIX.so | /usr/gnu/bin/grep -E 'RPATH|RUNPATH'
      [7]  RUNPATH         0xfc3    /../lib:/export/home/jwalton/tmp/ok2delete/lib
      [8]  RPATH           0xfc3    /../lib:/export/home/jwalton/tmp/ok2delete/lib

/../lib (which started as $ORIGIN/../lib) happens to be the old zLib in /lib. That's the zLib with the CVE. So Perl is compiling and linking against one version of the library, and then runtime linking against the wrong version of the library.

The build system is breaking stuff. Perl needs to fix the handling of runpaths from Issue 17534.

For completeness, Perl may encounter three similar variables: $ORIGIN, $LIB and $PLATFORM. Also see the ld.so (8) man page.

(And NO, I can't delete the old version of zLib in /lib as Perl suggests).

doughera88 commented 3 years ago

This appears to be a duplicate of https://github.com/Perl/perl5/issues/17534. There is no clear way to fix this within Configure, and we never got a response whether the suggested config.over trick might work, or whether the simpler "edit config.sh and Makefile" approach worked.