mmap of non-mappable character devices succeeds

未关闭
#499 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, linux

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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).

主要语言
C
星标
287
派生
33
平均合并
2 天 17 小时
30 天内合并 PR
18

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sysprog21/elfuse 的其他 Issue

查看 sysprog21/elfuse 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。