* Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:
+ preempt_disable();
/* if over the trickle threshold, use only 1 in 4096 samples */
if ( random_state->entropy_count > trickle_thresh &&
(__get_cpu_var(trickle_count)++ & 0xfff))
- return;
+ goto out;
It looks like upstream code *is* buggy because that is a non-atomic
RMW operation on the per-cpu var, no? Hence you must disable preempt.
no, the upstream code (i.e. BK-curr) is not buggy, because there this
code runs under the BKL, implicitly as part of vt_ioctl() - and the BKL disables preemption in the upstream kernel.
Yes, the code is fragile, but it's not buggy. With the remove-bkl patch
this fragility turned into an outright bug. (Fortunately the patch
detects all such incidents.)