how could I intercept linux sys calls?

前端 未结 9 2135
夕颜
夕颜 2020-11-28 07:31

Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for

9条回答
  •  情歌与酒
    2020-11-28 08:05

    Using SystemTap may be an option.

    For Ubuntu, install it as indicated in https://wiki.ubuntu.com/Kernel/Systemtap.

    Then just execute the following and you will be listening on all openat syscalls:

    # stap -e 'probe syscall.openat { printf("%s(%s)\n", name, argstr) }'
    openat(AT_FDCWD, "/dev/fb0", O_RDWR)
    openat(AT_FDCWD, "/sys/devices/virtual/tty/tty0/active", O_RDONLY)
    openat(AT_FDCWD, "/sys/devices/virtual/tty/tty0/active", O_RDONLY)
    openat(AT_FDCWD, "/dev/tty1", O_RDONLY)
    

提交回复
热议问题