Coder Social home page Coder Social logo

where_are_my_files's Introduction

where_are_my_files

一个小工具,可以用于寻找内核中一些结构体成员的偏移量。

该内核模块仅几行代码,并且没有任何危险操作(其实连操作都没有,不信你看代码),可以放心加载到任何内核中。

目前支持的偏移量显示:

  1. struct task_struct中成员files的偏移量。
  2. struct file中成员f_op的偏移量。
  3. struct file中成员private_data的偏移量。

开发eBPF可观测系统并且内核没有BTF时,会用到此工具。

使用方法

# 拉代码
git clone https://github.com/ic0xgkk/where_are_my_files.git
cd where_are_my_files
# 编译
make build
# 安装模块
make install
# 加载模块
modprobe wamf
# 卸载模块
rmmod wamf
# 查看输出
dmesg | grep wamf

dmesg中,就可以看到输出了。

# dmesg | grep wamf
[621994.500286] wamf: task_struct->files_struct(files) offset: 3048, task_struct size: 9792 
[621994.500552] wamf: file->file_operations(f_op) offset: 40, file size: 232 
[621994.500749] wamf: file->void *(private_data) offset: 200, file size: 232

完成上边的命令后(尤其记得执行rmmod卸载),就可以删除了。

where_are_my_files's People

Contributors

ic0xgkk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.