Skip to content
  • William Dauchy's avatar
    kvmtool/run: set a default cmdline if not set · d583df25
    William Dauchy authored
    when starting with custom kernel and disk options, kernel_cmdline is
    NULL; it results in a segfault while trying to look for a string
    using `strstr`:
    
    __strstr_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S:40
    0x00000000004056bf in kvm_cmd_run_init (argc=<optimized out>, argv=<optimized out>) at builtin-run.c:608
    0x000000000040639d in kvm_cmd_run (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin-run.c:659
    0x0000000000412b8f in handle_command (command=0x62bbc0 <kvm_commands>, argc=5, argv=0x7fffffffe840) at kvm-cmd.c:84
    0x00007ffff7211b45 in __libc_start_main (main=0x403540 <main>, argc=6, argv=0x7fffffffe838, init=<optimized out>, fini=<optimized out>,
      rtld_fini=<optimized out>, stack_end=0x7fffffffe828) at libc-start.c:287
    0x0000000000403962 in _start ()
    
    this patch suggests to set a minimal cmdline when kernel_cmdline is NULL
    
    Fixes: 8a7163f3
    
     ("kvmtool/run: append cfg.kernel_cmdline at the end of real_cmdline")
    Signed-off-by: default avatarWilliam Dauchy <william@gandi.net>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    d583df25