* Accessing an arbitrary user space from a module
@ 1999-04-14 2:44 Durantez, Marc
1999-04-14 4:30 ` David Miller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Durantez, Marc @ 1999-04-14 2:44 UTC (permalink / raw)
To: ultralinux
Hello,
I writing a module for an implementation of distributed shared memory
on a group of computers over a LAN, but I still have not enought
experience with the kernel.
My problem is that I don't know how to access an arbitrary user memory
space from my module. Let us suppose I have a buffer in kernel space
and I want to copy it in the memory space of process A at some virtual
address.
First case: I am not at interrupt time but I am in the context of
another process like a deamon or whatever.
I tried something using get_fs() and set_fs() but I don't really know
what a mm_segment_t represents for an ultrasparc, I hoped it would
work but it didn't (it wasn't a very rigourous test so may be it
should work!)
Second case: At interrupt time, what can I do? I understand that
provoquing a page falt is not an option so I got carefully the pte_t
corresponding to the destination where I want to write, checked its
validity with pte_present() but finally got a fault when accessing
using paddr = (pte_page(*pte)|(addr&(~PAGE_MASK))+PAGE_OFFSET; where
paddr should be the physical address. But I guess I will run into more
trouble to mark the page as dirty or if the buffer I want to write is
accross two or more pages.
Please, could you tell me where I am wrong and where should I look for
more information on the web or in the source?
Thank you,
Marc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accessing an arbitrary user space from a module
1999-04-14 2:44 Accessing an arbitrary user space from a module Durantez, Marc
@ 1999-04-14 4:30 ` David Miller
1999-04-14 7:11 ` Durantez, Marc
1999-04-14 7:12 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 1999-04-14 4:30 UTC (permalink / raw)
To: ultralinux
Date: Wed, 14 Apr 1999 11:44:41 +0900
From: "Durantez, Marc" <durantez@is.s.u-tokyo.ac.jp>
First case: I am not at interrupt time but I am in the context of
another process like a deamon or whatever.
copy_to_user(user_pointer, kernel_pointer, size);
Second case: At interrupt time, what can I do?
Allocate a kernel buffer in your driver beforehand, provide a device
driver mmap() operation to let the user map this into his address
space, at interrupt time copy into the kernel buffer and the data will
magically appear into the user's mapping of it.
Later,
David S. Miller
davem@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accessing an arbitrary user space from a module
1999-04-14 2:44 Accessing an arbitrary user space from a module Durantez, Marc
1999-04-14 4:30 ` David Miller
@ 1999-04-14 7:11 ` Durantez, Marc
1999-04-14 7:12 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Durantez, Marc @ 1999-04-14 7:11 UTC (permalink / raw)
To: ultralinux
> First case: I am not at interrupt time but I am in the context of
> another process like a deamon or whatever.
>
> copy_to_user(user_pointer, kernel_pointer, size);
Should I understand that copy_to_user and the other functions of uaccess.h allow
to access the memory of any user task? I thougth they accessed only the
'current' task's memory space... :-(
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Accessing an arbitrary user space from a module
1999-04-14 2:44 Accessing an arbitrary user space from a module Durantez, Marc
1999-04-14 4:30 ` David Miller
1999-04-14 7:11 ` Durantez, Marc
@ 1999-04-14 7:12 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 1999-04-14 7:12 UTC (permalink / raw)
To: ultralinux
Date: Wed, 14 Apr 1999 16:11:42 +0900
From: "Durantez, Marc" <durantez@is.s.u-tokyo.ac.jp>
I thougth they accessed only the 'current' task's memory
space... :-(
Right, only the current task.
See the arch/sparc64/kernel/ptrace.c code for a possible way to touch
the data of other tasks.
Later,
David S. Miller
davem@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-04-14 7:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-04-14 2:44 Accessing an arbitrary user space from a module Durantez, Marc
1999-04-14 4:30 ` David Miller
1999-04-14 7:11 ` Durantez, Marc
1999-04-14 7:12 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.