Skip to content

SIGBUS: writing to mmaped device beyond file size #119817

Description

@Semnodime

Crash report

What happened?

# DEV=/dev/foo# blockdev --getsize64 $DEV
1048576
# tail $DEV# python3.12 bug.py
Bus error (core dumped)
# tail $DEV
hell#
frommmapimportmmapwithopen('/dev/foo', 'r+b') asfile:
m=mmap(file.fileno(), 1024**2+1)
m.seek(1024**2-4)
forbinb'hello world!':
m.write(bytes([b]))

I hope you don't mind my reference to Madagascar

CPython versions tested on:

3.12

Operating systems tested on:

Linux

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

Python 3.12.3 (main, Apr 27 2024, 19:00:21) [GCC 11.4.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions