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:	Tue, 22 Apr 2008 12:18:23 -0400
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Adrian Bunk <bunk@...nel.org>, ananth@...ibm.com,
	anil.s.keshavamurthy@...el.com, davem@...emloft.net,
	bugme-daemon@...zilla.kernel.org,
	jean-marc LACROIX <jeanmarc.lacroix@...e.Fr>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Arjan van de Ven <arjan@...ux.intel.com>
Subject: Re: [Bug 10489] Kprobe smoke test lockdep warning

Hi Peter,

Thank you for the patch,

Peter Zijlstra wrote:
> So the below makes it work - but I'm not getting this code; at the time
> I wrote that stuff I CC'ed each and every kprobe maintainer listed in
> the usual places but got no reposonse - can some please explain this
> stuff to me?

Sure, I came to the same decision. It is enough to remove unnecessary
trace_hardirqs_fixup_flags() from post_kprobe_handler. pt_regs->flags is
just a variable on stack -- not effective flags in that time. So we don't
need to change thread's hardirq flag.

> Are the saved flags only for the TF bit or are they made in full effect
> later (and if so, where) ?

The saved flags is for TF and IF bits.
Actually, kprobes does following:

---
do_int3()
 kprobe_exceptions_notify()
  kprobe_handler()
   prepare_singlestep() : save regs->flags, set TF and clear IF on regs->flags
"iret" : pop regs->flags image to EFLAGS reg.

<single step an instruction>

do_debug()
 kprobe_exceptions_notify()
  post_kprobe_handler() : restore regs->flags (clearing TF and restoring IF)
"iret" : pop regs->flags image to EFLAGS reg.
---

While executing a single step, EFLAGS is different from the original EFLAGS.
However, it will be recovered soon by post_kprobe_handler.
NOTE: if the single-stepping instruction is a pushf, kprobes writes saved
     EFLAGS to the top of stack.

> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>

I tested it on x86-64/i386.

Acked-by: Masami Hiramatsu <mhiramat@...hat.com>

> ---
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
> index 34a5912..fe71e64 100644
> --- a/arch/x86/kernel/kprobes.c
> +++ b/arch/x86/kernel/kprobes.c
> @@ -865,7 +865,6 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
>  
>         resume_execution(cur, regs, kcb);
>         regs->flags |= kcb->kprobe_saved_flags;
> -       trace_hardirqs_fixup_flags(regs->flags);
>  
>         /* Restore back the original saved kprobes variables and continue. */
>         if (kcb->kprobe_status == KPROBE_REENTER) {
> 
> 
> 

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