lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 18 Jan 2012 09:39:06 +0100
From:	Anton Arapov <anton@...hat.com>
To:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux-mm <linux-mm@...ck.org>, Andi Kleen <andi@...stfloor.org>,
	Christoph Hellwig <hch@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Roland McGrath <roland@...k.frob.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v9 3.2 2/9] uprobes: handle breakpoint and signal step
 exception.

On Tue, Jan 10, 2012 at 05:18:42PM +0530, Srikar Dronamraju wrote:
[snip]
> diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
> index 8208234..475563b 100644
> --- a/arch/x86/include/asm/uprobes.h
> +++ b/arch/x86/include/asm/uprobes.h
[snip]
> @@ -37,6 +39,21 @@ struct uprobe_arch_info {
>  #endif
>  };
>  
> +struct uprobe_task_arch_info {
> +	unsigned long saved_trap_no;
> +#ifdef CONFIG_X86_64
> +	unsigned long saved_scratch_register;
> +#endif
> +};
> +
>  struct uprobe;
> +
>  extern int analyze_insn(struct mm_struct *mm, struct uprobe *uprobe);
> +extern void set_instruction_pointer(struct pt_regs *regs, unsigned long vaddr);
Srikar,

  Can we use existing SET_IP() instead of set_instruction_pointer() ?

[snip]  
>  static void __exit exit_uprobes(void)
> 

===
[PATCH] uprobes: cleanup, eliminate set_instruction_pointer(), use existing SET_IP() instead

Use SET_IP() available in include/asm-generic/ptrace.h

Signed-off-by: Anton Arapov <anton@...hat.com>
---
 arch/x86/include/asm/uprobes.h |    1 -
 arch/x86/kernel/uprobes.c      |   12 +-----------
 kernel/uprobes.c               |    2 +-
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 475563b..88df7ec 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -49,7 +49,6 @@ struct uprobe_task_arch_info {
 struct uprobe;
 
 extern int analyze_insn(struct mm_struct *mm, struct uprobe *uprobe);
-extern void set_instruction_pointer(struct pt_regs *regs, unsigned long vaddr);
 extern int pre_xol(struct uprobe *uprobe, struct pt_regs *regs);
 extern int post_xol(struct uprobe *uprobe, struct pt_regs *regs);
 extern bool xol_was_trapped(struct task_struct *tsk);
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index e4e0dfd..08b633f 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -409,16 +409,6 @@ int analyze_insn(struct mm_struct *mm, struct uprobe *uprobe)
 	return 0;
 }
 
-/*
- * @reg: reflects the saved state of the task
- * @vaddr: the virtual address to jump to.
- * Return 0 on success or a -ve number on error.
- */
-void set_instruction_pointer(struct pt_regs *regs, unsigned long vaddr)
-{
-	regs->ip = vaddr;
-}
-
 #define	UPROBE_TRAP_NO		UINT_MAX
 
 /*
@@ -624,7 +614,7 @@ void abort_xol(struct pt_regs *regs, struct uprobe *uprobe)
 
 	current->thread.trap_no = utask->tskinfo.saved_trap_no;
 	handle_riprel_post_xol(uprobe, regs, NULL);
-	set_instruction_pointer(regs, utask->vaddr);
+	SET_IP(regs, utask->vaddr);
 }
 
 /*
diff --git a/kernel/uprobes.c b/kernel/uprobes.c
index 0918448..b0db46b 100644
--- a/kernel/uprobes.c
+++ b/kernel/uprobes.c
@@ -1479,7 +1479,7 @@ cleanup_ret:
 	}
 	if (u) {
 		if (!(u->flags & UPROBES_SKIP_SSTEP))
-			set_instruction_pointer(regs, probept);
+			SET_IP(regs, probept);
 
 		put_uprobe(u);
 	} else
-- 
1.7.7.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists