diff options
| author | Shih-Yuan Lee <fourdollars@debian.org> | 2026-07-11 17:33:22 +0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-08-10 08:59:41 -0700 |
| commit | 5a151274c1fd8696ddc7e9a84906a67ab0df66e8 (patch) | |
| tree | 0445a029d8f2c6be615b10735dc0eaf5001a06be /tools/perf/scripts/python/event_analyzing_sample.py | |
| parent | d33baed3fea26756ef3b077347b8da0de3f492f1 (diff) | |
hwmon: (applesmc) Fix lockless cache validation data race
In applesmc_get_entry_by_index(), the cache->valid flag is checked
locklessly, but setting it to true lacks memory barriers. This can lead to
a data race (TOCTOU) where another thread sees cache->valid as true
before the actual cache contents (cache->key, cache->len, cache->type, etc.)
are fully committed and visible to that CPU, potentially causing it to read
uninitialized data and send incorrect keys to the Apple SMC hardware.
Introduce memory barriers (smp_load_acquire and smp_store_release) with
explanatory comments to ensure cache synchronization is thread-safe and
fully visible across all CPUs.
Signed-off-by: Shih-Yuan Lee <fourdollars@debian.org>
Link: https://lore.kernel.org/r/20260711093323.14529-3-fourdollars@debian.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/perf/scripts/python/event_analyzing_sample.py')
0 files changed, 0 insertions, 0 deletions
