Closed ricostrong closed 5 years ago
It might be that the default memory limit is not sufficient for Python 3.
afl-showmap
is the go-to tool for debugging unexpected crashes. What happens when you run:
py-afl-showmap -o /dev/null -- python3 python_afl_fuzz.py < fuzz/in/aaa
?
yee@haw:~/fuzz/python$ py-afl-showmap -o /dev/null -- python3 python_afl_fuzz.py < fuzz/in/aaa
afl-showmap 2.52b by <lcamtuf@google.com>
[*] Executing '/usr/bin/python3'...
-- Program output begins --
-- Program output ends --
+++ Program killed by signal 10 +++
[+] Captured 8 tuples in '/dev/null'.
hmmm.. I am not sure if it's the memory limit that's the issue, because running py-afl-fuzz with the '-m none' flag doesn't change anything.
Could you put PYTHON_AFL_SIGNAL=0
in environment and try py-afl-showmap
again?
(For the avoidance of doubt, this for debugging only. You should not be fuzzing with PYTHON_AFL_SIGNAL=0
set.)
afl-showmap 2.52b by <lcamtuf@google.com>
[*] Executing '/usr/bin/python3'...
-- Program output begins --
Traceback (most recent call last):
File "python_afl_fuzz.py", line 21, in <module>
main()
File "python_afl_fuzz.py", line 11, in main
s = sys.stdin.read()
File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 0: invalid start byte
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so: failed to map segment from shared object
Original exception was:
Traceback (most recent call last):
File "python_afl_fuzz.py", line 21, in <module>
main()
File "python_afl_fuzz.py", line 11, in main
s = sys.stdin.read()
File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 0: invalid start byte
-- Program output ends --
[+] Captured 8930 tuples in '/dev/null'.
Oh well, after googling a bit more it turns out that reading stdin changed from python2 to python3 s = sys.stdin.read() in python3 is s = sys.stdin.buffer.read(), and sys.stdin.read() isn't an invalid function, so i missed it.
My bad, and thanks for your help.
Hey, it seems like python-afl can have different behaviour depending on the python version. My python-afl script works correctly under python2, however it does not work as well in python3
Do you know what might be the issue here?