Commit 85bbfa8
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.
(cherry picked from commit 9fe7655)
+ Reword NEWS for the bugfix/security release. (mentions the assigned CVE number)
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 494cd50 commit 85bbfa8
3 files changed
Lines changed: 37 additions & 23 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
| 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: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
685 | | - | |
| 685 | + | |
| 686 | + | |
686 | 687 | | |
| 688 | + | |
687 | 689 | | |
688 | 690 | | |
689 | 691 | | |
| |||
937 | 939 | | |
938 | 940 | | |
939 | 941 | | |
940 | | - | |
941 | 942 | | |
942 | 943 | | |
943 | 944 | | |
| |||
1018 | 1019 | | |
1019 | 1020 | | |
1020 | 1021 | | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
1021 | 1029 | | |
1022 | 1030 | | |
1023 | 1031 | | |
| |||
0 commit comments