GithubHelp home page GithubHelp logo

kfiros / execmon Goto Github PK

View Code? Open in Web Editor NEW
84.0 6.0 31.0 495 KB

Advanced process execution monitoring utility for linux (procmon like)

License: Apache License 2.0

Makefile 0.22% C 99.78%
kernel syscalls linux process-monitor linux-kernel linux-process-monitor kernel-module c execve hooks

execmon's Issues

execmon is unable to run on kernels >= 4.6

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

make error in ubuntu 18.04

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"

after insmod execmon.ko,run gcc is segfault

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?

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.