bugGNU GRUB - Bugs: bug #13606, GRUB should allow Linux cmdline...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #13606: GRUB should allow Linux cmdline >256 chars with boot protocol >=2.06

Submitter:  Alon Bar-Lev <alonbl>
Submitted:  Sat 02 Jul 2005 10:40:20 AM UTC
Votes: 100
 
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  Action Request
Status:  Fixed Privacy:  Public
Assigned to:  phcoder Originator Name:  Alon Bar-Lev
Open/Closed:  Closed Release:  Bazaar - experimental branch
Release:  CVS Reproducibility:  Every Time
Planned Release:  None

Jump to the original submission

Sat 13 Nov 2010 08:33:08 PM UTC, comment #23: 

cmd_linux_size is honored in experimental if protocol >= 2.06 now

Vladimir Serbinenko <phcoder>
Group administrator
Wed 09 Sep 2009 12:51:04 AM UTC, comment #22: 

The current kernel documentation indicates that support for command line sizes larger than 255 was added in boot protocol 2.06, with the addition of a cmdline_size field. I'll look at supporting this.

Colin Watson <cjwatson>
Group Member
Thu 28 Aug 2008 06:57:22 PM UTC, comment #21: 

Ok so this report should just be >= 2.02
thanks for clarifying :)

>It is simple to support both <2.02 and >=2.02 protocols in grub


Well I didn't bother to look at the details (e.g. grub linux loader code ;) )
I just think that it's not bad to get completely rid of old stuff and kernels before 2.4.0 are really old
kernel.org says latest 2.2.26 is from 2004-02-25
But if it seems that it's not complicated then why not just keeping the old support.

Felix Zielcke <fzielcke>
Group Member
Thu 28 Aug 2008 06:42:42 PM UTC, comment #20: 

Hello,

The boot protocol 2.02 had the cmd_line_ptr which points to null terminated string. There was a comment in the documentation that this string will be truncated to 256 by the kernel but may be longer.

grub developers interpreted the above as they should truncate the string at grub, as a result kernels patched to enable longer strings were unusable with grub (unlike lilo or syslinux).

At linux-2.6.21 I finally was able to add support for long command-line strings (currently 2048). No change to the boot protocol was required, as cmd_line_ptr is null terminated.

Then someone thought that it would be nice if the bootloader will be able to determine the maximum size in order to warn/fail if command-line is truncated. This result in a new boot protocol revision.

It is simple to support both <2.02 and >=2.02 protocols in grub. If cmd_line_ptr is available just forward untrancated string... That's all.

What more can I do in order to help resolve this?

Alon Bar-Lev <alonbl>
Thu 28 Aug 2008 03:43:48 PM UTC, comment #19: 

Urm why does the report say > 2.02 ?
As linked in previous post protocol 2.03 says only:

Protocol 2.03:  (Kernel 2.4.18-pre1) Explicitly makes the highest possible
                 initrd address available to the bootloader.

So either > 2.02 is wrong or someone of the Kernel team sleeped

But still 2.4.18-pre1 is a bit old ;)

Felix Zielcke <fzielcke>
Group Member
Thu 28 Aug 2008 03:39:25 PM UTC, comment #18: 

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/x86/i386/boot.txt;hb=HEAD

The Kernel documentation says:

Protocol 2.02:  (Kernel 2.4.0-test3-pre3)

Should we even bother to support kernels below 2.4.0 ?
I think the people who uses grub2 doestn't use a that old kernel anymore
and even if, I doubt they want to use a kernel line bigger then 255 chars.

Felix Zielcke <fzielcke>
Group Member
Fri 22 Aug 2008 03:34:05 PM UTC, comment #17: 


> There's a new loader now, in loader/i386/linux.c, which for
> now is only used on coreboot (but is trivial to enable it on
> i386-pc by editting conf/i386-pc.*). Does it also exhibit
> this problem?


As far as I can see, (GRUB_LINUX_CL_END_OFFSET-GRUB_LINUX_CL_OFFSET) = 0xff
And argv[] is truncated to this amount.

I believe you guys can do this much better than I can. Only needed action to be taken is to set cmd_line_ptr on >=2.02 protocol to untruncated null terminated string.

So construct a string out of argv[], then copy/truncate this to the old command-line 256 buffer for compatibility.

Grub is much more complex than this one...

This is opened from jul-2007!!!

Alon Bar-Lev <alonbl>
Fri 22 Aug 2008 12:16:56 PM UTC, comment #16: 

There's a new loader now, in loader/i386/linux.c, which for now is only used on coreboot (but is trivial to enable it on i386-pc by editting conf/i386-pc.*).  Does it also exhibit this problem?

Robert Millan <robertmh>
Group administrator
Thu 21 Aug 2008 07:38:58 PM UTC, comment #15: 

Alon Bar-Lev

>> Marco & Okuji: could you take care of the legal stuff?



>What legal stuff? This is only a patch.


http://www.gnu.org/prep/standards/html_node/Contributions.html#Contributions

