[PATCH 17/41] x86/alternatives: Rename 'struct text_poke_loc' to 'struct text_poke_int3_loc'

From: Ingo Molnar
Date: Thu Mar 27 2025 - 16:58:07 EST


Make it clear that this structure is part of the INT3 based
patching facility, not the regular text_poke*() MM-switch
based facility.

Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/x86/kernel/alternative.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 64355aa25402..62aead1bd671 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2455,7 +2455,7 @@ void text_poke_sync(void)
* this thing. When len == 6 everything is prefixed with 0x0f and we map
* opcode to Jcc.d8, using len to distinguish.
*/
-struct text_poke_loc {
+struct text_poke_int3_loc {
/* addr := _stext + rel_addr */
s32 rel_addr;
s32 disp;
@@ -2467,7 +2467,7 @@ struct text_poke_loc {
};

struct int3_patching_desc {
- struct text_poke_loc *vec;
+ struct text_poke_int3_loc *vec;
int nr_entries;
};

@@ -2494,14 +2494,14 @@ static __always_inline void put_desc(void)
raw_atomic_dec(refs);
}

-static __always_inline void *text_poke_int3_addr(struct text_poke_loc *tp)
+static __always_inline void *text_poke_int3_addr(struct text_poke_int3_loc *tp)
{
return _stext + tp->rel_addr;
}

static __always_inline int patch_cmp(const void *key, const void *elt)
{
- struct text_poke_loc *tp = (struct text_poke_loc *) elt;
+ struct text_poke_int3_loc *tp = (struct text_poke_int3_loc *) elt;

if (key < text_poke_int3_addr(tp))
return -1;
@@ -2513,7 +2513,7 @@ static __always_inline int patch_cmp(const void *key, const void *elt)
noinstr int text_poke_int3_handler(struct pt_regs *regs)
{
struct int3_patching_desc *desc;
- struct text_poke_loc *tp;
+ struct text_poke_int3_loc *tp;
int ret = 0;
void *ip;

@@ -2544,7 +2544,7 @@ noinstr int text_poke_int3_handler(struct pt_regs *regs)
*/
if (unlikely(desc->nr_entries > 1)) {
tp = __inline_bsearch(ip, desc->vec, desc->nr_entries,
- sizeof(struct text_poke_loc),
+ sizeof(struct text_poke_int3_loc),
patch_cmp);
if (!tp)
goto out_put;
@@ -2592,8 +2592,8 @@ noinstr int text_poke_int3_handler(struct pt_regs *regs)
return ret;
}

-#define TP_VEC_MAX (PAGE_SIZE / sizeof(struct text_poke_loc))
-static struct text_poke_loc tp_vec[TP_VEC_MAX];
+#define TP_VEC_MAX (PAGE_SIZE / sizeof(struct text_poke_int3_loc))
+static struct text_poke_int3_loc tp_vec[TP_VEC_MAX];
static int tp_vec_nr;

/**
@@ -2617,7 +2617,7 @@ static int tp_vec_nr;
* replacing opcode
* - sync cores
*/
-static void text_poke_int3_batch(struct text_poke_loc *tp, unsigned int nr_entries)
+static void text_poke_int3_batch(struct text_poke_int3_loc *tp, unsigned int nr_entries)
{
unsigned char int3 = INT3_INSN_OPCODE;
unsigned int i;
@@ -2762,7 +2762,7 @@ static void text_poke_int3_batch(struct text_poke_loc *tp, unsigned int nr_entri
}
}

-static void text_poke_int3_loc_init(struct text_poke_loc *tp, void *addr,
+static void text_poke_int3_loc_init(struct text_poke_int3_loc *tp, void *addr,
const void *opcode, size_t len, const void *emulate)
{
struct insn insn;
@@ -2843,7 +2843,7 @@ static void text_poke_int3_loc_init(struct text_poke_loc *tp, void *addr,
*/
static bool tp_order_fail(void *addr)
{
- struct text_poke_loc *tp;
+ struct text_poke_int3_loc *tp;

if (!tp_vec_nr)
return false;
@@ -2873,7 +2873,7 @@ void text_poke_int3_finish(void)

void __ref text_poke_int3_queue(void *addr, const void *opcode, size_t len, const void *emulate)
{
- struct text_poke_loc *tp;
+ struct text_poke_int3_loc *tp;

text_poke_int3_flush(addr);

@@ -2894,7 +2894,7 @@ 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_loc tp;
+ struct text_poke_int3_loc tp;

text_poke_int3_loc_init(&tp, addr, opcode, len, emulate);
text_poke_int3_batch(&tp, 1);
--
2.45.2