Wild pointer detected with ASAN during source build
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Hi,
We have a regression test system based on Python in Windows OS. Recently we updated to VS 2022 and investigated using the Address Sanitizer feature - https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170
In order for us to utilise the feature we need to python from source with the compile option /fsanitize=address enabled.
we have tried with 3.8.1 and 3.9.13 (we tried with latest 3.10.7 but encounter an issue with nuget.exe fetching python
x86 - https://stackoverflow.com/questions/73411602/unable-to-find-package-pythonx86-via-nuget)
On both 3.81 and 3.9.13 we are able to build from source python with no issue however with address sanitizer enabled we encounter the following wild pointer error :
==5104==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x02302010 at pc 0x68d65232 bp 0x00cfefbc sp 0x00cfefb0
READ of size 4 at 0x02302010 thread T0
**** CALL STACK ****
Address 0x02302010 is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow C:\Users\livuser\Downloads\Python-3.9.13\Python-3.9.13_pre\Objects\obmalloc.c:1420 in address_in_range
Shadow bytes around the buggy address:
**** VISUAL OF BUGGY MEMORY ****
Full output of build.bat is attached as output.log
To set up it is a little tedious as each project file (.vcproj) used in the pcbuild solution requires the following lines adding since we don't have easy access to the compile commands through the bat file
VCPROJ addition (had to remove < these braces > due to text editor hiding entries):
PropertyGroup
EnableASAN true /EnableASAN
/PropertyGroup
Has Python been built with the address sanitizer tool enabled? In Linux it is easy as we can just apply LD_PRELOAD to provide the address sanitizer as a shared library but this is less trivial in Windows OS which is our primary use case.
Thanks in advance for any input on this issue!
Richard
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với output.log được đính kèm và Objects/obmalloc.c tại address_in_range (dòng 1420), sau đó xem xét build.bat và các tệp dự án pcbuild nơi /fsanitize=address đã được thêm vào. Tái hiện bản build mã nguồn Windows với ASAN và xác định liệu quyền truy cập allocator được báo cáo có phải là vấn đề của bản build được hỗ trợ hay là một lỗi; được xem là hoàn tất khi đã xác nhận nguyên nhân và có độ bao phủ hồi quy hoặc có giới hạn được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- build-system, testing-qa
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100