Commit eea9673
committed
exec: Add exec_update_mutex to replace cred_guard_mutex
The cred_guard_mutex is problematic as it is held over possibly
indefinite waits for userspace. The possible indefinite waits for
userspace that I have identified are: The cred_guard_mutex is held in
PTRACE_EVENT_EXIT waiting for the tracer. The cred_guard_mutex is
held over "put_user(0, tsk->clear_child_tid)" in exit_mm(). The
cred_guard_mutex is held over "get_user(futex_offset, ...") in
exit_robust_list. The cred_guard_mutex held over copy_strings.
The functions get_user and put_user can trigger a page fault which can
potentially wait indefinitely in the case of userfaultfd or if
userspace implements part of the page fault path.
In any of those cases the userspace process that the kernel is waiting
for might make a different system call that winds up taking the
cred_guard_mutex and result in deadlock.
Holding a mutex over any of those possibly indefinite waits for
userspace does not appear necessary. Add exec_update_mutex that will
just cover updating the process during exec where the permissions and
the objects pointed to by the task struct may be out of sync.
The plan is to switch the users of cred_guard_mutex to
exec_update_mutex one by one. This lets us move forward while still
being careful and not introducing any regressions.
Link: https://lore.kernel.org/lkml/[email protected]/
Link: https://lore.kernel.org/lkml/AM6PR03MB5170B06F3A2B75EFB98D071AE4E60@AM6PR03MB5170.eurprd03.prod.outlook.com/
Link: https://lore.kernel.org/linux-fsdevel/[email protected]/
Link: https://lore.kernel.org/lkml/[email protected]/
Link: https://lore.kernel.org/lkml/[email protected]/
Ref: 45c1a15 ("Add PTRACE_O_TRACEVFORKDONE and PTRACE_O_TRACEEXIT facilities.")
Ref: 456f17c ("[PATCH] user-vm-unlock-2.5.31-A2")
Reviewed-by: Kirill Tkhai <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: Bernd Edlinger <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>1 parent ccf0fa6 commit eea9673
File tree
5 files changed
+36
-5
lines changed- fs
- include/linux
- sched
- init
- kernel
5 files changed
+36
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
1013 | 1018 | | |
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
| 1022 | + | |
1017 | 1023 | | |
1018 | 1024 | | |
1019 | 1025 | | |
1020 | 1026 | | |
1021 | 1027 | | |
1022 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1023 | 1033 | | |
1024 | 1034 | | |
1025 | 1035 | | |
| |||
1031 | 1041 | | |
1032 | 1042 | | |
1033 | 1043 | | |
| 1044 | + | |
1034 | 1045 | | |
1035 | 1046 | | |
1036 | 1047 | | |
| 1048 | + | |
1037 | 1049 | | |
1038 | 1050 | | |
1039 | 1051 | | |
| |||
1288 | 1300 | | |
1289 | 1301 | | |
1290 | 1302 | | |
1291 | | - | |
1292 | | - | |
| 1303 | + | |
| 1304 | + | |
1293 | 1305 | | |
1294 | 1306 | | |
1295 | 1307 | | |
| 1308 | + | |
1296 | 1309 | | |
1297 | 1310 | | |
1298 | 1311 | | |
| |||
1438 | 1451 | | |
1439 | 1452 | | |
1440 | 1453 | | |
| 1454 | + | |
| 1455 | + | |
1441 | 1456 | | |
1442 | 1457 | | |
1443 | 1458 | | |
| |||
1487 | 1502 | | |
1488 | 1503 | | |
1489 | 1504 | | |
| 1505 | + | |
1490 | 1506 | | |
1491 | 1507 | | |
1492 | 1508 | | |
| |||
1678 | 1694 | | |
1679 | 1695 | | |
1680 | 1696 | | |
1681 | | - | |
| 1697 | + | |
1682 | 1698 | | |
1683 | 1699 | | |
1684 | 1700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
228 | 235 | | |
229 | 236 | | |
230 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1594 | 1594 | | |
1595 | 1595 | | |
1596 | 1596 | | |
| 1597 | + | |
1597 | 1598 | | |
1598 | 1599 | | |
1599 | 1600 | | |
| |||
0 commit comments