This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Disable thread and memory sanitizers for address_in_range()
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, izbyshev, miss-islington, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2018-11-09 22:33 by izbyshev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10442 merged izbyshev, 2018-11-09 22:36
PR 10470 merged miss-islington, 2018-11-11 23:15
PR 10471 merged miss-islington, 2018-11-11 23:15
Messages (5)
msg329561 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-11-09 22:33
address_in_range() in Objects/obmalloc.c may access memory that is mapped but is considered free by the underlying libc allocator. In #18596, address sanitizing was disabled for this function. But thread and memory sanitizers similarly trip on this function:

WARNING: ThreadSanitizer: heap-use-after-free (pid=24361)
  Read of size 4 at 0x7b7c00000020 by main thread:
    #0 address_in_range /scratch2/izbyshev/cpython/Objects/obmalloc.c:1312:23 (python+0x59e912)

==3515==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x9713f8 in address_in_range /scratch2/izbyshev/cpython/Objects/obmalloc.c:1313:35

I suggest to disable them for this function as well.
msg329562 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-11-09 22:40
I've submitted a PR which implements the change with additional cleanups.

GCC introduced TSan together with ASan in 4.8[1], but didn't provide a macro to test for -fsanitize=thread option until 7[2,3].

[1] https://gcc.gnu.org/gcc-4.8/changes.html
[2] https://gcc.gnu.org/onlinedocs/gcc-6.4.0/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros
[3] https://gcc.gnu.org/onlinedocs/gcc-7.1.0/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros
msg329692 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-11-11 23:14
New changeset fd3a91cbf93dd7bd97f01add9c90075d63cd7316 by Benjamin Peterson (Alexey Izbyshev) in branch 'master':
closes bpo-35204: Disable thread and memory sanitizers for address_in_range(). (GH-10442)
https://github.com/python/cpython/commit/fd3a91cbf93dd7bd97f01add9c90075d63cd7316
msg329694 - (view) Author: miss-islington (miss-islington) Date: 2018-11-11 23:44
New changeset 1ec5781a097f4d4d988e0dd7f51ee203dc639df2 by Miss Islington (bot) in branch '3.7':
closes bpo-35204: Disable thread and memory sanitizers for address_in_range(). (GH-10442)
https://github.com/python/cpython/commit/1ec5781a097f4d4d988e0dd7f51ee203dc639df2
msg329695 - (view) Author: miss-islington (miss-islington) Date: 2018-11-11 23:48
New changeset eff1c983eb0cc9bc011111e8eba07a42522cee57 by Miss Islington (bot) in branch '3.6':
closes bpo-35204: Disable thread and memory sanitizers for address_in_range(). (GH-10442)
https://github.com/python/cpython/commit/eff1c983eb0cc9bc011111e8eba07a42522cee57
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79385
2018-11-11 23:48:01miss-islingtonsetmessages: + msg329695
2018-11-11 23:44:37miss-islingtonsetnosy: + miss-islington
messages: + msg329694
2018-11-11 23:15:20miss-islingtonsetpull_requests: + pull_request9742
2018-11-11 23:15:12miss-islingtonsetpull_requests: + pull_request9741
2018-11-11 23:14:53benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg329692

stage: patch review -> resolved
2018-11-09 22:40:46izbyshevsetmessages: + msg329562
2018-11-09 22:36:46izbyshevsetkeywords: + patch
stage: patch review
pull_requests: + pull_request9714
2018-11-09 22:33:27izbyshevcreate