python / cpython

The Python programming language
https://www.python.org
Other
63.33k stars 30.31k forks source link

Core dump with specific call of find_frozen #126171

Open federicovalenso opened 2 days ago

federicovalenso commented 2 days ago

Crash report

What happened?

>>> from importlib import _imp
>>> _imp.find_frozen("zipimport", withdata=True)
python3: Objects/memoryobject.c:733: PyMemoryView_FromMemory: Assertion `mem != ((void *)0)' failed.
Aborted (core dumped)

python is configured with --with-pydebug --with-trace-refs --with-assertions

I think it happens here

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.11.9 (main, Oct 30 2024, 09:46:33) [GCC 13.2.0]

sobolevn commented 2 days ago

@federicovalenso how do you find these problems? Do you use some kind of tooling for that?

ZeroIntensity commented 2 days ago

I'm guessing it's a static analyzer. Anyways, I can take a look at this later today, unless @picnixz has already started working on it.

picnixz commented 2 days ago

I'm guessing it's a static analyzer. Anyways, I can take a look at this later today, unless \@picnixz has already started working on it.

Please do so! I have some ongoing work elsewhere but I don't mind reviewing it!

federicovalenso commented 1 day ago

I'm sorry for late answer.

I'm guessing it's a static analyzer.

@sobolevn , @ZeroIntensity , you're right.

ZeroIntensity commented 1 day ago

We're fine with it as long as the crashes are actual bugs and not false positives (there have been false positive reports from static analyzers here in the past). But you seem to know what's real and what's not, keep doing what you're doing :)

picnixz commented 1 day ago

@ZeroIntensity I have some time now; do you want me to take on that task or were you already working on it?

ZeroIntensity commented 1 day ago

Go for it, I didn't get to this yesterday. I'll be happy to review your PR!

picnixz commented 1 day ago

Actually, I couldn't reproduce it on 3.12+ (even with the correct flags). It appears that it has been patched at some point. @federicovalenso can you 1) verify this 2) try to run your static analyzer tool on 3.12+ builds instead please? Thank you in advance!

federicovalenso commented 15 hours ago

@picnixz , yeah, I'll do that, but it requires some time.

picnixz commented 14 hours ago

No worries! If you can compile 3.12 on your side and try the same reproducer (just to see if it's my machine that is special or not) to confirm whether this bug still happens or not, I'd be willing to keep the issue opened (no need to bisect the commit for now). Otherwise, in order not to have a pending label for too long, I'd suggest closing this issue for now and come back later.

sobolevn commented 14 hours ago

Otherwise, in order not to have a pending label for too long, I'd suggest closing this issue for now and come back later.

There's no real problem in having an issue with the "pending" label :) Let's resolve the issue first: with finding the proper reproducer or with finding that it was fixed already. And then we can completelly close the issue.