Everything modified on GRUB is a patch.
only patches gets commited to the SVN

>> Alon: could you include a ChangeLog entry?


>Something such as:
>cmd_line_ptr should not be truncated to 256.


Look at the file ChangeLog for examples and use the GCS as a manual for it, the same for the coding style.
http://www.gnu.org/prep/standards/html_node/index.html

Felix Zielcke <fzielcke>
Group Member
Tue 15 Jul 2008 06:21:10 PM UTC, comment #14: 

Ping, should not be so difficult.

Alon Bar-Lev <alonbl>
Sat 03 May 2008 02:19:48 PM UTC, comment #13: 

Hello,

> Marco & Okuji: could you take care of the legal stuff?


What legal stuff? This is only a patch.

> Alon: could you include a ChangeLog entry?


Something such as:
cmd_line_ptr should not be truncated to 256.

> You may also
> want to send a reminder to -email is unavailable- to make
> sure this isn't forgotten.


I did [1]... however I believe that back tracking system is the tool you want to use in order to not forget stuff... :)

Alon.

[1] http://lists.gnu.org/archive/html/grub-devel/2008-05/msg00019.html

Alon Bar-Lev <alonbl>
Sat 03 May 2008 02:13:26 PM UTC, comment #12: 


Marco & Okuji: could you take care of the legal stuff?

Alon: could you include a ChangeLog entry?  You may also want to send a reminder to -email is unavailable- to make sure this isn't forgotten.

Thanks

Robert Millan <robertmh>
Group administrator
Sat 15 Dec 2007 10:02:40 PM UTC, comment #11: 

The last release was 1.95, although I wouldn't recommend using it because it has known bugs.  Try CVS instead.

As for a stable release (2.0), we haven't reached that yet, but it's worth noting that GRUB Legacy never had a stable release (1.0) either.

Robert Millan <robertmh>
Group administrator
Sat 15 Dec 2007 08:45:30 PM UTC, comment #10: 

Nobody using grub-2, it even not released, right?
So why not push a new release to active users?

Alon Bar-Lev <alonbl>
Sat 15 Dec 2007 08:34:12 PM UTC, comment #9: 


We've moved to GRUB 2 as a development platform. Please can you check if this bug still applies there, and if it does, reopen it?

Thanks

Robert Millan <robertmh>
Group administrator
Fri 23 Feb 2007 06:09:50 PM UTC, comment #8: 

Hello,

Please notice that 2.6.21-rc1 already support >256 command-line size. Please checkout the patch provided or create your own, so that users who use grub will be able to use this new feature.

Thanks!

Alon Bar-Lev <alonbl>
Sat 26 Aug 2006 12:11:39 AM UTC, comment #7: 

Can you please look at file#10589 and confirm you adding this on grub 2.0?

Alon Bar-Lev <alonbl>
Thu 13 Apr 2006 10:04:09 PM UTC, comment #6: 

Hello,

Well... I had to do it my-self... Although I am not sure that this is correct. Can you please at least look at this patch and approve that it does what it ment to?

But I think grub should handle (as it states in boot.txt):
a boot loader may allow a longer command line to be passed to permit future kernels to extend this limit.

Best Regards,
Alon Bar-Lev.

Alon Bar-Lev <alonbl>
Mon 14 Nov 2005 05:52:34 PM UTC, comment #5: 

Hello,

At kernel 2.6.14 we finally succeeded in modifying the document:

-----

From THE LINUX/I386 BOOT PROTOCOL:

The kernel command line is a null-terminated string currently up to 255 characters long, plus the final null.  A string that is too long will be automatically truncated by the kernel, a boot loader may allow a longer command line to be passed to permit future kernels to extend this limit.

-----

Can you please consider to pass the whole arg contents to the kernel? It should be safe now to assume this is expected behavior.

Next kernel will most probably be released with default of 1024 command line buffer, so let's get ready...

Thanks!
Alon Bar-Lev

Alon Bar-Lev <alonbl>
Sat 20 Aug 2005 04:23:16 PM UTC, comment #4: 

Hello Yoshinori,

I will be happy to read your comments regarding my reply...

Alon Bar-Lev <alonbl>
Mon 08 Aug 2005 04:15:38 PM UTC, comment #3: 

Thank you Yoshinori for your response!!!

I've entered this issue since once I had a need for >256 command line length... And started investigate why it cannot be done.
I've read the boot protocol, and it seems the old boot protocol had a limitation of one disk sector, so it had a size limit.

The new boot protocol added a new pointer which has no size limit...

So I've found the constants that specifies the limit, it located at include/asm-%ARCH%/setup.h and/or at include/asm-%ARCH%/param.h, variable name is COMMAND_LINE_SIZE.

There is a difference between several architecture... Most have limit of 512 bytes.

Why I telling this story? Since after I've prepared a kernel that can receive up to 1024 bytes of command line, I found out that although GRUB prints the long command line arguments, it truncates it before it passes the command line to the kernel.

So I've failed to setup an environment that can receive long kernel command line...

