Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910438 - app-arch/lbzip2: Sometimes produces corrupt archives when compiled with clang and vectorization with certain march values.
Summary: app-arch/lbzip2: Sometimes produces corrupt archives when compiled with clang...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matt Turner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-clang 915000
  Show dependency tree
 
Reported: 2023-07-16 20:13 UTC by Violet Purcell
Modified: 2024-04-02 01:43 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Violet Purcell 2023-07-16 20:13:39 UTC
This is a really odd and specific bug that only happens under specific circumstances (most likely caused by UB), but it is reproducable.

Reproducible: Always

Steps to Reproduce:
1. Compile app-arch/lbzip2 with clang and CFLAGS="-march=skylake -O1 -fvectorize"
2. Copy an environment.bz2 file from /var/db/pkg (specifically reproduced using /var/db/pkg/dev-python/setuptools-68.0.0-r1/environment.bz2)
3. bunzip2 environment.bz2 && lbzip2 -9 environment && bunzip2 environment.bz2
4. You should get a Data integrity error.



This bug only happens with clang, and can be reproduced using either of the following CFLAGS:
CFLAGS="-march=skylake -O1 -fvectorize"
CFLAGS="-mavx512f -O1 -fvectorize"
Comment 1 Sv. Lockal 2024-02-15 08:23:21 UTC
I had the same issue with `clang -flto=thin -O2 -march=native` system (znver4). Got a lot of broken environment.bz2 files. Maybe this is related to https://phabricator.wikimedia.org/T208647, but I just want to confirm that it is unsafe to use lbzip2 as bzip2 alternative in such conditions.
Comment 2 Sv. Lockal 2024-03-31 11:24:42 UTC
Reported to LLVM as https://github.com/llvm/llvm-project/issues/87189.

Workaround is:

  tc-is-clang && append-flags "-mno-avx512f"
Comment 3 Violet Purcell 2024-04-01 13:26:56 UTC
Thanks for the more detailed analysis.