This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to change a string type argument of a system call?
On Sun, Apr 4, 2010 at 9:54 AM, Neo Liu <diabloneo@gmail.com> wrote:
> I write a script to monitor the open syscall of a target process. In the probe
> handler, I want to replace the $filename argument of the sys_open, so I can
> make the sys_open open another file. In order to achieve this purpose, I use
> __get_free_page() to allocate a new memory page (the page is in kernel spaces,
> the address is higher than 0xC0000000), put a new filename in this
> memory page, and let $filename parameter points to this new page. So, the
> $filename contains a new filename string. However, the open syscall returns
> failure. Is this because the open syscall can't access an address in the kernel
> spaces?
>
> The three attachments are my example codes and stap output.
> I use the following command line:
> $gcc -o fopen fopen.c
> $sudo stap -g open.stp -c ./fopen
>
>