mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Bug in patch "x86/pti: Add the pti= cmdline option and documentation"
@ 2017-12-22 16:41 Juergen Gross
  2017-12-22 16:43 ` Borislav Petkov
  2017-12-22 16:43 ` Thomas Gleixner
  0 siblings, 2 replies; 4+ messages in thread
From: Juergen Gross @ 2017-12-22 16:41 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Borislav Petkov, Thomas Gleixner

The patch in the tip tree with commit 506bcdf68b07a0335751e1fe8be37
("x86/pti: Add the pti= cmdline option and documentation") is completely
wrong: cmdline_find_option() will return -1 in case the otion isn't
found and the len of the argument in case it has been found.


Juergen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in patch "x86/pti: Add the pti= cmdline option and documentation"
  2017-12-22 16:41 Bug in patch "x86/pti: Add the pti= cmdline option and documentation" Juergen Gross
@ 2017-12-22 16:43 ` Borislav Petkov
  2017-12-22 16:43 ` Thomas Gleixner
  1 sibling, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2017-12-22 16:43 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Linux Kernel Mailing List, Thomas Gleixner

On Fri, Dec 22, 2017 at 05:41:32PM +0100, Juergen Gross wrote:
> The patch in the tip tree with commit 506bcdf68b07a0335751e1fe8be37
> ("x86/pti: Add the pti= cmdline option and documentation") is completely
> wrong: cmdline_find_option() will return -1 in case the otion isn't
> found and the len of the argument in case it has been found.

It is not completely wrong - we still walk into the if-branch. Besides,
we moved the xen check upwards, before that so it is not relevant for
the xen case.

Regardless, I'll send a correction soon to check the retval directly.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in patch "x86/pti: Add the pti= cmdline option and documentation"
  2017-12-22 16:41 Bug in patch "x86/pti: Add the pti= cmdline option and documentation" Juergen Gross
  2017-12-22 16:43 ` Borislav Petkov
@ 2017-12-22 16:43 ` Thomas Gleixner
  2017-12-22 16:54   ` Borislav Petkov
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-12-22 16:43 UTC (permalink / raw)
  To: Juergen Gross; +Cc: Linux Kernel Mailing List, Borislav Petkov

On Fri, 22 Dec 2017, Juergen Gross wrote:

> The patch in the tip tree with commit 506bcdf68b07a0335751e1fe8be37
> ("x86/pti: Add the pti= cmdline option and documentation") is completely
> wrong: cmdline_find_option() will return -1 in case the otion isn't
> found and the len of the argument in case it has been found.

AArgh .....

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in patch "x86/pti: Add the pti= cmdline option and documentation"
  2017-12-22 16:43 ` Thomas Gleixner
@ 2017-12-22 16:54   ` Borislav Petkov
  0 siblings, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2017-12-22 16:54 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Juergen Gross, Linux Kernel Mailing List

On Fri, Dec 22, 2017 at 05:43:50PM +0100, Thomas Gleixner wrote:
> On Fri, 22 Dec 2017, Juergen Gross wrote:
> 
> > The patch in the tip tree with commit 506bcdf68b07a0335751e1fe8be37
> > ("x86/pti: Add the pti= cmdline option and documentation") is completely
> > wrong: cmdline_find_option() will return -1 in case the otion isn't
> > found and the len of the argument in case it has been found.
> 
> AArgh .....

Please fold this in:

---
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 2a5c1b9bdf73..f9fd4eb74d20 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -69,13 +69,15 @@ static void __init pti_print_if_secure(const char *reason)
 void __init pti_check_boottime_disable(void)
 {
 	char arg[5];
+	int ret;
 
 	if (hypervisor_is_type(X86_HYPER_XEN_PV)) {
 		pti_print_if_insecure("disabled on XEN PV.");
 		return;
 	}
 
-	if (cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg))) {
+	ret = cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg));
+	if (ret > 0)  {
 		if (!strncmp(arg, "off", 3)) {
 			pti_print_if_insecure("disabled on command line.");
 			return;

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-22 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 16:41 Bug in patch "x86/pti: Add the pti= cmdline option and documentation" Juergen Gross
2017-12-22 16:43 ` Borislav Petkov
2017-12-22 16:43 ` Thomas Gleixner
2017-12-22 16:54   ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®