diff options
author | Congyu Liu <liu3101@purdue.edu> | 2022-05-23 05:35:31 +0000 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-05-25 13:05:42 -0700 |
commit | 3159d79b56c15068aeb7e4630cd5f6dacd20fda4 (patch) | |
tree | a95d34e119be4f89bf4211f546675382e5468483 /lib/klist.c | |
parent | 863e0d81b6683c4cbc588ad831f560c90e494bef (diff) | |
download | linux-3159d79b56c15068aeb7e4630cd5f6dacd20fda4.tar.gz linux-3159d79b56c15068aeb7e4630cd5f6dacd20fda4.tar.bz2 linux-3159d79b56c15068aeb7e4630cd5f6dacd20fda4.zip |
kcov: update pos before writing pc in trace function
In __sanitizer_cov_trace_pc(), previously we write pc before updating pos.
However, some early interrupt code could bypass check_kcov_mode() check
and invoke __sanitizer_cov_trace_pc(). If such interrupt is raised
between writing pc and updating pos, the pc could be overitten by the
recursive __sanitizer_cov_trace_pc().
As suggested by Dmitry, we cold update pos before writing pc to avoid such
interleaving.
Apply the same change to write_comp_data().
Link: https://lkml.kernel.org/r/20220523053531.1572793-1-liu3101@purdue.edu
Signed-off-by: Congyu Liu <liu3101@purdue.edu>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/klist.c')
0 files changed, 0 insertions, 0 deletions