From: Greg KH <greg@kroah.com>
To: viro@parcelfarce.linux.theplanet.co.uk,
David Brownell <david-b@pacbell.net>
Cc: "Robert T. Johnson" <rtjohnso@eecs.berkeley.edu>,
Al Viro <viro@math.psu.edu>, Linus Torvalds <torvalds@osdl.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Finding user/kernel pointer bugs [no html]
Date: Thu, 10 Jun 2004 09:58:21 -0700 [thread overview]
Message-ID: <20040610165821.GB32577@kroah.com> (raw)
In-Reply-To: <20040610044903.GE12308@parcelfarce.linux.theplanet.co.uk>
On Thu, Jun 10, 2004 at 05:49:03AM +0100, viro@parcelfarce.linux.theplanet.co.uk wrote:
> > bugs in drivers/usb/core/devio.c:proc_control() even though that
> > function has been annotated (this is not the first time cqual has found
> > bugs in code audited by sparse). I didn't write any annotations in any
>
> sparse gives warnings on lines 272, 293, 561, 581, 976, 979, 982, 989, 992.
Ick, sorry, I haven't run sparse on the usb tree in a while, I'll do
that today and fix it all up.
> 293 is assignment in conditional.
Now fixed.
> 561 and 581 are dereferencing userland pointers (proc_control())
Now fixed with Robert's provided patch.
> 976 -- 992 are in processcompl() - missing annotations; since ->userurb
> is a void __user *, we should kill those casts and just do
> struct usbdevfs_urb __user *userurb = as->userurb;
>
> and use
> if (put_user(urb->status, &userurb->status))
> etc. instead of the current mess.
Good idea, now done, thanks.
> 272 is interesting - it's in
> static void async_completed(struct urb *urb, struct pt_regs *regs)
> {
> struct async *as = (struct async *)urb->context;
> struct dev_state *ps = as->ps;
> struct siginfo sinfo;
>
> spin_lock(&ps->lock);
> list_move_tail(&as->asynclist, &ps->async_completed);
> spin_unlock(&ps->lock);
> if (as->signr) {
> sinfo.si_signo = as->signr;
> sinfo.si_errno = as->urb->status;
> sinfo.si_code = SI_ASYNCIO;
> sinfo.si_addr = (void *)as->userurb;
> send_sig_info(as->signr, &sinfo, as->task);
> }
> wake_up(&ps->wait);
> }
> and it brings two questions:
> a) shouldn't ->si_addr be a __user pointer (in all contexts I see
> it is one)
> b) WTF is usb doing messing with it directly?
> Note that drivers/usb/core/{devio,inode}.c are the only users of that animal
> outside of arch/*. Looks fishy...
I really don't know. I think David added that code. David, any ideas?
thanks,
greg k-h
next prev parent reply other threads:[~2004-06-10 17:00 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
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 [this message]
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=20040610165821.GB32577@kroah.com \
--to=greg@kroah.com \
--cc=david-b@pacbell.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rtjohnso@eecs.berkeley.edu \
--cc=torvalds@osdl.org \
--cc=viro@math.psu.edu \
--cc=viro@parcelfarce.linux.theplanet.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
all inboxes | Powered by JetHome®