[PATCH 0/3] Use get_online_cpus to avoid races involvingfor_each_online_cpu

From: Silas Boyd-Wickizer
Date: Thu Aug 02 2012 - 20:07:47 EST


Hello,

I've found 4 races involving for_each_online_cpu that could have ill
effects. All 4 occur in code that can be compiled as modules, but
which is probably usually linked statically. All 4 occur during
module init and/or exit. I've written patches for 3 of the 4, and
will describe the 4th race in separate e-mail.

I've been checking the usages of for_each_online_cpu for the
possibility of races with offlining and onlining CPUs. I used
libsparse and kernel source annotations to check that code uses
for_each_online_cpu in contexts with hotplug disabled
(e.g. get_online_cpus(), preempt_disable, ..). I compiled with an
x86 64-bit allyesconfig and weeded out false positives (e.g. careful
use of CPU notifiers) by hand.

I've identified about 40 races, but only 4 that seem to have
unintentional and potentially harmful effects.

Here is a link to my checker code, which isn't fit for inclusion in
anything:

http://pdos.csail.mit.edu/~sbw/online-checker/

Silas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/