Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 928904 - dev-lang/perl-5.38.2-r2 compiled with -ftrapv causes automake to fail due to an illegal instruction
Summary: dev-lang/perl-5.38.2-r2 compiled with -ftrapv causes automake to fail due to ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-07 19:45 UTC by Tohka
Modified: 2024-05-11 02:12 UTC (History)
2 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,18.03 KB, text/plain)
2024-04-07 19:45 UTC, Tohka
Details
sys-libs/zlib build.log (zlib-build.log,3.07 KB, text/x-log)
2024-04-07 19:51 UTC, Tohka
Details
sys-libs/zlib automake.out (zlib-automake.out,362 bytes, text/plain)
2024-04-07 19:52 UTC, Tohka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tohka 2024-04-07 19:45:31 UTC
Created attachment 889771 [details]
emerge-info.txt

Compiling dev-lang/perl with -ftrapv causes a miscompile. It compiles however it prevents a few other packages from installing. For example automake will fail on packages like sys-libs/zlib and will give an error of illegal instruction. However, if we compile dev-lang/perl with -fwrapv instead of -ftrapv it compiles again and it allows these other packages to complete the automake phase without the illegal instructions.
Comment 1 Tohka 2024-04-07 19:51:16 UTC
Created attachment 889772 [details]
sys-libs/zlib build.log

This is the build log of sys-apps/zlib when you compile dev-lang/perl with -ftrapv.
Comment 2 Tohka 2024-04-07 19:52:57 UTC
Created attachment 889773 [details]
sys-libs/zlib automake.out

This is the automake.out of sys-libs/zlib when you compile dev-lang/perl with -ftrapv.
Comment 3 Tohka 2024-04-07 22:05:35 UTC
It seems this wasn't a miscompile but -ftrapv behaving as it should be as its trapping something hence the illegal instruction and also due to dmesg identifying the "trap". So it could be that there is a bug in either automake or libperl.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-07 22:13:01 UTC
(In reply to Tohka from comment #3)
> It seems this wasn't a miscompile but -ftrapv behaving as it should be as
> its trapping something hence the illegal instruction and also due to dmesg
> identifying the "trap". So it could be that there is a bug in either
> automake or libperl.

A backtrace will be needed.
Comment 5 Tohka 2024-04-07 22:17:36 UTC
(In reply to Sam James from comment #4)
> (In reply to Tohka from comment #3)
> > It seems this wasn't a miscompile but -ftrapv behaving as it should be as
> > its trapping something hence the illegal instruction and also due to dmesg
> > identifying the "trap". So it could be that there is a bug in either
> > automake or libperl.
> 
> A backtrace will be needed.

Thank you it will be quite some time until I am able to do so but I have kept a note of that.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-10 00:21:34 UTC
While doing something else, I noticed that Perl is built with `-fwrapv` which requests, as an extension, defined semantics for signed integer overflow.

Using -ftrapv probably overrides that and is arguably invalid. But we could maybe filter it out in the ebuild.
Comment 7 Larry the Git Cow gentoo-dev 2024-05-11 02:12:22 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b1dea036a1fba87623a59be76dc588595f9c65a

commit 9b1dea036a1fba87623a59be76dc588595f9c65a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-05-11 02:11:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-05-11 02:11:13 +0000

    dev-lang/perl: filter out -ftrapv
    
    People shouldn't really pass -ftrapv in global flags anyway but let's
    filter out -ftrapv in Perl specifically given we know it requires -fwrapv
    semantics and it even passes that during the build, but -ftrapv if set
    by the user will be appended and take precdence...
    
    Bug: https://bugs.gentoo.org/928904
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/perl/perl-5.38.2-r5.ebuild | 3 +++
 1 file changed, 3 insertions(+)