Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: probes: Remove probe_opcode_t

The probe_opcode_t typedef for u32 isn't necessary, and is a source of
confusion as it is easily confused with kprobe_opcode_t, which is a
typedef for __le32.

The typedef is only used within arch/arm64, and all of arm64's commn
insn code uses u32 for the endian-agnostic value of an instruction, so
it'd be clearer to use u32 consistently.

Remove probe_opcode_t and use u32 directly.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marnias@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20241008155851.801546-7-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Mark Rutland and committed by
Catalin Marinas
14762109 dd0eb50e

+5 -6
-1
arch/arm64/include/asm/probes.h
··· 9 9 10 10 #include <asm/insn.h> 11 11 12 - typedef u32 probe_opcode_t; 13 12 typedef void (probes_handler_t) (u32 opcode, long addr, struct pt_regs *); 14 13 15 14 struct arch_probe_insn {
+2 -2
arch/arm64/kernel/probes/decode-insn.c
··· 73 73 * INSN_GOOD_NO_SLOT If instruction is supported but doesn't use its slot. 74 74 */ 75 75 enum probe_insn __kprobes 76 - arm_probe_decode_insn(probe_opcode_t insn, struct arch_probe_insn *api) 76 + arm_probe_decode_insn(u32 insn, struct arch_probe_insn *api) 77 77 { 78 78 /* 79 79 * Instructions reading or modifying the PC won't work from the XOL ··· 133 133 arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi) 134 134 { 135 135 enum probe_insn decoded; 136 - probe_opcode_t insn = le32_to_cpu(*addr); 136 + u32 insn = le32_to_cpu(*addr); 137 137 kprobe_opcode_t *scan_end = NULL; 138 138 unsigned long size = 0, offset = 0; 139 139 struct arch_probe_insn *api = &asi->api;
+1 -1
arch/arm64/kernel/probes/decode-insn.h
··· 28 28 arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi); 29 29 #endif 30 30 enum probe_insn __kprobes 31 - arm_probe_decode_insn(probe_opcode_t insn, struct arch_probe_insn *asi); 31 + arm_probe_decode_insn(u32 insn, struct arch_probe_insn *asi); 32 32 33 33 #endif /* _ARM_KERNEL_KPROBES_ARM64_H */
+2 -2
arch/arm64/kernel/probes/uprobes.c
··· 34 34 int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, 35 35 unsigned long addr) 36 36 { 37 - probe_opcode_t insn; 37 + u32 insn; 38 38 39 39 /* TODO: Currently we do not support AARCH32 instruction probing */ 40 40 if (mm->context.flags & MMCF_AARCH32) ··· 102 102 103 103 bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) 104 104 { 105 - probe_opcode_t insn; 105 + u32 insn; 106 106 unsigned long addr; 107 107 108 108 if (!auprobe->simulate)