Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 708430

Summary: sys-libs/compiler-rt-sanitizers-9.0.1 with sys-libs/glibc-2.31 - .../work/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
Product: Gentoo Linux Reporter: Mike Lothian <mike>
Component: Current packagesAssignee: LLVM support project <llvm>
Status: RESOLVED FIXED    
Severity: normal CC: ago, agrigo2001, alex, anton.kochkov, ao, candrews, chris, herrtimson, luke-jr+gentoobugs, mail, mgorny, mimworkmail, nrndda, ostroffjh, phobosk, toralf, vmatare+gbug, waebbl-gentoo, zeekec
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=727762
Whiteboard: fixed in 10
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 708318    
Attachments: Build log
Patch for glibc-2.31
Fixes the compilation issue with glibc 2.31
Patch to adjust sys-libs/compiler-rt-sanitizers-9.0.1 for glibc 2.31+

Description Mike Lothian 2020-02-05 23:58:06 UTC
This has been fixed upstream with:

https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce.patch

I've reworked the patch to apply on 9.0.1

Reproducible: Always
Comment 1 Mike Lothian 2020-02-05 23:58:40 UTC
Created attachment 612052 [details]
Build log
Comment 2 Mike Lothian 2020-02-05 23:59:25 UTC
Created attachment 612054 [details, diff]
Patch for glibc-2.31
Comment 3 Mike Lothian 2020-02-06 00:00:18 UTC
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o 
/usr/lib/llvm/9/bin/x86_64-pc-linux-gnu-clang++ -DHAVE_RPC_XDR_H=0 -I/var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/..  -O3 -march=native -pipe -Wall -std=c++11 -Wno-unused-parameter    -m32 -fPIC -fno-builtin -fno-exceptions
 -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -MD -MT
 lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizer
CommonNoTermination.i386.dir/sanitizer_platform_limits_posix.cc.o -c /var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1131:1: error: 'assertion_failed__1131' declared as an array with a negative size
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1437:3: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:336:30: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-libs/compiler-rt-sanitizers-9.0.1/work/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:342:57: note: expanded from macro 'IMPL_COMPILER_ASSERT'
    typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                        ^~~~~~~~~~~~~~~
1 error generated.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-02-23 18:06:20 UTC
Thanks, I'll backport it now.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-02-23 18:19:07 UTC
Actually, it doesn't apply cleanly and it seems that getting full set of patches is not worth the effort.  Just use 10.x if you need bleeding edge glibc.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-02-25 18:59:08 UTC
*** Bug 710800 has been marked as a duplicate of this bug. ***
Comment 7 Frits Letteboer 2020-03-11 19:49:35 UTC
Created attachment 618030 [details, diff]
Fixes the compilation issue with glibc 2.31

As a quick workaround

