How to change a string type argument of a system call?

Neo Liu diabloneo@gmail.com
Tue Apr 6 08:25:00 GMT 2010


I use method 2 and it does work.
I probe the "kernel.function("do_filp_open")". do_filp_open() function
executed after
the getname() function and the getname() function copy the filename
from the user space
to kernel space, at this point I can allocate a new page in the kernel
space and store
the new filename in it to replace original filename. I upload my new code in the
attachement.

But, I think the ability to allocate some new memory area in the user space is a
better way than this kernel way.

On Tue, Apr 6, 2010 at 11:59 AM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Josh Stone <jistone@redhat.com> writes:
>
>> [...]
>> Correct -- the open syscall gets the filename using strncpy_from_user,
>> which verifies that the pointer is within the user's address space.
>>
>> I can think of a few options for you:
>> [...]
>
> 5) use set_fs(KERN_DS) in some entry-probe-time embedded-c, with
>   a corresponding set_fs(USER_DS) or whatnot at return-probe-time.
>
>
> - FChE
>



More information about the Systemtap mailing list