kfiros / execmon Goto Github PK
View Code? Open in Web Editor NEWAdvanced process execution monitoring utility for linux (procmon like)
License: Apache License 2.0
Advanced process execution monitoring utility for linux (procmon like)
License: Apache License 2.0
https://github.com/alexandernst/monks
Maybe we can join forces? Your project pretty much covers the missing parts of mine (patching execv and similar stubs) and mine covers the missing parts of yours (patching "normal" syscalls).
Hi Kfir, thanks for this awesome utility. It helped me a lot.
Your utility, execmon, works well on kernels up till 4.5. I'd tested it on Ubuntu 16.04 with kernel 4.4.
Till kernel 4.5, assembly stubs had been used to call sys_execve and by patching call sys_execve
in stub_execve
did the job. Awesome !
But starting from 4.6 these stubs had been changed and now ptregs_sys_execve
is a replace of stub_execve
. But it's highly different than older stubs. Now registers are being used to store the real syscall address and there are two way calls 'slow_path' and 'fast_path'.
I'd tried hard but failing to make some logic that how to patch execve calls in this new scheme. Could you please spare some time to have a look and find some clues to upgrading execmon to work for kernels greater than 4.5.
thanks
In [49]: !make
make -C /lib/modules/5.4.0-132-generic/build M=/home/qgb/github/execmon/kmod
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-132-generic'
CC /home/qgb/github/execmon/kmod/libudis86/decode.o
/home/qgb/github/execmon/kmod/libudis86/decode.c: In function ‘decode_operand’:
/home/qgb/github/execmon/kmod/libudis86/decode.c:744:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
u->br_far = 1;
~~~~~~~~~~~^~~
/home/qgb/github/execmon/kmod/libudis86/decode.c:746:5: note: here
case OP_M:
^~~~
/home/qgb/github/execmon/kmod/libudis86/decode.c:747:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (MODRM_MOD(modrm(u)) == 3) {
^
/home/qgb/github/execmon/kmod/libudis86/decode.c:751:5: note: here
case OP_E:
^~~~
/home/qgb/github/execmon/kmod/libudis86/decode.c:766:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (MODRM_MOD(modrm(u)) != 3) {
^
/home/qgb/github/execmon/kmod/libudis86/decode.c:770:5: note: here
case OP_Q:
^~~~
/home/qgb/github/execmon/kmod/libudis86/decode.c:777:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (MODRM_MOD(modrm(u)) != 3) {
^
/home/qgb/github/execmon/kmod/libudis86/decode.c:781:5: note: here
case OP_W:
^~~~
CC /home/qgb/github/execmon/kmod/libudis86/itab.o
CC /home/qgb/github/execmon/kmod/libudis86/udis86.o
AR /home/qgb/github/execmon/kmod/libudis86/built-in.a
AR /home/qgb/github/execmon/kmod/built-in.a
CC [M] /home/qgb/github/execmon/kmod/main.o
CC [M] /home/qgb/github/execmon/kmod/mem.o
CC [M] /home/qgb/github/execmon/kmod/syscalls.o
CC [M] /home/qgb/github/execmon/kmod/comm.o
CC [M] /home/qgb/github/execmon/kmod/proto.o
make[2]: *** No rule to make target '/home/qgb/github/execmon/kmod/libudis86/built-in.o', needed by '/home/qgb/github/execmon/kmod/execmon.o'. Stop.
Makefile:1765: recipe for target '/home/qgb/github/execmon/kmod' failed
make[1]: *** [/home/qgb/github/execmon/kmod] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-132-generic'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2
sys info
In [38]: !uname -a
Linux ubuntu 5.4.0-132-generic #148~18.04.1-Ubuntu SMP Mon Oct 24 20:41:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
In [39]: !cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"
kernel version 4.13.0 make error: error adding symbols: Archive has no index; run ranlib to add one
why?
I have tried.I insmmod execmon.ko ,execve moniter is normal.
but , The system GCC is abnormal, gcc hello.c is failed.
open /var/log/message
371 May 16 13:41:47 localhost kernel: gcc[21267]: segfault at 7fff30ab8d31 ip 00007fff30ab8d31 sp 00007fff30ab7848 error 15
372 May 16 13:41:47 localhost kernel: Process 21267(gcc) has RLIMIT_CORE set to 0
373 May 16 13:41:47 localhost kernel: Aborting core
rmmod execvemon.ko
gcc is normal.
Did you see this problem as well?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.