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
| ||
|
Date: Mon, 17 Dec 2007 13:26:55 -0800 From: Harvey Harrison <harvey.harrison@...il.com> To: Ingo Molnar <mingo@...e.hu> Cc: Ananth N Mavinakayanahalli <ananth@...ibm.com>, Jim Keniston <jkenisto@...ibm.com>, Roland McGrath <roland@...hat.com>, Arjan van de Ven <arjan@...radead.org>, prasanna@...ibm.com, anil.s.keshavamurthy@...el.com, davem@...emloft.net, systemtap-ml <systemtap@...rces.redhat.com>, LKML <linux-kernel@...r.kernel.org>, Andrew Morton <akpm@...ux-foundation.org> Subject: [PATCH 1/4] x86: fix jprobe_saved_sp handling This patch fixes a bug of jprobe and cleans up. jprobe for x86-64 can cause kernel page fault when the jprobe_return() is called from incorrect function. Anyway, that path finally invokes BUG() macro, so this is not so serious. Based on patch from Masami Hiramatsu <mhiramat@...hat.com> - Use jprobe_saved_regs instead getting it from stack. (Especially on x86-64, it may get incorrect data, because pt_regs can not be get by using container_of(rsp)) - Change the type of stack pointer to unsigned long *. Signed-off-by: Harvey Harrison <harvey.harrison@...il.com> --- arch/x86/kernel/kprobes.c | 8 ++------ include/asm-x86/kprobes.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index e5b7d07..9130c01 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c @@ -1022,16 +1022,12 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { #ifdef CONFIG_X86_32 if (®s->sp != kcb->jprobe_saved_sp) { - struct pt_regs *saved_regs = - container_of(kcb->jprobe_saved_sp, - struct pt_regs, sp); + struct pt_regs *saved_regs = &kcb->jprobe_saved_sp; printk("current sp %p does not match saved sp %p\n", ®s->sp, kcb->jprobe_saved_sp); #else if ((long *)regs->sp != kcb->jprobe_saved_sp) { - struct pt_regs *saved_regs = - container_of(kcb->jprobe_saved_sp, - struct pt_regs, sp); + struct pt_regs *saved_regs = &kcb->jprobe_saved_sp; printk("current sp %p does not match saved sp %p\n", (long *)regs->sp, kcb->jprobe_saved_sp); #endif diff --git a/include/asm-x86/kprobes.h b/include/asm-x86/kprobes.h index e348ed6..7319c62 100644 --- a/include/asm-x86/kprobes.h +++ b/include/asm-x86/kprobes.h @@ -79,7 +79,7 @@ struct kprobe_ctlblk { unsigned long kprobe_status; unsigned long kprobe_old_flags; unsigned long kprobe_saved_flags; - long *jprobe_saved_sp; + unsigned long *jprobe_saved_sp; struct pt_regs jprobe_saved_regs; kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; struct prev_kprobe prev_kprobe; -- 1.5.4.rc0.1083.gf568 -- 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