[dpdk-dev] [PATCH] ivshmem: fix race condition

Mauricio Vásquez mauricio.vasquezbernal at studenti.polito.it
Fri Apr 1 13:17:05 CEST 2016


Hi Anatoly,

On Fri, Apr 1, 2016 at 11:01 AM, Burakov, Anatoly <anatoly.burakov at intel.com
> wrote:

> Hi Mauricio,
>
> > The memory zone could be freed just after adding it to the metadata
> > file and just before marking it as not freeable.
> > This patch changes the locking logic in order to prevent it.
>
> Just a nit: if the stated purpose of the patch is to prevent the memzone
> free
> before adding it to metadata, then it probably should check if the memzone
> wasn't freed before we got the lock (or if it's a valid memzone in the
> first place).
> Probably just checking if the virtual address of the memzone isn't 0 would
> be
> enough. Otherwise looks fine to me.
>
>
The purpose of this patch is to avoid a memzone be freed after it has been
added to the metadata but
before it is marked as not freeable. (that small time interval where it is
possible).

Avoid adding an already freed memzone is another case, I will send a v2
that addresses it.
I used the length of the memzone to check whether the memzone is valid or
not.


> Thanks,
> Anatoly
>

Mauricio Vasquez,


More information about the dev mailing list