mmap of non-mappable character devices succeeds

Offen
#499 1 Kommentar 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, linux

Rechercherichtung

Start by tracing the mmap handling and mmap_refused_errno logic, then compare how character-device and anon-inode file descriptors are classified. The issue gives /dev/null, /dev/urandom, /dev/zero, and several anon-inode descriptors as cases to investigate. Done means the no-limit and over-limit results match Linux for these cases, including ENODEV for devices that cannot be mapped.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

mmap of a character device that Linux cannot map succeeds under elfuse. Linux returns ENODEV, because the device's file operations have no mmap.

Measured with a probe, under elfuse at #485 (6fbbc9f) and on Linux:

fd Linux, no limit elfuse, no limit Linux, over RLIMIT_AS elfuse, over RLIMIT_AS
/dev/null ENODEV maps ENODEV ENOMEM
/dev/urandom ENODEV maps ENODEV ENOMEM
/dev/zero maps maps ENOMEM ENOMEM
eventfd, epoll, timerfd, signalfd ENODEV other errno ENODEV ENODEV

"Over RLIMIT_AS" is an 8 GiB MAP_PRIVATE PROT_READ request with the limit at 4 GiB. The probe found two gaps:

  • Character devices: elfuse does not track which ones can be mapped. A fix would decide this per device (for example, allow /dev/zero and refuse the others with ENODEV) on the no-limit path. The over-limit path in mmap_refused_errno would then use the same check.
  • Anon-inode fds: with no limit set, they return a different errno than Linux's ENODEV.

Raised by review on #485 (r4506898326).

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.