fallocate on a read-only descriptor does not fail with EBADF
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c, linux
- Ambito
- operating-systems
Direzione di ricerca
Start with sys_fallocate in src/syscall/io.c and the aarch64 probe described in the issue. Compare the access-mode check order with Linux vfs_fallocate and run the probe for both ranges on an O_RDONLY descriptor. Done when every supported mode returns EBADF before checking file size, matching the reference kernel.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
vfs_fallocate (Linux fs/open.c) refuses a descriptor that is not open for writing with EBADF, after the offset, length and mode checks and before it looks at the file size. elfuse's sys_fallocate (src/syscall/io.c:3465 on e9fdbbb) never checks the access mode. For mode 0 it calls host ftruncate only when the request grows the file, so a read-only descriptor gets one of two wrong answers:
fallocate(fd, 0, off, len) on an O_RDONLY fd, file size 200 |
Linux | elfuse |
|---|---|---|
grows the file (0, 400) |
-1, EBADF | -1, EINVAL (from host ftruncate) |
stays within the file (0, 100) |
-1, EBADF | 0 |
The second row reports success for a call Linux refuses.
Goal
fallocate on a descriptor not open for writing fails with EBADF in every mode elfuse supports, ahead of any size check, as on Linux.
Evidence
A static aarch64 probe creates a 200-byte file, reopens it O_RDONLY and calls fallocate with the two ranges above. elfuse built from e9fdbbb gives the elfuse column, and the qemu reference kernel used by make test-matrix-qemu-aarch64 gives the Linux column.
Found while adding RLIMIT_FSIZE enforcement (#448 follow-up 1): the new test-rlimit-fsize only checks that the call fails there without SIGXFSZ, not which errno it returns.
- Lingua principale
- C
- Stelle
- 275
- Fork
- 29
- Merge medio
- 2g 22h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sysprog21/elfuse
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di sysprog21/elfuse
Issue simili
-
[mimalloc] update to 3.6.0Apertacategory:port-update
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 2 giorni
-
emerge failure MARK mark-unstable media-kit
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
macaroni-os/mark-issues#834 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
webarkit/WebARKitLib#107 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno