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]
Message-ID: <CALCETrXxNcyJWOrnqMootBZpjVvxTx7SdKEPDG_PMCQa8cViqw@mail.gmail.com>
Date:	Thu, 26 Feb 2015 07:12:40 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Oleg Nesterov <oleg@...hat.com>, Li Zefan <lizefan@...wei.com>,
	Steven Rostedt <rostedt@...dmis.org>, wangnan0@...wei.com,
	Andy Lutomirski <luto@...capital.net>
Cc:	"linux-tip-commits@...r.kernel.org" 
	<linux-tip-commits@...r.kernel.org>
Subject: Re: [tip:x86/asm] x86/traps: Enable DEBUG_STACK after cpu_init() for TRAP_DB/BP

On Thu, Feb 26, 2015 at 5:12 AM, tip-bot for Wang Nan <tipbot@...or.com> wrote:
> Commit-ID:  b4d8327024637cb2a1f7910dcb5d0ad7a096f473
> Gitweb:     http://git.kernel.org/tip/b4d8327024637cb2a1f7910dcb5d0ad7a096f473
> Author:     Wang Nan <wangnan0@...wei.com>
> AuthorDate: Thu, 26 Feb 2015 13:49:39 +0800
> Committer:  Ingo Molnar <mingo@...nel.org>
> CommitDate: Thu, 26 Feb 2015 12:29:20 +0100
>
> x86/traps: Enable DEBUG_STACK after cpu_init() for TRAP_DB/BP
>
> Before this patch early_trap_init() installs DEBUG_STACK for
> X86_TRAP_BP and X86_TRAP_DB. However, DEBUG_STACK doesn't work
> correctly until cpu_init() <-- trap_init().
>
> This patch passes 0 to set_intr_gate_ist() and
> set_system_intr_gate_ist() instead of DEBUG_STACK to let it use
> same stack as kernel, and installs DEBUG_STACK for them in
> trap_init().
>

Sorry, I'm late to the party.  This patch, while technically correct
AFAICT, is really ugly, because the whole point is that it *doesn't*
use ist.  In other words:

> +       set_intr_gate_ist(X86_TRAP_DB, &debug, 0);

That should be set_intr_gate(X86_TRAP_DB, &debug);

>         /* int3 can be called from all */
> -       set_system_intr_gate_ist(X86_TRAP_BP, &int3, DEBUG_STACK);
> +       set_system_intr_gate_ist(X86_TRAP_BP, &int3, 0);

Similarly, this should be set_system_gate.

>  #ifdef CONFIG_X86_32
>         set_intr_gate(X86_TRAP_PF, page_fault);
>  #endif
> @@ -1005,6 +1013,15 @@ void __init trap_init(void)
>          */
>         cpu_init();
>
> +       /*
> +        * X86_TRAP_DB and X86_TRAP_BP have been set
> +        * in early_trap_init(). However, DEBUG_STACK works only after
> +        * cpu_init() loads TSS. See comments in early_trap_init().

It's not that DEBUG_STACK only works after the TSS is loaded; it's
that the IST mechanism only works after TSS is loaded.

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