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] [day] [month] [year] [list]
Date:	Wed, 12 Jun 2013 17:05:00 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"the arch/x86 maintainers" <x86@...nel.org>,
	Gokul Caushik <caushik1@...il.com>,
	Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH] x86, boot: access cmdline when loaded high

On Tue, Jun 11, 2013 at 1:54 PM, Yinghai Lu <yinghai@...nel.org> wrote:
> On Tue, Jun 11, 2013 at 12:26 PM, Kees Cook <keescook@...omium.org> wrote:
>> On Tue, Jun 11, 2013 at 12:17 PM, Yinghai Lu <yinghai@...nel.org> wrote:
>>> On Tue, Jun 11, 2013 at 11:41 AM, Kees Cook <keescook@...omium.org> wrote:
>>>> The __cmdline_find_option routine requires that the kernel cmdline be
>>>> located under 0x10000. When running the compressed boot code, if the
>>>> cmdline is loaded above this range, it will be ignored. This breaks
>>>> recognition of things like "earlyprintk=...". Since the compressed boot
>>>> code is already tricking the cmdline routines about locations, take it all
>>>> the way and access the cmdline via offset instead of via actual location.
>>>
>>> Hi,
>>>
>>> What is point of the patch?
>>> It looks like it try to fix one bug, but it doesn't,
>>> as there is no bug out there.
>>>
>>> Before the patch, command line that is loaded high
>>> can be processed correctly in arch/x86/boot/compressed/cmdline.c.
>>
>> It can't. Here is the code from arch/x86/boot/cmdline.c:
>
> Are you sure?
>
> I tested that with kexec loaded second kernel high.
>
> How do you test that?
>
>>
>> int __cmdline_find_option(unsigned long cmdline_ptr, const char
>> *option, char *buffer, int bufsize)
>> ...
>>         if (!cmdline_ptr)
>>                 return -1;      /* No command line */
>>
>>         cptr = cmdline_ptr & 0xf;
>>         set_fs(cmdline_ptr >> 4);
>>
>>         while (cptr < 0x10000 && (c = rdfs8(cptr++))) {
>>
>>
>> This means that if get_cmd_line_ptr() returns an address >= 0x10000,
>> __cmdline_find_option will simply ignore the cmdline.
>
> No, you read the code wrong. you miss the
>
> cptr = cmdline_ptr & 0xf;

Ah-ha! I see what I missed. I didn't notice 16a4baa6 which did this:
-       if (!cmdline_ptr || cmdline_ptr >= 0x100000)
-               return -1;      /* No command line, or inaccessible */
+       if (!cmdline_ptr)
+               return -1;      /* No command line */

That fixes the problem I was seeing. :)

Thanks!

-Kees

--
Kees Cook
Chrome OS Security
--
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