百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Z

zeromaps

> 编程语言
开源

一个没有内存的"活动"Linux 进程

350 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个没有内存的"活动"Linux 进程

A "living" Linux process with no memory

tl;dr

  • thread1 goes into uninterruptible sleep
  • thread2 unmaps everything and segfaults
  • segv can't kill the process because of thread1's D state
  • /proc/pid/maps is now empty
  • ???
  • PROFIT!!! Implementation details

This code gets a list of all memory maps from /proc/self/maps, then creates a new executable map where it jits some code that calls munmap() on each of the maps it just got, and finally on the map it's on. This is just a quick example with no portability in mind, so the source code contains the actual bytes that would be emitted by a x64 compiler. After unmapping the final map, where the jit code lies, there's no new instruction to execute and a segfault is raised.

This segfault can't kill the entire process if one thread is stuck in uninterruptible sleep. To reliably send a thread in such state, we create a simple FUSE filesystem in python, in which doing anything on a particular file will block until a key is pressed.

This code also does its own "linking" to make sure that the list of maps doesn't get unmapped too early.

Requirements

  • a c compiler
  • python2 + fuse
  • x64
  • a modern Linux with no vsyscall page (this page is too high up and munmap would return EINVAL)

Why

I don't know. I thought it was funny.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言