[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131001124424.GA2097@thunk.org>
Date: Tue, 1 Oct 2013 08:44:24 -0400
From: Theodore Ts'o <tytso@....edu>
To: "Luck, Tony" <tony.luck@...el.com>
Cc: Andi Kleen <andi@...stfloor.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 01/11] random: don't feed stack data into pool when
interrupt regs NULL
On Mon, Sep 30, 2013 at 08:51:43PM +0000, Luck, Tony wrote:
> > In this case fast_mix would use two uninitialized ints from the stack
> > and mix it into the pool.
>
> Is the concern here is that an attacker might know (or be able to control) what is on
> the stack - and so get knowledge of what is being mixed into the pool?
Yes, this is a bogus complaint.
> > In this case set the input to 0.
>
> And the fix is to guarantee that everyone knows what is being mixed in? (!)
>
> Wouldn't it be better to adjust the "nbytes" parameter to
>
> fast_mix(..., ..., sizeof (input));
>
> to only mix in the part of input[] that we successfully initialized?
The changes queued for the next merge window in the random tree solve
this problem slightly differently:
...
input[0] = cycles ^ j_high ^ irq;
input[1] = now ^ c_high;
ip = regs ? instruction_pointer(regs) : _RET_IP_;
input[2] = ip;
input[3] = ip >> 32;
fast_mix(fast_pool, input);
...
(Note the lack of nbytes parameter in fast_mix --- there are some
optimizations so that we mix in the changes by 32-bit words, instead
of bytes, and the number of 32-bit words is fixed to 4, since it's the
only way fast_mix is called).
_RET_IP_ isn't that much better than 0, but it's at least kernel
specific, and I figured it was better to shut up bogus warnings, as
opposed to trying to depend on stack garbage (which would likely be
kernel specific anyway).
Cheers,
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists