New submission from Alexey Izbyshev <[email protected]>:
The following test demonstrates the leak:
```
import subprocess
cwd = 'x' * 10**6
for __ in range(100):
try:
subprocess.call(['/xxx'], cwd=cwd, user=2**64)
except OverflowError:
pass
from resource import *
print(getrusage(RUSAGE_SELF).ru_maxrss)
```
The leak was introduced by bpo-36046. Previously, `cleanup:` label was not
reachable after `cwd_obj2` was initialized at
https://github.com/python/cpython/blob/492d513ccbebeec40a8ba85cbd894a027ca5b2b3/Modules/_posixsubprocess.c#L892
I'll submit a PR with a simple fix suitable for backporting to 3.9.
Also, I think it might make sense to unify the two almost-identical cleanup
paths we have now. I'll follow up with another PR.
----------
assignee: izbyshev
components: Extension Modules
keywords: 3.9regression
messages: 379575
nosy: gregory.p.smith, izbyshev, patrick.mclean
priority: normal
severity: normal
status: open
title: subprocess.Popen() leaks cwd in case of uid/gid overflow
type: behavior
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42146>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com