: xc: fix segfault in pv domain create if kernel is an invalid image
PATCH 1/1 : xc: fix segfault in pv domain create if kernel is an invalid image
If libelf calls elf_err() or elf_msg() before elf_set_log() has been called then it could potentially read an uninitialised log handling callback function pointer from struct elf_binary. Fix this in libxc by zeroing the structure before calling elf_init().
Signed-off-by Gianni Tedesco <[email protected]>
tools/libxc/xc_hvm_build.c +1 -0
@@ -141,6 +141,7 @@ static int setup_guest(xc_interface *xchif ( memsize > target ) pod_mode =1 ; +memset (&elf,0 ,sizeof (elf));if (elf_init (&elf, image, image_size) !=0 ) goto error_out;elf_parse_binary (&elf);
Stefano Stabellini
AppliedQuoted 12 lines · Gianni Tedesco
If libelf calls
elf_err()orelf_msg()beforeelf_set_log()has been called then it could potentially read an uninitialised log handling callback function pointer from structelf_binary. Fix this in libxc by zeroing the structure before callingelf_init().Signed-off-by Gianni Tedesco <[email protected]>diff -r
ac93a1ec290ctools/libxc/xc_hvm_build.c
tools/libxc/xc_hvm_build.c static int setup_guest(xc_interface *xch · line 147
Quoted 7 lines
tools/libxc/xc_hvm_build.c +1
-0@@ -141,6 +141,7 @@ static int setup_guest(xc_interface *xchif ( memsize > target ) pod_mode =1 ; +memset (&elf,0 ,sizeof (elf));if (elf_init (&elf, image, image_size) !=0 ) goto error_out;elf_parse_binary (&elf);
applied, thanks