[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=V93A660+YS8C2TvC13kGUcJpFgjPHUvONd_WW@mail.gmail.com>
Date: Thu, 21 Oct 2010 17:31:12 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dan Rosenberg <drosenberg@...curity.com>
Cc: jon.maloy@...csson.com, allan.stephens@...driver.com,
netdev@...r.kernel.org, security@...nel.org
Subject: Re: [Security] TIPC security issues
On Thu, Oct 21, 2010 at 4:45 PM, Dan Rosenberg <drosenberg@...curity.com> wrote:
>
> 1. The tipc_msg_calc_data_size() function is almost totally broken. It
> sums together size_t values (iov_lens), but returns an integer. Two
> things can go wrong - the total value can wrap around, or on 64-bit
> platforms, iov_len values greater than UINT_MAX will be truncated.
Hmm. I actually think that this is a problem with "verify_iovec()". We
should just make that one stricter, I think.
We already (long ago) decided that POSIX.1 compatibility be damned,
and that reading and writing more than 2GB in a single system call is
bogus: so normal write calls will actually limit size_t arguments to
MAX_INT, exactly so that various filesystems don't have to worry about
overflow and can keep length arguments in an "int".
And we probably should just do the same in verify[_compat]_iovec(). We
do 99% of the necessary work there already - adding a few simple
checks would get us there all the way. And then silly things like this
wouldn't matter.
Something simple like:
if an iovec has a total length that is > MAX_INT, then limit that
entry to MAX_INT, and clear out the rest
Something like the appended UNTESTED patch. NOTE! it actually makes
"verify_iovec()" *change* the iovec if it grows too big.
Also note that not only is it untested, it also doesn't do this for
the verify_compat_iovec() function, so this is really more of a "look,
we could do this" patch - to get discussion started.
Linus
View attachment "patch.diff" of type "text/x-patch" (993 bytes)
Powered by blists - more mailing lists