• Marco Elver's avatar
    kcsan: permissive: Ignore data-racy 1-bit value changes · d8fd74d3
    Marco Elver authored
    Add rules to ignore data-racy reads with only 1-bit value changes.
    Details about the rules are captured in comments in
    kernel/kcsan/permissive.h. More background follows.
    
    While investigating a number of data races, we've encountered data-racy
    accesses on flags variables to be very common. The typical pattern is a
    reader masking all but one bit, and/or the writer setting/clearing only
    1 bit (current->flags being a frequently encountered case; more examples
    in mm/sl[au]b.c, which disable KCSAN for this reason).
    
    Since these types of data-racy accesses are common (with the assumption
    they are intentional and hard to miscompile) having the option (with
    CONFIG_KCSAN_PERMISSIVE=y) to filter them will avoid forcing everyone to
    mark them, and deliberately left to preference at this time.
    
    One important motivation for having this option built-in is to move
    closer to being able to enable KCSAN on CI systems or for testers
    wishing to test the whole kernel, whi...
    d8fd74d3
kcsan_test.c 35.2 KB