libxl: check HVM direct boot parameters
PATCH 1/1 libxl: check HVM direct boot parameters
We should honour -initrd and -append iff -kernel is specified, because that's how QEMU works.
Check direct boot parameters in libxl__domain_build_info_setdefault. Return failure if kernel is missing while ramdisk (-initrd) and / or cmdline (-append) is present.
--- tools/libxl/libxl_create.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/libxl/libxl_create.c +9 -0
@@ -170,6 +170,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,break ;default :abort (); } + +/* Check HVM direct boot parameters, we should honour ->ramdisk and +* ->cmdline iff ->kernel is set. +*/ +if (!b_info->kernel && (b_info->ramdisk || b_info->cmdline)) { +LIBXL__LOG (CTX ,XLT_ERROR , +"direct boot parameters specified but kernel is missing" ); +return ERROR_INVAL ; + } } if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
Signature · 1 line
1.7.10.4
Quoted 21 lines · Wei Liu
We should honour -initrd and -append iff -kernel is specified, because that's how QEMU works.
Check direct boot parameters in
libxl__domain_build_info_setdefault. Return failure if kernel is missing while ramdisk (-initrd) and / or cmdline (-append) is present.Signed-off-by Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Chunyan Liu <[email protected]>--- tools/libxl/libxl_create.c | 9 +++++++++ 1 file changed, 9 insertions(+)tools/libxl/libxl_create.c +0
-0
tools/libxl/libxl_create.c int libxl__domain_build_info_setdefault(libxl__gc *gc, · line 179
Quoted 10 lines
tools/libxl/libxl_create.c +7
-0@@ -170,6 +170,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,break ;default :abort (); } + +/* Check HVM direct boot parameters, we should honour ->ramdisk and +* ->cmdline iff ->kernel is set. +*/ +if (!b_info->kernel && (b_info->ramdisk || b_info->cmdline)) { +LIBXL__LOG (CTX ,XLT_ERROR , +"direct boot parameters specified but kernel is missing" );
Hmm... There's a formatting error. I can resend if it's necessary.
Quoted 7 lines
tools/libxl/libxl_create.c +2
-0+return ERROR_INVAL ; + } } if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&Signature · 1 line
1.7.10.4
Ian Campbell
Acked-byQuoted 26 lines · Wei Liu
Quoted 25 lines · Wei Liu
We should honour -initrd and -append iff -kernel is specified, because that's how QEMU works.
Check direct boot parameters in
libxl__domain_build_info_setdefault. Return failure if kernel is missing while ramdisk (-initrd) and / or cmdline (-append) is present.Signed-off-by Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Chunyan Liu <[email protected]>--- tools/libxl/libxl_create.c | 9 +++++++++ 1 file changed, 9 insertions(+)tools/libxl/libxl_create.c +1
-0@@ -170,6 +170,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,break ;default :abort (); } +
Quoted 8 lines
tools/libxl/libxl_create.c int libxl__domain_build_info_setdefault(libxl__gc *gc, · line 179
Quoted 6 lines
tools/libxl/libxl_create.c +6
-0+/* Check HVM direct boot parameters, we should honour ->ramdisk and +* ->cmdline iff ->kernel is set. +*/ +if (!b_info->kernel && (b_info->ramdisk || b_info->cmdline)) { +LIBXL__LOG (CTX ,XLT_ERROR , +"direct boot parameters specified but kernel is missing" );Hmm... There's a formatting error. I can resend if it's necessary.
In trying to correctly indent this line while committing I pushed it over 80-columns, rather than my rewrapping more, could you make this use the LOG helper please, and thereby pull everything in a bit?
With that done:
Ian.