Taken from: http://www.linuxfromscratch.org/blfs/view/svn/general/llvm.html
Comment 8 Craig Andrews gentoo-dev 2020-05-01 02:34:06 UTC
(In reply to Frits Letteboer from comment #7)
> Created attachment 618030 [details, diff] [details, diff]
> Fixes the compilation issue with glibc 2.31
> 
> As a quick workaround
> 
> Taken from: http://www.linuxfromscratch.org/blfs/view/svn/general/llvm.html

I confirm that this patch solves the problem.
Comment 9 Sam James archtester gentoo-dev Security 2020-05-01 03:36:35 UTC
*** Bug 720222 has been marked as a duplicate of this bug. ***
Comment 10 Pavel Volkov 2020-05-08 06:25:43 UTC
(In reply to Michał Górny from comment #5)
> Actually, it doesn't apply cleanly and it seems that getting full set of
> patches is not worth the effort.  Just use 10.x if you need bleeding edge
> glibc.

It's said that some packages are broken with LLVM 10, in other distros as well — bug 711788.
Comment 11 Victor Mataré 2020-05-13 22:26:21 UTC
app-doc/doxygen has RDEPEND="clang? ( <sys-devel/clang-10:= )", so we should either get rid of that or continue to support clang:9.
Comment 12 Bernd 2020-05-19 09:45:58 UTC
This issue also happens to compiler-rt-sanitizers:8.0.1
Comment 13 Arfrever Frehtes Taifersar Arahesis 2020-07-21 21:57:36 UTC
*** Bug 733378 has been marked as a duplicate of this bug. ***
Comment 14 Andrew 2020-07-27 14:21:02 UTC
I also confirm that the patch from  Frits Letteboer  solves the problem
Comment 15 Viktar Patotski 2020-07-31 14:53:37 UTC
I Confirm that patch from Frits Letteboer solves compilation problem and I'm able to build sys-libs/compiler-rt-sanitizers-9.0.1. However I believe disabling check is not the best way fixing it. We need to wait for upstream to fix it.
Comment 16 Herbert Wantesh 2020-09-12 10:12:11 UTC
the patch from Frits Letteboer fixes the compile for me too
Comment 17 Luke-Jr 2020-09-27 13:31:14 UTC
*** Bug 744877 has been marked as a duplicate of this bug. ***
Comment 18 Luke-Jr 2020-09-27 13:32:30 UTC
glibc 2.31 is stable now... would be nice to have a path forward?

(In reply to Michał Górny from comment #5)
> Just use 10.x if you need bleeding edge glibc.

10.x what? This build still fails with LLVM/Clang 10 installed.
Comment 19 tt_1 2020-09-27 15:18:39 UTC
llvm/clang is a whole toolchain and some of the ebuilds have slots, others don't. compiler-rt-sanitizers has slots, which means you have to emerge =compiler-rt-sanitizers-10.0.x to match your llvm/clang-10 toolchain. I thought this was obvious? 

personally I whished the provided patch was backported, but I can see that ressources for testing are limited. I thus removed USE="sanitize" from my llvm:9 and wait a bit longer for llvm-10.0.1 to be stable on all relevant arches
Comment 20 Luke-Jr 2020-09-27 17:43:38 UTC
(In reply to Craig Andrews from comment #8)
> I confirm that this patch solves the problem.

Are you sure it doesn't simply remove compile-time sanity checks? Looks like with this patch, big endian platforms (other than MIPS, aarch64, and s390x) will break at runtime (ie, when performing the actual sanitizer checks)...
Comment 21 Luke-Jr 2020-09-27 17:49:13 UTC
Created attachment 662686 [details, diff]
Patch to adjust sys-libs/compiler-rt-sanitizers-9.0.1 for glibc 2.31+

This patch is an actual backport of the relevant changes in version 10.

Disclaimer: This does remove functionality from (and perhaps breaks sanitizer use with) systems with older glibc versions (2.30 and earlier); but with a current glibc, I think it should work. Untested.
Comment 22 Alex Efros 2020-12-05 10:39:20 UTC
(In reply to Luke-Jr from comment #21)
> Created attachment 662686 [details, diff] [details, diff]
> Patch to adjust sys-libs/compiler-rt-sanitizers-9.0.1 for glibc 2.31+
> 
> This patch is an actual backport of the relevant changes in version 10.

Works for me, thanks!
Comment 23 Guilherme Amadio gentoo-dev 2020-12-19 14:02:32 UTC
Many packages still have not adapted t
Comment 24 Guilherme Amadio gentoo-dev 2020-12-19 14:04:57 UTC
Many packages have not yet adapted to LLVM/Clang 10, so we still need to keep 9 around in the mean time. If there are no objections, I will apply the patch by Luke Jr to 9.0.1 in a new revision. Michał, what do you think?
Comment 25 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-12-19 14:13:07 UTC
(In reply to Guilherme Amadio from comment #24)
> Many packages have not yet adapted to LLVM/Clang 10, so we still need to
> keep 9 around in the mean time. If there are no objections, I will apply the
> patch by Luke Jr to 9.0.1 in a new revision. Michał, what do you think?

Just make sure to put it into files/9.0.1/ directory.
Comment 26 Larry the Git Cow gentoo-dev 2021-01-07 13:59:57 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2741567d6f7fb139c8ad37137fb581987a779e97

commit 2741567d6f7fb139c8ad37137fb581987a779e97
Author:     Guilherme Amadio <amadio@gentoo.org>
AuthorDate: 2020-12-19 14:07:38 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2021-01-07 13:59:40 +0000

    sys-libs/compiler-rt-sanitizers: fix for glibc 2.31+, bug #708430
    
    Closes: https://bugs.gentoo.org/708430
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 .../compiler-rt-sanitizers-9.0.1-r1.ebuild         | 160 +++++++++++++++++++++
 .../files/9.0.1/glibc-2.31.patch                   |  35 +++++
 2 files changed, 195 insertions(+)