[Devel] [PATCH] cbt: bitmap corruption caused by ipi

Vasiliy Averin vvs at virtuozzo.com
Thu Oct 11 16:34:18 MSK 2018


IPI generated by cbt_flush_cache() can interrupt blk_cbt_add() in "bad" places
and lead to bitmap corruption.

CPU A                       CPU B
blk_cbt_add()
...                         cbt_flush_cache() 
   old = *ex;                submit IPI 
   ex->start = start;

interrupt
  __cbt_flush_cpu_cache
   if (ex->len)   <<< found non-changed len
     __blk_cbt_set(cbt, ex->start, ex->len, 0, 1); <<< set wrong bitmask
     ex->start += ex->len; <<< incorrectly adjusts ex->start
     ex->len = 0;
return from interrupt back to blk_cbt_add()
   ex->len = len;   <<< set len and get wrong bitmask (because ex->start was changed in __cbt_flush_cpu_cache)


Similar problem happens if IPI will be processed in middle of following block in blk_cbt_add()

        if (ex->start + ex->len == start) {
                ex->len += len;
                goto out_rcu;
        }

Patch disables interrupts in specified places.

https://jira.sw.ru/browse/PSBM-89323
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>



More information about the Devel mailing list