[issue39584] multiprocessing.shared_memory: MacOS crashes by running attached Python code

Vinay Sharma report at bugs.python.org
Wed Aug 12 09:50:14 EDT 2020


Vinay Sharma <vinay0410sharma at gmail.com> added the comment:

I have 8GB of ram and 128 GB of hard disk.

Now, creating a shared memory segment of size 10^12 (1 terabyte) somehow succeeds.

Creating a shared memory segment of 10^15 (1 petabyte), mmap (not ftruncate) throws an error stating cannot allocate memory.

Creating a shared memory segment of 10^18 (1 exabyte), causes the system to crash.

Now, I understand that this should be documented for a genuine user.

But, if documented this can be used by malicious softwares using python to crash systems abruptly.

Also, I understand that this is an issue with macos, but shouldn't python handle this so that atleast python's APIs are safe.

Creating shared memory segments of size 1 exabyte are not reasonable, but if some makes a mistake then, we must throw an error instead of a crash.

Also, can we set a max limit on creating shared memory segments to 1TB ?
because no one would genuinily need to create a segment of that size on a single machine.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39584>
_______________________________________


More information about the Python-bugs-list mailing list