Wei Yongjun
2009-Dec-07 08:23 UTC
[Xen-devel] x86: fix to parse multiboot command line passed by latest grub
latest grub had changed to "don''t pass filename in multiboot command line". The old cmdline format is: "module-name options..." The new cmdline format is: "options..." So xen + grub2 always loss the first option, because xen will skip the first option. Usually, the module-name is not start with char [a-zA-Z], such as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added isalpha() test of the first char of module-name/option to function cmdline_cook(), try to handle both the old and new cmdline format. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -423,6 +423,8 @@ p = p ? : ""; while ( *p == '' '' ) p++; + if (isalpha(*p)) + return p; while ( (*p != '' '') && (*p != ''\0'') ) p++; while ( *p == '' '' ) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Yongjun
2009-Dec-07 08:26 UTC
[Xen-devel] [PATCH] x86: fix to parse multiboot command line passed by latest grub
latest grub had changed to "don''t pass filename in multiboot command line". The old cmdline format is: "module-name options..." The new cmdline format is: "options..." So xen + grub2 always loss the first option, because xen will skip the first option. Usually, the module-name is not start with char [a-zA-Z], such as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added isalpha() test of the first char of modulename/option to function cmdline_cook(), try to handle both the old and new cmdline format. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -423,6 +423,8 @@ p = p ? : ""; while ( *p == '' '' ) p++; + if (isalpha(*p)) + return p; while ( (*p != '' '') && (*p != ''\0'') ) p++; while ( *p == '' '' ) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2009-Dec-07 09:19 UTC
Re: [Xen-devel] [PATCH] x86: fix to parse multiboot command line passed by latest grub
On Mon, 2009-12-07 at 08:26 +0000, Wei Yongjun wrote:> latest grub had changed to "don''t pass filename in multiboot > command line". > > The old cmdline format is: "module-name options..." > The new cmdline format is: "options..." > > So xen + grub2 always loss the first option, because xen will > skip the first option. > > Usually, the module-name is not start with char [a-zA-Z], such > as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added > isalpha() test of the first char of modulename/option to > function cmdline_cook(), try to handle both the old and new > cmdline format.Xen doesn''t actually complain about unknown options, does it? So why not simply stop stripping the first option altogether? Under grub1 Xen will just ignore it and under grub2 it won''t be passed in. Ian.> > Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> > > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -423,6 +423,8 @@ > p = p ? : ""; > while ( *p == '' '' ) > p++; > + if (isalpha(*p)) > + return p; > while ( (*p != '' '') && (*p != ''\0'') ) > p++; > while ( *p == '' '' ) > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Yongjun
2009-Dec-07 09:47 UTC
Re: [Xen-devel] [PATCH] x86: fix to parse multiboot command line passed by latest grub
Ian Campbell wrote:> On Mon, 2009-12-07 at 08:26 +0000, Wei Yongjun wrote: > >> latest grub had changed to "don''t pass filename in multiboot >> command line". >> >> The old cmdline format is: "module-name options..." >> The new cmdline format is: "options..." >> >> So xen + grub2 always loss the first option, because xen will >> skip the first option. >> >> Usually, the module-name is not start with char [a-zA-Z], such >> as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added >> isalpha() test of the first char of modulename/option to >> function cmdline_cook(), try to handle both the old and new >> cmdline format. >> > > Xen doesn''t actually complain about unknown options, does it? So why not > simply stop stripping the first option altogether? Under grub1 Xen will > just ignore it and under grub2 it won''t be passed in. >That it is OK. But the module-name will pass to the dom0, the cmdline of dom0 like this under grub1: # cat /proc/cmdline /boot/vmlinuz-2.6.31.6-xen root=UUID=575f3be9-0a50-4d62-a36d-800e85a7aa70 ro console=tty0 Other way, I will send a patch as your advice^_^. Thanks> Ian. > > >> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> >> >> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c >> --- a/xen/arch/x86/setup.c >> +++ b/xen/arch/x86/setup.c >> @@ -423,6 +423,8 @@ >> p = p ? : ""; >> while ( *p == '' '' ) >> p++; >> + if (isalpha(*p)) >> + return p; >> while ( (*p != '' '') && (*p != ''\0'') ) >> p++; >> while ( *p == '' '' ) >> >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >> > > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei Yongjun
2009-Dec-07 09:48 UTC
[Xen-devel] [PATCHv2] x86: fix to parse multiboot command line passed by latest grub
latest grub had changed to "don''t pass filename in multiboot command line". The old cmdline format is: "module-name options..." The new cmdline format is: "options..." So xen + grub2 always loss the first option, because xen will skip the first option. Since xen doesn''t actually complain about unknown options, so simply stop stripping the first option altogether, under grub1 Xen will just ignore it and under grub2 it won''t be passed in. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -423,10 +423,6 @@ p = p ? : ""; while ( *p == '' '' ) p++; - while ( (*p != '' '') && (*p != ''\0'') ) - p++; - while ( *p == '' '' ) - p++; return p; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Dec-07 09:57 UTC
[Xen-devel] Re: x86: fix to parse multiboot command line passed by latest grub
I recommend just sticking a dummy first arg when writing a command line for grub2, and living with it. Or get grub2 guys to give us a flag to detect this stupid compatibility breakage. I don''t really want hacks like this. -- Keir On 07/12/2009 08:23, "Wei Yongjun" <yjwei@cn.fujitsu.com> wrote:> latest grub had changed to "don''t pass filename in multiboot > command line". > > The old cmdline format is: "module-name options..." > The new cmdline format is: "options..." > > So xen + grub2 always loss the first option, because xen will > skip the first option. > > Usually, the module-name is not start with char [a-zA-Z], such > as /boot/vmlinuz, (hd0,1)/boot/vmlinuz, so this patch added > isalpha() test of the first char of module-name/option to > function cmdline_cook(), try to handle both the old and new > cmdline format. > > Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> > > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -423,6 +423,8 @@ > p = p ? : ""; > while ( *p == '' '' ) > p++; > + if (isalpha(*p)) > + return p; > while ( (*p != '' '') && (*p != ''\0'') ) > p++; > while ( *p == '' '' ) > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Samuel Thibault
2009-Dec-07 10:54 UTC
Re: [Xen-devel] Re: x86: fix to parse multiboot command line passed by latest grub
Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit :> I recommend just sticking a dummy first arg when writing a command line for > grub2, and living with it.That''s what we did in GNU Mach.> Or get grub2 guys to give us a flag to detect > this stupid compatibility breakage.They said multiboot never asserted anything about the command line and thus implementation were allowed to vary without notice. The rationale for grub''s behavior change is that the user has to migrate from grub1 syntax to grub2 syntax anyway.> I don''t really want hacks like this.It was out of question to commit things like this in GNU Mach as well :) Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Simon Horman
2009-Dec-07 22:00 UTC
Re: [Xen-devel] Re: x86: fix to parse multiboot command line passed by latest grub
On Mon, Dec 07, 2009 at 11:54:55AM +0100, Samuel Thibault wrote:> Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit : > > > Or get grub2 guys to give us a flag to detect > > this stupid compatibility breakage. > > They said multiboot never asserted anything about the command line and > thus implementation were allowed to vary without notice. The rationale > for grub''s behavior change is that the user has to migrate from grub1 > syntax to grub2 syntax anyway.They broke it because they could? :-) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Samuel Thibault
2009-Dec-07 22:46 UTC
Re: [Xen-devel] Re: x86: fix to parse multiboot command line passed by latest grub
Simon Horman, le Tue 08 Dec 2009 09:00:00 +1100, a écrit :> On Mon, Dec 07, 2009 at 11:54:55AM +0100, Samuel Thibault wrote: > > Keir Fraser, le Mon 07 Dec 2009 09:57:41 +0000, a écrit : > > > > > Or get grub2 guys to give us a flag to detect > > > this stupid compatibility breakage. > > > > They said multiboot never asserted anything about the command line and > > thus implementation were allowed to vary without notice. The rationale > > for grub''s behavior change is that the user has to migrate from grub1 > > syntax to grub2 syntax anyway. > > They broke it because they could? :-)Yes... Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Dec-08 07:39 UTC
Re: [Xen-devel] Re: x86: fix to parse multiboot command line passed by latest grub
On 07/12/2009 22:00, "Simon Horman" <horms@verge.net.au> wrote:>>> Or get grub2 guys to give us a flag to detect >>> this stupid compatibility breakage. >> >> They said multiboot never asserted anything about the command line and >> thus implementation were allowed to vary without notice. The rationale >> for grub''s behavior change is that the user has to migrate from grub1 >> syntax to grub2 syntax anyway. > > They broke it because they could? :-)Yes, it''s both stupid and arrogant. Oh well. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel