Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 610814 - dev-lang/python: add sanitize use flag
Summary: dev-lang/python: add sanitize use flag
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-24 16:02 UTC by Jonas Jelten
Modified: 2024-03-15 03:57 UTC (History)
2 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 Jonas Jelten 2017-02-24 16:02:55 UTC
The Python build system has support for -fsanitize=address through its --with-address-sanitizer flag.

Pleas convert this into a useflag.


Additionally, I was not able to build Python with EXTRA_ECONF="--with-address-sanitizer" for testing this. It fails during the configure step with

ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

several times, and the python ./configure won't generate a valid config.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-02-24 17:19:13 UTC
Erm, so why are you asking us to add support for a configure option that doesn't even work? Furthermore, I believe that sanitizer magic really belongs in CFLAGS/CXXFLAGS and not USE flags. Do you have any arguments contrary to that?
Comment 2 Jonas Jelten 2017-02-24 19:09:11 UTC
I should have explained it better :)

The --with-address-sanitizer option works if I build it from the source directly (without emerge).

It doesn't work if I want to build it with emerge and EXTRA_ECONF, it then fails because of the reason mentioned above. I could not discover the difference between those builds yet, and why it complains in the ebuild environment.

I tried building Python directly with CFLAGS and LDFLAGS for asan, but that aborts the build even earlier, so in the research process, I encountered the built-in activation mechanism. But I couldn't get it to work yet.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-15 03:57:16 UTC
I don't think thre's a need to do this. It's generic to anything with ASAN because of how sandbox works, not specific to Python, just Python happens to have a configure arg for it.

We have https://wiki.gentoo.org/wiki/AddressSanitizer#Per-package documented.

For cases where the build system does need to do something special, see e.g. https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/elfutils/elfutils-0.191.ebuild#n98 or https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/botan/botan-3.3.0.ebuild#n189.