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

Offen
#11,932 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
c

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
C
Sterne
12.4k
Forks
5.5k
Ø Merge
3 T. 7 Std.
Gemergte PRs (30 T.)
79

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus RT-Thread/rt-thread

Alle Issues in RT-Thread/rt-thread

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.