tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Making bpf MPSAFE (was Re: struct ifnet and ifaddr handling ...)

On 7/08/2014 7:49 PM, Ryota Ozaki wrote:
> Hi,
> I thought I need more experience of pserialize
> (and lock primitives) to tackle ifnet work.
> So I suspended the work and now I am trying
> another easier task, bpf.

This code has race conditions built into it where locks are
dropped for others to be acquiredwith no knowledge stored
anywhere that a critical section of code is being executed:

+        mutex_exit(d->bd_lock);
+        KERNEL_LOCK(1, NULL);

What you need here is a perimeter mechanism that doesn't
hold any locks over the inner section of code.

This needs to be fixed:

        error = tsleep(d, PRINET|PCATCH, "bpf", d->bd_rtout);

- it should actually be a cv_timedwait_sig() on bd_lock.


Home | Main Index | Thread Index | Old Index