[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140610002057.21845.qmail@ns.horizon.com>
Date: 9 Jun 2014 20:20:57 -0400
From: "George Spelvin" <linux@...izon.com>
To: linux@...izon.com, tytso@....edu
Cc: hpa@...ux.intel.com, linux-kernel@...r.kernel.org,
mingo@...nel.org, price@....EDU
Subject: drivers/char/random.c: more ruminations
My original reason for writing turned into a never mind...
I came up with a clever and intricate algorithm for preventing
a bulk writer from DoSing add_interrupt_randomness via the proposed
additional locking on the input_pool.
Then I re-checked the code and saw that only the (trusted) RNDADDENTROPY
call is allowed to write to the input_pool. A plain write(2) is copied
to the two output pools.
And writing to the input_pool can never try to take a lock on an
output pool; spilling is done in a workqueue.
I'm getting to a dangerous place: I think I'm starting to understand this.
I should probably turn that into a doc patch.
I have an idea for a patch to change _xfer_secondary_pool
to use extract_buf rather than extract_entropy; is all that
FIPS stuff needed for purely internal transfers?
Also, shouldn't the r->last_pulled holdoff in xfer_secondary_pool be
really limited to actual transfers? I.e. reorder the conditions as:
static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
{
if (!r->pull ||
r->entropy_count >= (nbytes << (ENTROPY_SHIFT + 3)) ||
r->entropy_count >= r->poolinfo->poolfracbits)
return;
if (r->limit == 0 && random_min_urandom_seed) {
unsigned long now = jiffies;
if (time_before(now,
r->last_pulled + random_min_urandom_seed * HZ))
return;
r->last_pulled = now;
}
_xfer_secondary_pool(r, nbytes);
}
--
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