Re: copy to suer space

Andreas Dilger
2001-11-20T18:42:53Z

On Nov 20, 2001 17:08 +0000, Luís Henriques wrote:
> > I don't think what you are trying to do is possible. Even if you somehow
> > managed to write over the code segment of a user space process (which I
> > very much doubt would be possible as I assume the memory is mapped
> > read-only)
>
> Is there a way to solve this problem? To temporarly turn it read/write?
>
> >, as soon as the kernel pages out (i.e. discards!) some portion
> > of the executable due to memory shortage your changes would be lost, since
> > the paging back into memory would happen by reading the executable back
> > from disk, which would mean it would read the unmodified code into
> > memory...
>
> When I'm modifing the code, I'm sure that the page is in memory because my
> code is called from the user space, in the exact location where I want to
> change it (with a breakpoint interruption...)
>
> The point is that I can't write to the memory location I want... How do I
> solve this?

Maybe if you describe the actual problem that you are trying to solve, and
not the actual way you are trying to solve it, there may be a better method.
Usually, if something you are trying to do is very hard to do, there is a
different (much better) way of doing it.

Cheers, Andreas
--
Andreas Dilger