xen: Fix off-by-one error when parsing command line arguments
This is a bug which is present in at least unstable and 4.1, so should be considered for 4.2, as well as being considered for backport to older versions.
Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com
# HG changeset patch
# Parent 4f92bdf3370c4fe5ed0f00cdeaf8156e4818ecb5
xen: Fix off-by-one error when parsing command line arguments
As Xen currently stands, it will attempt to interpret the first few bytes of the initcall section as a struct kernel_param.
This can be verified as
for ( param = &__setup_start; param <= &__setup_end; param++ )
{+ if ( (unsigned long)param == (unsigned long)&__initcall_start )
+ BUG();
causes Xen to BUG() during early boot.
The reason that this not caused problems is because in the overflow case, param->name is actually a function pointer to the first initcall, and intepreting it as string is very unlikely to match an ASCII command line parameter name.
xen/common/kernel.c +1 -1
@@ -90,7 +90,7 @@ void __init cmdline_parse(const char *cmif ( !bool_assert ) optkey +=3 ; -for ( param = &__setup_start; param <= &__setup_end; param++ ) +for ( param = &__setup_start; param < &__setup_end; param++ ) {if (strcmp (param->name, optkey) )continue ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Andrew Cooper
This is a bug which is present in at least unstable and 4.1, so should be considered for 4.2, as well as being considered for backport to older versions.
Indeed, the problem goes back to at least 3.2.0.
Keir, if you would ack this I could push it into -unstable at least (pulling over into 4.1 and 4.0 would still need to be done later by you).
Jan