[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250327205355.378659-25-mingo@kernel.org>
Date: Thu, 27 Mar 2025 21:53:37 +0100
From: Ingo Molnar <mingo@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Juergen Gross <jgross@...e.com>,
"H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 24/41] x86/alternatives: Simplify text_poke_int3() by using tp_vec and existing APIs
Instead of constructing a vector on-stack, just use the already
available batch-patching vector - which should always be empty
at this point.
This will allow subsequent simplifications.
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/kernel/alternative.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 906fb45b9e65..4f23f6b4d51d 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2906,8 +2906,13 @@ void __ref text_poke_int3_queue(void *addr, const void *opcode, size_t len, cons
*/
void __ref text_poke_int3(void *addr, const void *opcode, size_t len, const void *emulate)
{
- struct text_poke_int3_loc tp;
+ struct text_poke_int3_loc *tp;
+
+ /* Batch-patching should not be mixed with single-patching: */
+ WARN_ON_ONCE(tp_vec_nr != 0);
+
+ tp = &tp_vec[tp_vec_nr++];
+ text_poke_int3_loc_init(tp, addr, opcode, len, emulate);
- text_poke_int3_loc_init(&tp, addr, opcode, len, emulate);
- text_poke_int3_batch(&tp, 1);
+ text_poke_int3_finish();
}
--
2.45.2
Powered by blists - more mailing lists