Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#431 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
50/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, macos
Lĩnh vực
operating-systems

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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]
Ngôn ngữ chính
C
Star
273
Fork
29
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sysprog21/elfuse

Tất cả issue của sysprog21/elfuse

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.