[Bug] musl __pthread_exit thread-list use-after-free under concurrent thread exit (RT-Thread Smart, SMP)

Aperta
#11,932 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Read the attached report and inspect musl's __tl_lock/__tl_sync synchronization and thread-list unlinking in __pthread_exit. Reproduce with the attached tl_race.c command (./tl_race 1000 8) on RT-Thread Smart with SMP and AArch64, then trace the lock behavior during concurrent exits. Done means concurrent create/exit no longer corrupts the thread list or crashes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Arch: ARM/AArch64 bug RT-Smart
RT-Thread Version

5.2.2

Affected area

RT-Smart

Hardware/BSP vendor

Not applicable / Other

Architecture

ARM / AArch64

Board and hardware details

N/A

Develop Toolchain

GCC

Describe the bug

Concurrent pthread_create/exit crashes user processes on RT-Thread Smart 5.2.2 (SMP, aarch64, musl 1.2.5) inside musl_pthread_exit:
thread-list unlink writes to a thread descriptor already freed/unmapped (Data Abort), or a thread's return address is corrupted to 0 (Instruction Abort). Root cause: the futex-based __tl_lock/__tl_sync fails to provide mutual exclusion for musl's thread-list under concurrent exit on SMP, corrupting the doubly-linked list – entirely user-space, kernel futex is structurally correct.
(tl_race.c, attached): ./tl_race 1000 8 crashes after a few hundred rounds. Details in the attached report.

musl pthread_exit thread-list UAF.md

Other additional context

No response

Lingua principale
C
Stelle
12.4k
Fork
5.5k
Merge medio
3g 7h
PR unite (30g)
79

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RT-Thread/rt-thread

Tutte le issue di RT-Thread/rt-thread

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.