Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 943656 - sys-devel/gcc: consider enabling -D_GLIBCXX_ASSERTIONS by default
Summary: sys-devel/gcc: consider enabling -D_GLIBCXX_ASSERTIONS by default
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-17 09:05 UTC by Sam James
Modified: 2024-11-18 11:22 UTC (History)
1 user (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 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-17 09:05:50 UTC
Note: I don't think we're there yet, but it's something to start thinking about a bit.

_GLIBCXX_ASSERTIONS enables bounds-checking in various libstdc++ containers. Since bug 876895, we've enabled it by default for hardened builds. GCC 15 will enable it by default for -O0.

The main question is how big is the performance hit, and is it acceptable?

I think we want to wait until more work is done in GCC to optimise the conditions better. There's a few things GCC still needs to handle better with new/delete to allow it to optimise very common C++ idioms even without assertions, but the work going into that (much of which will land in 15) will affect assertion cases too.

References:
* https://chandlerc.blog/posts/2024/11/story-time-bounds-checking/
* https://security.googleblog.com/2024/11/retrofitting-spatial-safety-to-hundreds.html
* https://bughunters.google.com/blog/6368559657254912/llvm-s-rfc-c-buffer-hardening-at-google