From: "Stephen C. Tweedie" <sct@redhat.com>
To: John Meikle <linux@procom.demon.co.uk>
Cc: linux-kernel@vger.kernel.org, Stephen Tweedie <sct@redhat.com>
Subject: Re: Using map_user_kiobuf()
Date: Mon, 4 Dec 2000 21:53:34 +0000 [thread overview]
Message-ID: <20001204215334.B9238@redhat.com> (raw)
In-Reply-To: <NEBBIIEABDPEIPKIJFDOEEAMDGAA.linux@procom.demon.co.uk>
In-Reply-To: <NEBBIIEABDPEIPKIJFDOEEAMDGAA.linux@procom.demon.co.uk>; from linux@procom.demon.co.uk on Thu, Nov 30, 2000 at 01:07:37PM -0000
Hi,
On Thu, Nov 30, 2000 at 01:07:37PM -0000, John Meikle wrote:
> I have been experimenting with a module that returns data to either a user
> space programme or another module. A memory area is passed in, and the data
> is written to it. Because the memory may be allocated either by a module or
> a user programme, a kiobuf seemed a good way of representing it. A layer
> converts user memory to a kiobuf using map_user_kiobuf().
There are a number of fixes pending for 2.4, and released for 2.2, but
nothing that would explain the sort of kernel corruption you are
reporting --- it sounds as if you are overrunning the end of the
kiobuf, but it's hard to know without seeing the real code.
> The code in the module (without validation and error checking) is:
>
> int test_kiobuf(char* buf)
> {
> struct kiobuf *iobuf;
> int i;
>
> alloc_kiovec(1, &iobuf);
> map_user_kiobuf(WRITE, iobuf, buf, TEST_SIZE);
Careful, you can't touch the buffer for a WRITE map. The READ/WRITE
flag is from the point of view of the user, and user write() syscalls
don't touch the data in memory! If you want to modify the user
buffer, you need to use READ instead.
Cheers,
Stephen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2000-12-04 22:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-30 13:07 Using map_user_kiobuf() John Meikle
2000-12-04 21:53 ` Stephen C. Tweedie [this message]
2000-12-05 10:15 ` John Meikle
2000-12-05 14:08 ` Chris Wedgwood
2000-12-05 20:07 ` Albert D. Cahalan
2000-12-05 22:50 ` Chris Wedgwood
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=20001204215334.B9238@redhat.com \
--to=sct@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@procom.demon.co.uk \
/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