mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Linus Torvalds <torvalds@osdl.org>
Cc: "Robert T. Johnson" <rtjohnso@eecs.berkeley.edu>,
	Al Viro <viro@math.psu.edu>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Finding user/kernel pointer bugs [no html]
Date: Thu, 10 Jun 2004 17:57:05 +0100	[thread overview]
Message-ID: <20040610165705.GG12308@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.58.0406100735530.2050@ppc970.osdl.org>

On Thu, Jun 10, 2004 at 07:46:40AM -0700, Linus Torvalds wrote:
 
> The only way to fix the second case is to split the structure up - which
> is usually a good idea _anyway_, but which can sometimes be pretty 
> painful. Al has done some of them. The really painful one is "struct 
> iovec", which seems to be used in this capacity a fair amount.

iovec is, I'm afraid, hopeless.  E.g. TCP code does tons of work before
it even looks at the data; doing two versions (for kernel and userland
pointers) is too ridiculous for words.  So kernel users (== RPC of all
sorts) either do it from kernel threads or use set_fs() around sock_sendmsg().
That would be a convenient chokepoint, if we would e.g. always pass a
single-element arrays - we could add kernel_sendmsg() that would take
a _kernel_ pointer + length + flags, force them into iovec, call set_fs()
and pass that stuff to sock_sendmsg() (and similar for recepients).
Unfortunately, it doesn't work that way - there are places that pass
multi-element arrays.  And there are guys who don't need set_fs() since
they are in kernel threads.

It might be possible to clean up, but I would stay away from that mess for
a while.  Non-networking code is simple - it's almost always either only
kernel or only userland.  XFS is a major offender in that respect, but
that's the matter of SGI politics and not much more, AFAICS.

Note that we get very real fuckups with that - e.g. econet-over-ethernet
slaps a kernel chunk of data in front of userland ones, does verify_area()
on the latter, calls set_fs() and sends the mixed vector to UDP code.
It breaks big way on a bunch of platforms, obviously...

  reply	other threads:[~2004-06-10 16:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-10  3:31 Robert T. Johnson
2004-06-10  4:10 ` Linus Torvalds
2004-06-10  4:48   ` Robert T. Johnson
2004-06-10 14:46     ` Linus Torvalds
2004-06-10 16:57       ` viro [this message]
2004-06-10 15:07   ` Timothy Miller
2004-06-10 15:04     ` Linus Torvalds
2004-06-10 15:26       ` Timothy Miller
2004-06-10  4:49 ` viro
2004-06-10  5:20   ` Robert T. Johnson
2004-06-10 16:58   ` Greg KH
2004-06-10 17:27     ` David Brownell
2004-06-10 17:35       ` Greg KH
2004-06-10 17:54     ` Thomas Sailer
2004-06-10 18:34     ` Greg KH
2004-06-10 18:45       ` viro
2004-06-10 18:54         ` Greg KH
2004-06-10 19:10     ` Greg KH
2004-06-10 19:14       ` viro
2004-06-10 19:32         ` Greg KH
2004-06-10 19:38           ` viro
2004-06-10 20:28           ` Sam Ravnborg
2004-06-10 20:48             ` Randy.Dunlap
2004-06-11 17:21       ` Jean Delvare
2004-06-11 17:59         ` Greg KH

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=20040610165705.GG12308@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtjohnso@eecs.berkeley.edu \
    --cc=torvalds@osdl.org \
    --cc=viro@math.psu.edu \
    /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

all inboxes | Powered by JetHome®