How to do Binary instrumentation of syscall brk ? (x86-64 Linux) (maybe valgrind?)

后端 未结 2 1347
一整个雨季
一整个雨季 2021-01-16 23:44

I\'d like to instrument syscall brk (and other calls but this in first order, it\'s most important to me) in given binary (preferably on actual syscall/sysenter lev

2条回答
  •  广开言路
    2021-01-17 00:10

    LD_PRELOAD will trap C calls to brk(), but it won't trap the actual system call (int/syscall instruction). There's no portable way to trap those, but on Linux, ptrace will do it. Memory can also be allocated to a program by mmap(), so you'll need to intercept that call too.

    Of course, what it seems you're really looking for is rlimit().

提交回复
热议问题