classification
Title: warning: ‘no_sanitize_thread’
Type: compile error Stage: resolved
Components: Build Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, ronaldoussoren, shihai1991, vstinner
Priority: normal Keywords: patch

Created on 2019-07-25 16:02 by shihai1991, last changed 2019-08-14 10:59 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 15096 merged shihai1991, 2019-08-03 16:09
PR 15270 merged miss-islington, 2019-08-14 09:50
PR 15271 merged miss-islington, 2019-08-14 09:50
Messages (10)
msg348441 - (view) Author: hai shi (shihai1991) * Date: 2019-07-25 16:02
When I build cpython, I got this error:
Objects/obmalloc.c:1414:1: warning: ‘no_sanitize_thread’ attribute directive ignored [-Wattributes]
 {
 ^
I removed the _Py_NO_SANITIZE_THREAD and build again, this warning dismissed. not sure ASAN、TSAN and MSAN have some inner relation?
msg348741 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-07-30 13:48
- Which python version do you try to build?
- What platform are you on?
- Which compiler and compiler version do you use?
msg348757 - (view) Author: hai shi (shihai1991) * Date: 2019-07-30 16:42
I want to build the cpython of master.
My platform and compiler info: Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018

Looks not all platform get this info.
msg348766 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-07-30 18:25
A GCC export should be able to tell more, but the warning should be harmless.

Objects/obmalloc.c says that the thread sanitizer is available from GCC 4.8, but for some reason it isn't on your system. This seems to be a bug in obmalloc.c:  The GCC 4.8.5 docs don't mention this attribute [1], while the 5.5 docs do [2]

[1] https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Function-Attributes.html#Function-Attributes
[2] https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/Function-Attributes.html#Function-Attributes

There's a couple of releases between 4.8.5 and 5.5.0, I don't know which one introduces this function attribute. Once that version is know it should be fairly easy to provide a patch that only uses the attribute for new enough compilers.
msg348777 - (view) Author: hai shi (shihai1991) * Date: 2019-07-31 04:35
thanks, Ronald. Let me check the process by the upstairs refs.
msg348965 - (view) Author: hai shi (shihai1991) * Date: 2019-08-03 16:04
I checked no_sanitize_thread in some gcc manual of different version. And looks the no_sanitize_thread from gcc 5.1.0 [3](not 4.8)

[1] https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/Function-Attributes.html#Function-Attributes
[2] https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Function-Attributes.html#Function-Attributes
[3] https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Function-Attributes.html#Function-Attributes
[4] https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Function-Attributes.html#Function-Attributes

Alexey have some descr of TSAN in https://bugs.python.org/issue35204(Looks `GCC introduced TSan together with ASan in 4.8` is wrong)
msg349664 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-14 09:50
New changeset 7e479c82218450255572e3f5fa1549dc283901ea by Victor Stinner (Hai Shi) in branch 'master':
bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)
https://github.com/python/cpython/commit/7e479c82218450255572e3f5fa1549dc283901ea
msg349667 - (view) Author: miss-islington (miss-islington) Date: 2019-08-14 10:08
New changeset 364a1d3125af6c0ff0a4bd2c8afe70fd38f30456 by Miss Islington (bot) in branch '3.8':
bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)
https://github.com/python/cpython/commit/364a1d3125af6c0ff0a4bd2c8afe70fd38f30456
msg349668 - (view) Author: miss-islington (miss-islington) Date: 2019-08-14 10:16
New changeset 15b6d0a712c08557a605f49034f8ad392985144c by Miss Islington (bot) in branch '3.7':
bpo-37681: no_sanitize_thread support from GCC 5.1 (GH-15096)
https://github.com/python/cpython/commit/15b6d0a712c08557a605f49034f8ad392985144c
msg349675 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-14 10:59
Thanks Hai Shi for the bug report and the fix.
History
Date User Action Args
2019-08-14 10:59:51vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg349675

stage: patch review -> resolved
2019-08-14 10:16:57miss-islingtonsetmessages: + msg349668
2019-08-14 10:08:50miss-islingtonsetnosy: + miss-islington
messages: + msg349667
2019-08-14 09:50:47miss-islingtonsetpull_requests: + pull_request14993
2019-08-14 09:50:41miss-islingtonsetpull_requests: + pull_request14992
2019-08-14 09:50:36vstinnersetnosy: + vstinner
messages: + msg349664
2019-08-03 16:09:09shihai1991setkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request14843
2019-08-03 16:04:11shihai1991setmessages: + msg348965
2019-07-31 04:35:36shihai1991setmessages: + msg348777
2019-07-30 18:25:17ronaldoussorensettype: compile error
stage: needs patch
messages: + msg348766
versions: + Python 3.8, Python 3.9
2019-07-30 16:42:52shihai1991setmessages: + msg348757
2019-07-30 13:48:35ronaldoussorensetnosy: + ronaldoussoren
messages: + msg348741
2019-07-25 16:02:38shihai1991create