classification
Title: ./configure failing when --with-memory-sanitizer specified
Type: behavior Stage: resolved
Components: Build Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: JaonHax, erlendaasland, pablogsal
Priority: normal Keywords: patch

Created on 2020-11-05 00:37 by JaonHax, last changed 2021-11-28 21:24 by pablogsal. This issue is now closed.

Files
File name Uploaded Description Edit
configure-out.txt JaonHax, 2020-11-05 00:39 ./configure failed output
configure-out-1.txt JaonHax, 2020-11-05 01:37 ./configure successful output
Pull Requests
URL Status Linked Edit
PR 29806 merged pablogsal, 2021-11-26 22:31
PR 29815 merged pablogsal, 2021-11-27 18:05
Messages (6)
msg380386 - (view) Author: (JaonHax) * Date: 2020-11-05 00:39
Exact command run is as follows:
sudo ./configure --with-pymalloc --with-assertions --enable-optimizations --enable-loadable-sqlite-extensions --enable-shared --with-address-sanitizer --with-undefined-behavior-sanitizer --with-memory-sanitizer -C

(ran with root because it seemed to make more things succeed in the checks without those flags)

The command's output is attached in configure-out.txt
msg380389 - (view) Author: (JaonHax) * Date: 2020-11-05 01:19
Additional note, since I forgot it in the initial message: I'm building Python 3.9.0 from source on Debian v10, specifically the Debian VM on Chromebooks (which I believe is called Crostini).

I've made sure to install all the proper dependencies, as far as I know, and I'm 99% sure that I can successfully build it if I remove the --with-memory-sanitizer flag. Running the command again without it to double-check.
msg380392 - (view) Author: (JaonHax) * Date: 2020-11-05 01:37
Yeah, exactly as I thought, ran the exact same command except without --with-memory-sanitizer and the configuration was successful. The successful output has been attached in configure-out-1.txt for cross-comparison, if it's necessary.
msg406739 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-11-21 21:33
Reproducible on 3.9, 3.10, and on main.

The --with-memory-sanitizer option adds "-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer" to CFLAGS, and "-fsanitize=memory -fsanitize-memory-track-origins=2" to LDFLAGS. The MemorySanitizer is a clang specific feature, AFAIK. You're using GCC, so what happens is that these (GCC incompatible) flags are added and the following compile check (getaddrinfo) fails.


IMO, adding a compiler check and printing a warning if --with-memory-sanitizer is used with GCC should be an ok solution. Alternatively, we inform the user that we're switching to using the leak sanitiser, if we're on GCC.


+pablo

See also:
  - https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
  - https://clang.llvm.org/docs/MemorySanitizer.html
msg407159 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-11-27 18:04
New changeset e71c12efcddc1076d5367461a5b416092267aa77 by Pablo Galindo Salgado in branch 'main':
bpo-42268: Fail the configure step if the selected compiler doesn't support memory sanitizer (GH-29806)
https://github.com/python/cpython/commit/e71c12efcddc1076d5367461a5b416092267aa77
msg407232 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-11-28 21:23
New changeset 8d1a5800645575ec876932bbb9aed3aa65d18f46 by Pablo Galindo Salgado in branch '3.10':
[3.10] bpo-42268: Fail the configure step if the selected compiler doesn't support memory sanitizer (GH-29806) (GH-29815)
https://github.com/python/cpython/commit/8d1a5800645575ec876932bbb9aed3aa65d18f46
History
Date User Action Args
2021-11-28 21:24:58pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-11-28 21:23:47pablogsalsetmessages: + msg407232
2021-11-27 18:05:56pablogsalsetpull_requests: + pull_request28048
2021-11-27 18:04:34pablogsalsetmessages: + msg407159
2021-11-26 22:31:42pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28038
2021-11-21 21:34:04erlendaaslandsetnosy: + pablogsal
2021-11-21 21:33:58erlendaaslandsetnosy: + erlendaasland

messages: + msg406739
versions: + Python 3.10, Python 3.11
2020-11-05 01:37:46JaonHaxsetfiles: + configure-out-1.txt

messages: + msg380392
2020-11-05 01:19:30JaonHaxsetmessages: + msg380389
2020-11-05 00:39:35JaonHaxsetfiles: + configure-out.txt

messages: + msg380386
2020-11-05 00:37:06JaonHaxcreate