Wild pointer detected with ASAN during source build

オープン
#96,714 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

添付された output.log と Objects/obmalloc.c の address_in_range(1420 行目)から着手し、その後、/fsanitize=address が追加された build.bat と pcbuild プロジェクトファイルを確認します。ASAN を有効にした Windows ソースビルドを再現し、報告された allocator へのアクセスがサポート対象ビルドの問題なのか欠陥なのかを判断します。完了の条件は、原因が確認され、回帰テストのカバレッジが追加されるか、文書化された制限事項があることです。

索引モデルが issue の本文から書いたものです。

説明

OS-windows type-bug

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


output.log

主要言語
Python
スター
77.2k
フォーク
36k
平均マージ
1日 9時間
マージ済み PR(30日)
558

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/cpython のほかの issue

python/cpython の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。