Commit c435e93
authored
fix(exec): clean robust futex state before mm replacement (#2191)
Successful exec replaced the current address space while leaving the task's robust-list registration pointing into the old mm. A later task exit attempted to walk that stale userspace list, producing recoverable missing-VMA faults and skipping the required owner-death transition.
Take robust-list ownership exactly once and reuse one cleanup core for exit and exec. During the successful exec commit, temporarily restore the old mm, perform best-effort owner-death cleanup, and switch back to the new mm. Keep failed exec paths unchanged.
Align exec mm switching with the scheduler's active-CPU and TLB ordering. Replace raw userspace AtomicU32 operations with exception-table-protected cmpxchg implementations for x86_64, RISC-V, and LoongArch, including 32-bit sign-extension and weak LL/SC ordering requirements. Validate robust entries, preserve PI and pending metadata, use namespace-visible task IDs, and stop safely on malformed userspace state.
Defer missing-VMA diagnostics until exception-table recovery fails so expected nofault accesses do not emit misleading errors. Add exec ABI coverage for owner-death cleanup, registration reset, deterministic read-only futex faults, and early and late exec failure preservation.
Signed-off-by: longjin <longjin@dragonos.org>1 parent 567e2b1 commit c435e93
6 files changed
Lines changed: 501 additions & 129 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 350 | + | |
359 | 351 | | |
360 | | - | |
| 352 | + | |
361 | 353 | | |
362 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
| 472 | + | |
481 | 473 | | |
482 | | - | |
| 474 | + | |
483 | 475 | | |
484 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
485 | 486 | | |
486 | 487 | | |
487 | 488 | | |
| |||
0 commit comments