From: "Hermann, Guy" <GHermann@nds.com>
To: linux-mm@kvack.org
Subject: mapping user data in kernel
Date: Wed, 23 Feb 2005 15:18:07 +0100 [thread overview]
Message-ID: <22326A72AE6CF647B89C8371452F6BFA7E7D90@frex02.fr.nds.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]
Hi everybody,
here is a pb we don't manage to solve.
The general idea consists in a user process that gives data from its userspace to the kernel.
And the kernel makes them available to other user processes.
To modelize that we have 3 entities:
-a (user process) producer that mounts a FS and gives the corresponding data to the kernel
thanks to the 5th parameter of mount()
-a dedicated kernel module handles the FS, it receives the (user process) data and makes
them available to the user processes (produceur and other processes)
-a (user process) consumer that gets data from the kernel via the FS syscalls.
While the producer keeps being alive (doing nothing, but data given to the kernel still existing),
a consumer reads the mounted FS : the kernel makes the producer's data available (to another
process than the producer) by finding the corresponding page and mapping it in the kernel when
needed. Indeed, the kernel has kept the data virtual address and the struct task of the producer
(having therefore access to the mm of the producer)
But it seems that the kernel does not see the correct data after mapping the page of the producer
when being in the context of the consumer.
1st question:
Is such a treament (mapping in the kernel a page belonging to a user process that is not the
current one) relevant ? (can we use pgd_offset for a task->mm that does not belong to the current
process?)
2nd question:
If 1st question OK, why does this not work (were it in user-mode linux or in kernel mode) ?
Please find enclosed, the code of the module (which should be inserted in the kernel), the code of
the producer and consumer and the makefiles.
All these sources have been simplified as far as possible, the strategic treatments are in
-newfs_getpage of module.c: this function tries to remap a page that does not belong to the
current process in the kernel
-newfs_check_data of module.c: this function tries to find the bytes that characterize
(magic bytes) the data into the mapped page
Furthermore, the read data (even when incorrect) are displayed to have a visual comparison:
original data are characters or '.', incorrect data are represented by '?'....
To perform the test:
-insert the module in the kernel (insmod)
-mkdir /mnt/newfs
-run the producer
-then run the consumer
Thanks in advance for helping...
GH
[-- Attachment #2: sources.tar.gz --]
[-- Type: application/x-gzip, Size: 16714 bytes --]
next reply other threads:[~2005-02-23 14:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-23 14:18 Hermann, Guy [this message]
2005-02-23 16:06 ` Christoph Lameter
2005-03-02 7:31 Hermann, Guy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22326A72AE6CF647B89C8371452F6BFA7E7D90@frex02.fr.nds.com \
--to=ghermann@nds.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox