diff options
author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2025-06-18 03:05:23 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2025-06-18 14:59:56 +0300 |
commit | 2aebf5ee43bf0ed225a09a30cf515d9f2813b759 (patch) | |
tree | 7da2cfc0b282e0b8d16fbabc4e92c990b6c66841 /drivers/scsi/mpt2sas/mpi/mpi2_raid.h | |
parent | cb6075bc62dc6a9cd7ab3572758685fdf78e3e20 (diff) | |
download | linux-2aebf5ee43bf0ed225a09a30cf515d9f2813b759.tar.xz |
x86/alternatives: Fix int3 handling failure from broken text_poke array
Since smp_text_poke_single() does not expect there is another
text_poke request is queued, it can make text_poke_array not
sorted or cause a buffer overflow on the text_poke_array.vec[].
This will cause an Oops in int3 because of bsearch failing;
CPU 0 CPU 1 CPU 2
----- ----- -----
smp_text_poke_batch_add()
smp_text_poke_single() <<-- Adds out of order
<int3>
[Fails o find address
in text_poke_array ]
OOPS!
Or unhandled page fault because of a buffer overflow;
CPU 0 CPU 1
----- -----
smp_text_poke_batch_add() <<+
... |
smp_text_poke_batch_add() <<-- Adds TEXT_POKE_ARRAY_MAX times.
smp_text_poke_single() {
__smp_text_poke_batch_add() <<-- Adds entry at
TEXT_POKE_ARRAY_MAX + 1
smp_text_poke_batch_finish()
[Unhandled page fault because
text_poke_array.nr_entries is
overwritten]
BUG!
}
Use smp_text_poke_batch_add() instead of __smp_text_poke_batch_add()
so that it correctly flush the queue if needed.
Closes: https://lore.kernel.org/all/CA+G9fYsLu0roY3DV=tKyqP7FEKbOEETRvTDhnpPxJGbA=Cg+4w@mail.gmail.com/
Fixes: c8976ade0c1b ("x86/alternatives: Simplify smp_text_poke_single() by using tp_vec and existing APIs")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Link: https://lkml.kernel.org/r/\ 175020512308.3582717.13631440385506146631.stgit@mhiramat.tok.corp.google.com
Diffstat (limited to 'drivers/scsi/mpt2sas/mpi/mpi2_raid.h')
0 files changed, 0 insertions, 0 deletions