I think GRUB should not truncate the command line before it passes it to kernel in the new protocol (lh->cmd_line_ptr), so that people can configure their kernel to handle it. The old protocol handling should stay as is, truncate the command line and move it to the boot header.

This should be very simple since you already have it as a null terminated, all you need to do is to relocated the complete buffer into static memory place and set its reference in the boot header.

I will be glad to read your point of view.

Later on, I will try to add a configuration option that specify the command line size (I've already done it... But I am waiting for boot loader to support it, before I am opening a request for this in kernel)

Alon Bar-Lev <alonbl>
Sun 07 Aug 2005 06:24:10 PM UTC, comment #2: 

I don't think this is a bug. From THE LINUX/I386 BOOT PROTOCOL:

** THE KERNEL COMMAND LINE

The kernel command line has become an important way for the boot
loader to communicate with the kernel.  Some of its options are also
relevant to the boot loader itself, see "special command line options"
below.

The kernel command line is a null-terminated string up to 255
characters long, plus the final null.

If the boot protocol version is 2.02 or later, the address of the
kernel command line is given by the header field cmd_line_ptr (see
above.)

If the protocol version is not 2.02 or higher, the kernel
command line is entered using the following protocol:

        At offset 0x0020 (word), "cmd_line_magic", enter the magic
        number 0xA33F.

        At offset 0x0022 (word), "cmd_line_offset", enter the offset
        of the kernel command line (relative to the start of the
        real-mode kernel).

        The kernel command line must be within the memory region
        covered by setup_move_size, so you may need to adjust this
        field.

This description sounds like the kernel still has the limitation of 255 bytes.

Yoshinori K. Okuji <okuji>
Group administrator
Sat 06 Aug 2005 08:19:05 PM UTC, comment #1: 

Hello,
Can anybody confirm this is a bug?
This behavior is the same in GRUB 2... So I think it is a good time to fix it...
Thanks!

Alon Bar-Lev <alonbl>
Sat 02 Jul 2005 10:40:20 AM UTC, original submission:  

Please consider the following:
Currently (legacy and new) grub forces the 2.02 protocol cmd_line_ptr to point to the same memory area of the old protocol.

The result is that the limitation of the old protocol to a 256 bytes command-line is inherit by the new protocol.

Please consider changing this behavior so that new protocol can receive more than 256 bytes.

if (lh->version >= 0x0202)
-  lh->cmd_line_ptr = linux_data_real_addr + LINUX_CL_OFFSET;
+  lh->cmd_line_ptr = fixup (arg);

Alon Bar-Lev <alonbl>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #15592:  grub-1.96-long-cmdline.patch added by alonbl (3KiB - text/x-diff - grub-1.96-long-cmdline.patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by cjwatson (Posted a comment)
  • -email is unavailable- added by fzielcke (Posted a comment)
  • -email is unavailable- added by robertmh
  • -email is unavailable- added by robertmh
  • -email is unavailable- added by robertmh (Posted a comment)
  • -email is unavailable- added by alonbl (Posted a comment)
  •  

    There are 100 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 25 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-11-13 phcoder StatusNone Fixed
        Assigned tocjwatson phcoder
        Open/ClosedOpen Closed
        ReleaseBazaar - trunk Bazaar - experimental branch
    2009-09-09 cjwatson SummaryGRUB should allow Linux cmdline &gt;256 chars with boot protocol &gt;=2.02 GRUB should allow Linux cmdline >256 chars with boot protocol >=2.06
    2009-09-09 cjwatson Assigned toNone cjwatson
        ReleaseNone Bazaar - trunk
    2008-09-03 fzielcke Attached File#15408 Removed
    2008-09-03 fzielcke Attached File#10589 Removed
    2008-09-03 fzielcke Attached File#9783 Removed
    2008-09-03 fzielcke Attached File#9782 Removed
    2008-09-03 fzielcke Attached File#9781 Removed
    2008-08-28 fzielcke SummaryGRUB should allow Linux command-line&gt;256 bytes with boot protocol&gt;2.02 GRUB should allow Linux cmdline >256 chars with boot protocol >=2.02
    2008-05-03 robertmh Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-
    2008-05-03 robertmh Open/ClosedClosed Open
        Release0.96-2 CVS
    2008-05-02 alonbl Attached File- Added grub-1.96-long-cmdline.patch, #15592
    2008-04-06 alonbl Attached File- Added 550_all_grub-0.97-long-commandline.patch, #15408
    2007-12-15 robertmh Open/ClosedOpen Closed
    2006-08-26 alonbl Attached File- Added grub-0.96-linux-0202.patch, #10589
    2006-04-28 alonbl Carbon-Copy- Added alonbl
    2006-04-13 alonbl Attached File- Added grub-0.96-linux-0202.patch, #9783
    2006-04-13 alonbl Attached File- Added grub-0.96-linux-0202.patch, #9782
    2006-04-13 alonbl Attached File- Added grub-0.96-linux-0202.patch, #9781

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code