diff options
author | Peter Zijlstra <peterz@infradead.org> | 2023-01-12 20:43:56 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2023-01-13 11:48:17 +0100 |
commit | f18b0d7ee815abb33eb1cc540fdde64fbb922d1a (patch) | |
tree | 17f9a9c11cfaddcf81309b1a903bf66e0cbf64b3 /lib/ubsan.c | |
parent | cpuidle, clk: Remove trace_.*_rcuidle() (diff) | |
download | linux-f18b0d7ee815abb33eb1cc540fdde64fbb922d1a.tar.xz linux-f18b0d7ee815abb33eb1cc540fdde64fbb922d1a.zip |
ubsan: Fix objtool UACCESS warns
clang-14 allyesconfig gives:
vmlinux.o: warning: objtool: emulator_cmpxchg_emulated+0x705: call to __ubsan_handle_load_invalid_value() with UACCESS enabled
vmlinux.o: warning: objtool: paging64_update_accessed_dirty_bits+0x39e: call to __ubsan_handle_load_invalid_value() with UACCESS enabled
vmlinux.o: warning: objtool: paging32_update_accessed_dirty_bits+0x390: call to __ubsan_handle_load_invalid_value() with UACCESS enabled
vmlinux.o: warning: objtool: ept_update_accessed_dirty_bits+0x43f: call to __ubsan_handle_load_invalid_value() with UACCESS enabled
Add the required eflags save/restore and whitelist the thing.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20230112195541.906007455@infradead.org
Diffstat (limited to 'lib/ubsan.c')
-rw-r--r-- | lib/ubsan.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ubsan.c b/lib/ubsan.c index 60c7099857a0..4d39e0babb98 100644 --- a/lib/ubsan.c +++ b/lib/ubsan.c @@ -339,9 +339,10 @@ void __ubsan_handle_load_invalid_value(void *_data, void *val) { struct invalid_value_data *data = _data; char val_str[VALUE_LENGTH]; + unsigned long ua_flags = user_access_save(); if (suppress_report(&data->location)) - return; + goto out; ubsan_prologue(&data->location, "invalid-load"); @@ -351,6 +352,8 @@ void __ubsan_handle_load_invalid_value(void *_data, void *val) val_str, data->type->type_name); ubsan_epilogue(); +out: + user_access_restore(ua_flags); } EXPORT_SYMBOL(__ubsan_handle_load_invalid_value); |