[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] need help when libxenlight.so is used



On Sat, May 12, 2018 at 08:55:46PM +0800, Kun Cheng wrote:
> Hello Xen devs,
> 
> I'm learning code in xen-4.10.0/tools/xl to find out how to program with
> libxl.
> 
> I've trying to use libxenlight.so (compiled and installed from xen 4.10.0
> source code) to control my vms from my own code until I met this issue.
> Now my test code follows xl_vmmcontrol.c and tries to create a VM from its
> config file (file can be used to successfully create a vm with 'xl create').
> 
> My Xen make is successful and I can use 'xl' to manage all vms.
> 
> When I test my own code, I got such an error in dmesg"
> 
> test[16678]: segfault at 18 ip 00007f69fa6526ad sp 00007ffe1eadedf0 error 4
> in libxenlight.so.4.10.0[7f69fa61a000+bc000] in dmesg
> 
> and also segmentation fault in my terminal.
> 
> I dumped my debugging info, hoping could give everyone some clue.
> 
> FYI, my program was compiled with:
> 
> gcc -m64 -pthread -std=gnu99  -g xl_executor.c xl_parse.c  xl_utils.c
> xl_nic.c -lxenlight -lxlutil -lxentoollog  -lyajl  -o test
> 
> where xl_executor.c is my code of creating a vm, all other c file are
> copied from tools/xl/
> 
> GDB bebugging info:
> 
> Breakpoint 3, parse_config_data (config_source=0x7fffffffe360
> "/data/chengkun/vms/vm4/vm4.cfg",
>     config_data=0x6155f0 "# ", '=' <repeats 69 times>, "\n# Example HVM
> guest configuration\n# ", '=' <repeats 69 times>, "\n#\n# This is a fairly
> m"..., config_len=1543,
>     d_config=0x7fffffffdde0) at xl_parse.c:993
> 
> 993         if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
> 

One possibility: you didn't follow the convention of using libxl types,
which means you get memory corruption all over the place.

See  libxl.h:L490 for more information.

But for a more likely explanation, see below.

>     gic_version = LIBXL_GIC_VERSION_DEFAULT, vuart =
> LIBXL_VUART_TYPE_UNKNOWN}, altp2m = LIBXL_ALTP2M_MODE_DISABLED}
> 
> (gdb) p ctx
> $5 = (libxl_ctx *) 0x0

A NULL pointer? See xl.c:xl_ctx_alloc.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.