summaryrefslogtreecommitdiff
path: root/opengl/libagl/TokenManager.cpp
diff options
context:
space:
mode:
author Connor O'Brien <connoro@google.com> 2019-07-24 15:42:11 -0700
committer Steven Moreland <smoreland@google.com> 2020-01-13 15:58:04 -0800
commitc92ef1081e5ed558c1bb16d717a4c688e7d917e9 (patch)
tree6d1831cf98468d7956b3d8670770995d00e977b6 /opengl/libagl/TokenManager.cpp
parenta178a73ad0f1caa3ca009ddc8ff501c3bdfad883 (diff)
libtimeinstate: fix bug in clearUidCpuFreqTimes
In a preallocated bpf hash table, deleting a map element makes it available for reuse without clearing the data it holds. This reuse can occur when a bpf program calls bpf_map_update_elem with a key not already present in the map. If the map is percpu, bpf_map_update_elem will overwrite the reused entry's data for the current CPU but not for other CPUs, resulting in stale data that is now associated with the wrong key. For time in state, this can show up as impossible data (e.g. reporting that a UID ran on one cluster at a frequency only available on a different cluster), which is detected by the SingleAndAllUidConsistent test since getUidCpuFreqTimes() only looks up potentially valid keys while getUidsCpuFreqTimes() iterates through every map entry. Avoid this problem by zeroing out each entry's data prior to deleting it from the map. Also modify getUidCpuFreqTimes and getUidsCpuFreqTimes to check for impossible data and fail if any is detected, since it's a sign that other map entries may also be wrong. Bug: 138317993 Test: libtimeinstate_test can now be run repeatedly without SingleAndAllUidConsistent test eventually failing Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I17dd407f897d1e86eb85cc99842a581d88e5bc78 (cherry picked from commit 6c501ea04e486d9bf5c8a08d0d63dadcd9be83a9) Merged-In: I17dd407f897d1e86eb85cc99842a581d88e5bc78
Diffstat (limited to 'opengl/libagl/TokenManager.cpp')
0 files changed, 0 insertions, 0 deletions