aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/uprobes.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index d2792e884d54..187be0e15e1d 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -268,8 +268,7 @@ static inline bool is_64bit_mm(struct mm_struct *mm)
268 * - There's never a SIB byte. 268 * - There's never a SIB byte.
269 * - The displacement is always 4 bytes. 269 * - The displacement is always 4 bytes.
270 */ 270 */
271static void 271static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn)
272handle_riprel_insn(struct arch_uprobe *auprobe, struct insn *insn)
273{ 272{
274 u8 *cursor; 273 u8 *cursor;
275 u8 reg; 274 u8 reg;
@@ -331,8 +330,7 @@ handle_riprel_insn(struct arch_uprobe *auprobe, struct insn *insn)
331 * If we're emulating a rip-relative instruction, save the contents 330 * If we're emulating a rip-relative instruction, save the contents
332 * of the scratch register and store the target address in that register. 331 * of the scratch register and store the target address in that register.
333 */ 332 */
334static void 333static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
335pre_xol_rip_insn(struct arch_uprobe *auprobe, struct pt_regs *regs,
336 struct arch_uprobe_task *autask) 334 struct arch_uprobe_task *autask)
337{ 335{
338 if (auprobe->def.fixups & UPROBE_FIX_RIP_AX) { 336 if (auprobe->def.fixups & UPROBE_FIX_RIP_AX) {
@@ -346,8 +344,8 @@ pre_xol_rip_insn(struct arch_uprobe *auprobe, struct pt_regs *regs,
346 } 344 }
347} 345}
348 346
349static void 347static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
350handle_riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs, long *correction) 348 long *correction)
351{ 349{
352 if (auprobe->def.fixups & (UPROBE_FIX_RIP_AX | UPROBE_FIX_RIP_CX)) { 350 if (auprobe->def.fixups & (UPROBE_FIX_RIP_AX | UPROBE_FIX_RIP_CX)) {
353 struct arch_uprobe_task *autask; 351 struct arch_uprobe_task *autask;
@@ -376,14 +374,14 @@ static inline bool is_64bit_mm(struct mm_struct *mm)
376/* 374/*
377 * No RIP-relative addressing on 32-bit 375 * No RIP-relative addressing on 32-bit
378 */ 376 */
379static void handle_riprel_insn(struct arch_uprobe *auprobe, struct insn *insn) 377static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn)
380{ 378{
381} 379}
382static void pre_xol_rip_insn(struct arch_uprobe *auprobe, struct pt_regs *regs, 380static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
383 struct arch_uprobe_task *autask) 381 struct arch_uprobe_task *autask)
384{ 382{
385} 383}
386static void handle_riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs, 384static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs,
387 long *correction) 385 long *correction)
388{ 386{
389} 387}
@@ -403,7 +401,7 @@ static inline int sizeof_long(void)
403 401
404static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) 402static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
405{ 403{
406 pre_xol_rip_insn(auprobe, regs, &current->utask->autask); 404 riprel_pre_xol(auprobe, regs, &current->utask->autask);
407 return 0; 405 return 0;
408} 406}
409 407
@@ -423,7 +421,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs
423 struct uprobe_task *utask = current->utask; 421 struct uprobe_task *utask = current->utask;
424 long correction = (long)(utask->vaddr - utask->xol_vaddr); 422 long correction = (long)(utask->vaddr - utask->xol_vaddr);
425 423
426 handle_riprel_post_xol(auprobe, regs, &correction); 424 riprel_post_xol(auprobe, regs, &correction);
427 if (auprobe->def.fixups & UPROBE_FIX_IP) { 425 if (auprobe->def.fixups & UPROBE_FIX_IP) {
428 regs->ip += correction; 426 regs->ip += correction;
429 } else if (auprobe->def.fixups & UPROBE_FIX_CALL) { 427 } else if (auprobe->def.fixups & UPROBE_FIX_CALL) {
@@ -440,7 +438,7 @@ static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs
440 438
441static void default_abort_op(struct arch_uprobe *auprobe, struct pt_regs *regs) 439static void default_abort_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
442{ 440{
443 handle_riprel_post_xol(auprobe, regs, NULL); 441 riprel_post_xol(auprobe, regs, NULL);
444} 442}
445 443
446static struct uprobe_xol_ops default_xol_ops = { 444static struct uprobe_xol_ops default_xol_ops = {
@@ -663,7 +661,7 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm,
663 } 661 }
664 /* fall through */ 662 /* fall through */
665 default: 663 default:
666 handle_riprel_insn(auprobe, &insn); 664 riprel_analyze(auprobe, &insn);
667 } 665 }
668 666
669 auprobe->def.ilen = insn.length; 667 auprobe->def.ilen = insn.length;