Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933289 - dev-libs/boost-1.85: boost::container has strict aliasing violations
Summary: dev-libs/boost-1.85: boost::container has strict aliasing violations
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: David Seifert
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 915000 boost-1.85
  Show dependency tree
 
Reported: 2024-05-31 23:50 UTC by Sam James
Modified: 2024-07-04 18:56 UTC (History)
3 users (show)

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


Attachments
upstream patch adjusted for /etc/portage/patches (boost-pair-UB-20ad12f20e661978e90dc7f36d8ab8ac05e5a5a9.patch,15.18 KB, patch)
2024-06-01 04:30 UTC, Torsten Kaiser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-31 23:50:51 UTC
This first came up in bug 932780 where games-strategy/freeorion was miscompiled.

There's a fresh upstream bug for it at https://github.com/boostorg/container/issues/281 but there's an older bug in https://github.com/boostorg/container/issues/252.

There's various related commits on `develop` but I'm not sure if any of them will actually fix it and they're also big, a sample:
* https://github.com/boostorg/container/commit/978bbb113ab2e72f84f626d3e52039cf06501853
* https://github.com/boostorg/container/commit/03abe8c02c17e4b9876b006174375a927a1cb2cb
* https://github.com/boostorg/container/commit/20ad12f20e661978e90dc7f36d8ab8ac05e5a5a9


Mostly filing this because we should probably do *something* about it but I don't know what.

I'm not sure what to do yet. The pragma is fragile but I feel like leaving boost-1.85 as-is surely isn't sustainable or safe either. Reverting the bisect result (https://github.com/boostorg/container/commit/1a4a205ea6ef7b4e67a2faab7c7d745711807695) isn't great as it's both: a) a massive commit; b) not the real fix anyway.

Options are:
a) revert the inline commit above (huge);
b) add pragma for no-sa in the header;
c) ???
Comment 1 Torsten Kaiser 2024-06-01 04:29:04 UTC
Using https://github.com/boostorg/container/commit/20ad12f20e661978e90dc7f36d8ab8ac05e5a5a9 as a base for the attached patch fixes the problem in boost for me.

All of the testcases in the bug reports work and a freeorion rebuild without -fno-strict-aliasing works and the game starts correctly.

Changes in my patch: Dropped .gitignore change and removed '/include/' from the file names.
Comment 2 Torsten Kaiser 2024-06-01 04:30:38 UTC
Created attachment 894763 [details, diff]
upstream patch adjusted for /etc/portage/patches
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-02 03:38:31 UTC
Thanks Torsten. I'll speak to soap and see if he's fine with it.

(Also, to state the obvious, but lest we forget: we need to crank subslot when adding it...)
Comment 4 Larry the Git Cow gentoo-dev 2024-06-03 01:31:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bbea521152678132cf0b02e3a152481523b3078

commit 4bbea521152678132cf0b02e3a152481523b3078
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-06-03 01:19:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-06-03 01:20:45 +0000

    dev-libs/boost: fix aliasing violation in boost::container
    
    Note that we have to crank the subslot for this. I've added a fudge .1
    which we should drop on 1.86.0.
    
    Closes: https://bugs.gentoo.org/933289
    Bug: https://github.com/freeorion/freeorion/issues/4949
    Bug: https://github.com/boostorg/container/issues/252
    Bug: https://github.com/boostorg/container/issues/281
    Bug: https://bugs.gentoo.org/932780
    Bug: https://bugs.gentoo.org/931587
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/boost/boost-1.85.0-r1.ebuild              | 348 ++++++++++++++++++
 .../files/boost-1.85.0-container-aliasing.patch    | 408 +++++++++++++++++++++
 2 files changed, 756 insertions(+)
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-04 18:56:12 UTC
I sent https://lore.kernel.org/distributions/87cyntm5uv.fsf@gentoo.org/T/#u now too.