Re: [PATCH v5 3/14] User Space Breakpoint Assistance Layer

Srikar Dronamraju
2010-06-22T05:48:10Z

> > +/**
> > + * user_bkpt_write_data - Write @nbytes from @kbuf at @vaddr in @tsk.
> > + * Can be used to write to stack or data VM areas, but not instructions.
> > + * Not exported, but available for use by arch-specific user_bkpt code.
> > + * @tsk: The probed task
> > + * @vaddr: Destination address, in user space.
> > + * @kbuf: Source address, in kernel space to be read.
>
> I'm curious. Anything prevent this from being called on instructions, or
> is this just "Don't do that?".
>

Both,
copy_to_user doesnt work on writes to text.
And if I am right, copy_to_user isnt preferred while writing to text
pages too.

> > +
> > + memcpy(vaddr_new, vaddr_old, PAGE_SIZE);
> > + /* poke the new insn in, ASSUMES we don't cross page boundary */
> > + vaddr = vaddr & (PAGE_SIZE - 1);
>
> This should probably be vaddr = vaddr & ~PAGE_MASK;

Okay, I will make the corresponding change.
>
>