From: Linus Torvalds <torvalds@linux-foundation.org>
To: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: David Miller <davem@davemloft.net>,
jon.maloy@ericsson.com, allan.stephens@windriver.com,
netdev@vger.kernel.org, security@kernel.org
Subject: Re: [Security] TIPC security issues
Date: Wed, 27 Oct 2010 11:51:19 -0700 [thread overview]
Message-ID: <AANLkTikKZdq9u0+Nkd4wtEcAZMT3YCPaXMv6FZaafetc@mail.gmail.com> (raw)
In-Reply-To: <1288203979.1836.2.camel@dan>
On Wed, Oct 27, 2010 at 11:26 AM, Dan Rosenberg
<drosenberg@vsecurity.com> wrote:
> The proposed fix is a start, but it's not sufficient to completely fix
> the problem. What if the total of the iovecs wraps around back to 0?
> The total size will be returned as a small number, but large amounts of
> data will be copied into the allocated buffer since the individual
> iovecs can have arbitrary sizes.
That's why I suggested just fixing iovec_verify() to do this all. It
already walks the thing, and while it allows the overflow right now
(and only wants to make sure the end result is positive to separate it
out from error numbers), that was always a ugly thing to do.
And the thing is, once you disallow overflow, you really MUST NOT
return an error - you need to instead cap the max, the way I also did
in my patch.
Why? Because for a streaming thing, it's entirely possible that
somebody tries to write out a whole mmap'ed file in one go, for
example. Returning an error because somebody tries to write 8GB in one
single system call is wrong as it would result in the application
reporting an IO error - but saying "I will write out part of it" is
fine, and then it's up to the user to loop over it (it already needs
to do that for other reasons for partial IO).
So doing this in verify_iovec() (and verify_compat_iovec - which I
didn't do in my RFC patch) really does fix everything, and means that
the individual socket types never have to worry about the subtle cases
of overflow in any type.
Linus
next prev parent reply other threads:[~2010-10-27 18:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 23:45 TIPC security issues Dan Rosenberg
2010-10-22 0:31 ` [Security] " Linus Torvalds
2010-10-25 2:14 ` David Miller
2010-10-25 3:42 ` Linus Torvalds
2010-10-25 5:28 ` David Miller
2010-10-27 17:29 ` David Miller
2010-10-27 17:37 ` Linus Torvalds
2010-10-27 17:50 ` David Miller
2010-10-27 18:26 ` Dan Rosenberg
2010-10-27 18:34 ` David Miller
2010-10-27 18:51 ` Linus Torvalds [this message]
2010-10-27 19:27 ` David Miller
2010-10-28 15:32 ` Linus Torvalds
2010-10-28 18:45 ` Andy Grover
2010-10-28 18:49 ` David Miller
2010-10-27 18:27 ` Paul Gortmaker
2010-10-27 18:35 ` David Miller
2010-10-27 19:00 ` Paul Gortmaker
2010-10-28 19:51 ` Paul Gortmaker
2010-10-22 13:49 ` Jon Maloy
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=AANLkTikKZdq9u0+Nkd4wtEcAZMT3YCPaXMv6FZaafetc@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=allan.stephens@windriver.com \
--cc=davem@davemloft.net \
--cc=drosenberg@vsecurity.com \
--cc=jon.maloy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=security@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;
as well as URLs for NNTP newsgroup(s).