From: Arvind Sankar <nivedita@alum.mit.edu>
To: Borislav Petkov <bp@alien8.de>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/cmdline: Disable instrumentation of cmdline unconditionally
Date: Thu, 17 Sep 2020 12:05:48 -0400 [thread overview]
Message-ID: <20200917160548.GA1877352@rani.riverdale.lan> (raw)
In-Reply-To: <20200917094055.GF31960@zn.tnic>
On Thu, Sep 17, 2020 at 11:40:55AM +0200, Borislav Petkov wrote:
> On Sun, Sep 06, 2020 at 11:46:37AM -0400, Arvind Sankar wrote:
> > On 32-bit, cmdline_find_option_bool() is used before paging is enabled,
> > from check_loader_disabled_bsp() in the early microcode loader.
> > Instrumentation options that insert accesses to global data will likely
> > crash or corrupt memory at this point.
>
> What is the use case here, can you trigger an actual crash?
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
Hm this is a bit embarassing.
I did have a crash and this patch fixed it, but it seems it was on a
branch where I was making changes to cmdline.c, which triggered clang to
use a jump table for cmdline_find_option_bool(). That was the cause of
the crash, and the reason this patch fixed it was because it enabled
-fno-jump-tables, rather than because it disabled instrumentation.
The instrumentation code does write data to random addresses, but
apparently that doesn't necessarily crash the system. This patch would
also be insufficient to fix it, since load_ucode_bsp() itself can have
instrumentation code in it.
Eg with GCOV_PROFILE_ALL enabled, the start of the function is:
c2a7706a <load_ucode_bsp>:
c2a7706a: 55 push %ebp
c2a7706b: 83 05 c0 4d ba c2 01 addl $0x1,0xc2ba4dc0
c2a77072: 83 15 c4 4d ba c2 00 adcl $0x0,0xc2ba4dc4
c2a77079: 89 e5 mov %esp,%ebp
but when it's called from arch/x86/kernel/head_32.S, paging is disabled
and the code is executing out of physical addresses, so it's going to
read/write data from garbage addresses.
Anyway, please ignore this patch and sorry for the noise.
Thanks.
next prev parent reply other threads:[~2020-09-17 16:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-06 15:46 [PATCH] x86/cmdline: Disable instrumentation of cmdline unconditionally Arvind Sankar
2020-09-17 9:40 ` Borislav Petkov
2020-09-17 16:05 ` Arvind Sankar [this message]
2020-09-17 17:28 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200917160548.GA1877352@rani.riverdale.lan \
--to=nivedita@alum.mit.edu \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox