Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`readlink` of `/proc/self/fd/N` is `ENOENT` for a pipe, a socket or an eventfd

Aperta
#431 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
50/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c, macos

Direzione di ricerca

Start at intercept_readlink_dispatch in src/runtime/procemu.c, which answers /proc/self/fd/N from fcntl(F_GETPATH), and check why that call fails for pipes, sockets and eventfds. Build the reproducer from the issue and compare its output with the Linux 6.12 column. Done when all three descriptors return a kind name in the pipe:[N], socket:[N] or anon_inode:[eventfd] form instead of ENOENT.

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

Descrizione

bug

intercept_readlink_dispatch (src/runtime/procemu.c) answers /proc/self/fd/N with the host path of the host fd, from fcntl(F_GETPATH). A descriptor with no path fails that call (EBADF on macOS 27.0.1 for a pipe), and the guest gets ENOENT. Linux names such a descriptor by its kind.

Reproducer:

#include <errno.h>
#include <stdio.h>
#include <sys/eventfd.h>
#include <sys/socket.h>
#include <unistd.h>

static void show(const char *what, int fd)
{
    char link[64], target[64];
    snprintf(link, sizeof(link), "/proc/self/fd/%d", fd);
    errno = 0;
    long n = readlink(link, target, sizeof(target) - 1);
    target[n < 0 ? 0 : n] = '\0';
    printf("%-8s %ld errno=%d %s\n", what, n, errno, target);
}

int main(void)
{
    int p[2], sv[2];
    pipe(p);
    socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
    show("pipe", p[0]);
    show("socket", sv[0]);
    show("eventfd", eventfd(0, 0));
    return 0;
}
pipe socket eventfd
elfuse b57f367 -1, ENOENT -1, ENOENT -1, ENOENT
Linux 6.12 under qemu pipe:[181] socket:[182] anon_inode:[eventfd]
Lingua principale
C
Stelle
273
Fork
29
Merge medio
2g 3h
PR unite (30g)
14

Preparare l'ambiente

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

Tutte le issue di sysprog21/elfuse

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.