Re: A variant of mlockall()

From: Andi Kleen (ak@suse.de)
Date: Sat May 20 2000 - 05:24:47 EST


Lorenzo Allegrucci <lenstra@tiscalinet.it> writes:

> Is there a simple and natural way to lock memory of a process
> from another process?
> I mean, POSIX1.b standard mlockall() does not provide a pid selection.
> You can only use it from inside the process you want to lock memory.
> Wouldn't be useful a mlockall(int flags, int pid) ?

You can do it very hackish (I just did it for a different purpose).
PTRACE_ATTACH the process and write a small trampoline that executes the system
call onto the systems stack. Then write the EIP of the trampoline using
PTRACE_SETREGS and trace for the end using PTRACE_SYSCALL. Afterwards restore
old stack pointer and EIP.

Very hackish but works,

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:18 EST