SysV shm: write back on munmap and drop attaches at exec

Offen
#497 3 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
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
c, macos

Rechercherichtung

Start by tracing the SysV shared memory attach records and the sys_munmap and exec paths; the issue names shm_retire_unmapped as the lazy cleanup to revisit. Reproduce the described probe: attach, write W, call munmap, then attach again and read the value. Done means writes persist after unmapping and old-image attaches are dropped at exec.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Follow-up to #485 (review comment r4504029776).

An attach is released only lazily: the next shmat or shmdt retires records whose serial no region carries. Two cases still differ from Linux:

  • After execve, the new image may never call shmat or shmdt, so every attach of the old image keeps its host attach until the process exits. This also keeps an IPC_RMIDed segment alive.
  • When the guest munmaps an attach without shmdt, its writes are lost. On Linux those pages are the segment, so the writes persist.

Measured with a probe that runs shmat, writes W, calls munmap and attaches again: Linux reads W, and elfuse reads 0.

Proposed fix: write back and detach from the sys_munmap path, and write back and drop every record at exec. This would also make the lazy sweep in shm_retire_unmapped unnecessary.

Vorherrschende Sprache
C
Sterne
287
Forks
33
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
18

Entwicklungsumgebung

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 sysprog21/elfuse

Alle Issues in sysprog21/elfuse

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

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