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

Merge branch 'uprobes/core' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc into perf/core

Pull uprobes tmpfs support patches from Oleg Nesterov.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+19 -20
+1 -1
arch/x86/include/asm/uprobes.h
··· 52 52 struct { 53 53 u8 fixups; 54 54 u8 ilen; 55 - } def; 55 + } defparam; 56 56 }; 57 57 }; 58 58
+18 -19
arch/x86/kernel/uprobes.c
··· 254 254 * If arch_uprobe->insn doesn't use rip-relative addressing, return 255 255 * immediately. Otherwise, rewrite the instruction so that it accesses 256 256 * its memory operand indirectly through a scratch register. Set 257 - * def->fixups accordingly. (The contents of the scratch register 257 + * defparam->fixups accordingly. (The contents of the scratch register 258 258 * will be saved before we single-step the modified instruction, 259 259 * and restored afterward). 260 260 * ··· 372 372 */ 373 373 if (reg != 6 && reg2 != 6) { 374 374 reg2 = 6; 375 - auprobe->def.fixups |= UPROBE_FIX_RIP_SI; 375 + auprobe->defparam.fixups |= UPROBE_FIX_RIP_SI; 376 376 } else if (reg != 7 && reg2 != 7) { 377 377 reg2 = 7; 378 - auprobe->def.fixups |= UPROBE_FIX_RIP_DI; 378 + auprobe->defparam.fixups |= UPROBE_FIX_RIP_DI; 379 379 /* TODO (paranoia): force maskmovq to not use di */ 380 380 } else { 381 381 reg2 = 3; 382 - auprobe->def.fixups |= UPROBE_FIX_RIP_BX; 382 + auprobe->defparam.fixups |= UPROBE_FIX_RIP_BX; 383 383 } 384 384 /* 385 385 * Point cursor at the modrm byte. The next 4 bytes are the ··· 398 398 static inline unsigned long * 399 399 scratch_reg(struct arch_uprobe *auprobe, struct pt_regs *regs) 400 400 { 401 - if (auprobe->def.fixups & UPROBE_FIX_RIP_SI) 401 + if (auprobe->defparam.fixups & UPROBE_FIX_RIP_SI) 402 402 return &regs->si; 403 - if (auprobe->def.fixups & UPROBE_FIX_RIP_DI) 403 + if (auprobe->defparam.fixups & UPROBE_FIX_RIP_DI) 404 404 return &regs->di; 405 405 return &regs->bx; 406 406 } ··· 411 411 */ 412 412 static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 413 413 { 414 - if (auprobe->def.fixups & UPROBE_FIX_RIP_MASK) { 414 + if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { 415 415 struct uprobe_task *utask = current->utask; 416 416 unsigned long *sr = scratch_reg(auprobe, regs); 417 417 418 418 utask->autask.saved_scratch_register = *sr; 419 - *sr = utask->vaddr + auprobe->def.ilen; 419 + *sr = utask->vaddr + auprobe->defparam.ilen; 420 420 } 421 421 } 422 422 423 423 static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 424 424 { 425 - if (auprobe->def.fixups & UPROBE_FIX_RIP_MASK) { 425 + if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { 426 426 struct uprobe_task *utask = current->utask; 427 427 unsigned long *sr = scratch_reg(auprobe, regs); 428 428 ··· 499 499 struct uprobe_task *utask = current->utask; 500 500 501 501 riprel_post_xol(auprobe, regs); 502 - if (auprobe->def.fixups & UPROBE_FIX_IP) { 502 + if (auprobe->defparam.fixups & UPROBE_FIX_IP) { 503 503 long correction = utask->vaddr - utask->xol_vaddr; 504 504 regs->ip += correction; 505 - } else if (auprobe->def.fixups & UPROBE_FIX_CALL) { 506 - regs->sp += sizeof_long(); 507 - if (push_ret_address(regs, utask->vaddr + auprobe->def.ilen)) 505 + } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { 506 + regs->sp += sizeof_long(); /* Pop incorrect return address */ 507 + if (push_ret_address(regs, utask->vaddr + auprobe->defparam.ilen)) 508 508 return -ERESTART; 509 509 } 510 510 /* popf; tell the caller to not touch TF */ 511 - if (auprobe->def.fixups & UPROBE_FIX_SETF) 511 + if (auprobe->defparam.fixups & UPROBE_FIX_SETF) 512 512 utask->autask.saved_tf = true; 513 513 514 514 return 0; ··· 711 711 712 712 /* 713 713 * Figure out which fixups default_post_xol_op() will need to perform, 714 - * and annotate def->fixups accordingly. To start with, ->fixups is 715 - * either zero or it reflects rip-related fixups. 714 + * and annotate defparam->fixups accordingly. 716 715 */ 717 716 switch (OPCODE1(&insn)) { 718 717 case 0x9d: /* popf */ 719 - auprobe->def.fixups |= UPROBE_FIX_SETF; 718 + auprobe->defparam.fixups |= UPROBE_FIX_SETF; 720 719 break; 721 720 case 0xc3: /* ret or lret -- ip is correct */ 722 721 case 0xcb: ··· 741 742 riprel_analyze(auprobe, &insn); 742 743 } 743 744 744 - auprobe->def.ilen = insn.length; 745 - auprobe->def.fixups |= fix_ip_or_call; 745 + auprobe->defparam.ilen = insn.length; 746 + auprobe->defparam.fixups |= fix_ip_or_call; 746 747 747 748 auprobe->ops = &default_xol_ops; 748 749 return 0;