Commit 9fe7655
Restore `subprocess`'s intended use of `vfork()` by default for performance on Linux;
also fixes the behavior of `extra_groups=[]` which was unintentionally broken in 3.12.0:
Fixed a performance regression in 3.12's :mod:`subprocess` on Linux where it
would no longer use the fast-path ``vfork()`` system call when it could have
due to a logic bug, instead falling back to the safe but slower ``fork()``.
Also fixed a security bug introduced in 3.12.0. If a value of ``extra_groups=[]``
was passed to :mod:`subprocess.Popen` or related APIs, the underlying
``setgroups(0, NULL)`` system call to clear the groups list would not be made
in the child process prior to ``exec()``.
The security issue was identified via code inspection in the process of
fixing the first bug. Thanks to @vain for the detailed report and
analysis in the initial bug on Github.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent c5fa8a5 commit 9fe7655
File tree
3 files changed
+38
-23
lines changed- Lib/test
- Misc/NEWS.d/next/Library
- Modules
3 files changed
+38
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2066 | 2066 | | |
2067 | 2067 | | |
2068 | 2068 | | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
2069 | 2076 | | |
2070 | | - | |
2071 | 2077 | | |
2072 | 2078 | | |
2073 | 2079 | | |
| |||
2077 | 2083 | | |
2078 | 2084 | | |
2079 | 2085 | | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | | - | |
| 2086 | + | |
| 2087 | + | |
2085 | 2088 | | |
2086 | 2089 | | |
2087 | 2090 | | |
| |||
2092 | 2095 | | |
2093 | 2096 | | |
2094 | 2097 | | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
| 2098 | + | |
2099 | 2099 | | |
2100 | | - | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
2101 | 2107 | | |
2102 | 2108 | | |
2103 | 2109 | | |
| |||
2106 | 2112 | | |
2107 | 2113 | | |
2108 | 2114 | | |
2109 | | - | |
2110 | | - | |
2111 | | - | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
2115 | | - | |
2116 | | - | |
2117 | | - | |
2118 | | - | |
2119 | 2115 | | |
2120 | 2116 | | |
2121 | 2117 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
770 | | - | |
| 770 | + | |
| 771 | + | |
771 | 772 | | |
| 773 | + | |
772 | 774 | | |
773 | 775 | | |
774 | 776 | | |
| |||
1022 | 1024 | | |
1023 | 1025 | | |
1024 | 1026 | | |
1025 | | - | |
1026 | 1027 | | |
1027 | 1028 | | |
1028 | 1029 | | |
| |||
1103 | 1104 | | |
1104 | 1105 | | |
1105 | 1106 | | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
1106 | 1114 | | |
1107 | 1115 | | |
1108 | 1116 | | |
| |||
0 commit comments