• Mark Rutland's avatar
    kcsan: Simplify value change detection · 6f2d9819
    Mark Rutland authored
    In kcsan_setup_watchpoint() we store snapshots of a watched value into a
    union of u8/u16/u32/u64 sized fields, modify this in place using a
    consistent field, then later check for any changes via the u64 field.
    
    We can achieve the safe effect more simply by always treating the field
    as a u64, as smaller values will be zero-extended. As the values are
    zero-extended, we don't need to truncate the access_mask when we apply
    it, and can always apply the full 64-bit access_mask to the 64-bit
    value.
    
    Finally, we can store the two snapshots and calculated difference
    separately, which makes the code a little easier to read, and will
    permit reporting the old/new values in subsequent patches.
    
    There should be no functional change as a result of this patch.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarMarco Elver <elver@google.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    6f2d9819
core.c 36.8 KB