From: David Schleef <ds@schleef.org>
To: Dawson Engler <engler@csl.Stanford.EDU>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [CHECKER] copy_*_user length bugs?
Date: Wed, 18 Apr 2001 01:52:54 -0700 [thread overview]
Message-ID: <20010418015254.A29893@stm.lbl.gov> (raw)
In-Reply-To: <200104180439.VAA21983@csl.Stanford.EDU>
In-Reply-To: <200104180439.VAA21983@csl.Stanford.EDU>; from engler@csl.Stanford.EDU on Tue, Apr 17, 2001 at 09:39:15PM -0700
On Tue, Apr 17, 2001 at 09:39:15PM -0700, Dawson Engler wrote:
> Hi All,
>
> at the suggestion of Chris (chris@ferret.lmh.ox.ac.uk) I wrote a simple
> checker to warn when the length parameter to copy_*_user was (1) an
> integer and (2) not checked < 0.
>
> As an example, the ipv6 routine rawv6_geticmpfilter gets an integer 'len'
> from user space, checks that it is smaller than a struct size and then
> uses length as an argument to copy_to_user:
>
> if (get_user(len, optlen))
> return -EFAULT;
> if (len > sizeof(struct icmp6_filter))
> len = sizeof(struct icmp6_filter);
> if (put_user(len, optlen))
> return -EFAULT;
> if (copy_to_user(optval, &sk->tp_pinfo.tp_raw.filter, len))
> return -EFAULT;
>
> Is this a real bug? Or is the checked rule only applicable to
> __copy_*_user routines rather than copy_*_user routines? (If its a real
> bug, theres about 8 others that we found).
The len parameter is an unsigned value, so this code is ok as
long as access_ok() correctly checks that the range to copy
doesn't stray outside of the userspace range, including the
possible wraparound for a very large len. access_ok() on i386
checks for the wraparound. m68k doesn't use it. PowerPC
is correct, but only because TASK_SIZE is 0x80000000. If it
is ever changed, there could be a problem. I didn't check
other architectures, because I don't understand the asm.
dave...
next prev parent reply other threads:[~2001-04-18 8:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-18 4:39 Dawson Engler
2001-04-18 8:52 ` David Schleef [this message]
2001-04-18 11:14 ` Chris Evans
2001-04-18 13:00 ` Russell King
2001-04-18 13:11 ` Chris Evans
2001-04-18 15:21 ` Andreas Schwab
2001-04-18 12:18 ` Richard B. Johnson
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=20010418015254.A29893@stm.lbl.gov \
--to=ds@schleef.org \
--cc=engler@csl.Stanford.EDU \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®