[PATCH/RFC] strace: use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks

Denys Vlasenko dvlasenk at redhat.com
Fri Jan 27 16:03:17 UTC 2012


On 01/20/2012 12:24 PM, Denys Vlasenko wrote:
> This is a patch which uses process_vm_readv() in umoven() and umovestr()
> functions if possible, with fallback to old method if process_vm_readv()
> returns ENOSYS.
>
> There is a slight change in API: since I read data in blocks of 256 bytes,
> now umovestr() may overwrite data in the buffer past terminating NUL.
> One caller used to depend on guarantee that this never happens, but
> I just committed a small patch which reworks that place to remove
> this assumption.
>
> I don't have a kernel where process_vm_readv() syscall actually works,
> so the patch definitely needs to wait until it can be tested for real.

And now I do have the kernel, and the patch seems to work great.

Three runs of "time ./strace -oLOG ls -l /usr/lib >/dev/null"

before patch:
real	0m0.389s
real	0m0.372s
real	0m0.343s

After patch:
real	0m0.257s
real	0m0.275s
real	0m0.262s

-- 
vda




More information about the Strace-devel mailing list