[Crash-utility] [PATCH] Debugging xen hypervisor failed

Dave Anderson anderson at redhat.com
Wed Dec 11 19:28:49 UTC 2019



----- Original Message -----
> Hi Dave,
> 
> debugging newer xen hypervisors failed with:
> 
> crash: cannot resolve "init_tss"
> 
> This is caused by a change in the xen hypervisor with commit 78884406256,
> from 4.12.0-rc5-763-g7888440625. In this patch the struct tss_struct was
> renamed to tss64 and the structure tss_page was introduced which contains a
> single tss64.
> Now tss information are accessible via symbol "per_cpu__tss_page"
> 
> The code is as follows:
> 
> struct __packed tss64 {
>     uint32_t :32;
>     uint64_t rsp0, rsp1, rsp2;
>     uint64_t :64;
>     /*
>      * Interrupt Stack Table is 1-based so tss->ist[0] corresponds to an IST
>      * value of 1 in an Interrupt Descriptor.
>      */
>     uint64_t ist[7];
>     uint64_t :64;
>     uint16_t :16, bitmap;
> };
> struct tss_page {
>     struct tss64 __aligned(PAGE_SIZE) tss;
> };
> DECLARE_PER_CPU(struct tss_page, tss_page);
> 
> To keep the change simple and small I renamed xen_hyper_size_table.tss_struct
> to xen_hyper_size_table.tss and consequently I did the same for
> tss_struct_rsp0, tss_struct_esp0 and tss_struct_ist.
> But I'm not sure this is the way to go.
> Thanks.
> 
> Dietmar.

Hi Dietmar,

The patch looks good to me, and doesn't break backwards compatibility
with my old sample hypervisor dumps -- but the tss name changes breaks
the 32-bit x86 build:

$ make warn
TARGET: X86
 CRASH: 7.2.8rc22
   GDB: 7.6

... [ cut ] ...

cc -c -g -DX86 -m32 -D_FILE_OFFSET_BITS=64 -DLZO -DSNAPPY -DGDB_7_6  x86.c -DMCLX
In file included from x86.c:54:0:
x86.c: In function ‘x86_get_stackbase_hyper’:
xen_hyper_defs.h:766:61: error: ‘struct xen_hyper_size_table’ has no member named ‘tss_struct’
 #define XEN_HYPER_SIZE(X)  (SIZE_verify(xen_hyper_size_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X))
                                                             ^
x86.c:5603:15: note: in expansion of macro ‘XEN_HYPER_SIZE’
   init_tss += XEN_HYPER_SIZE(tss_struct) * pcpu;
               ^
In file included from x86.c:53:0:
xen_hyper_defs.h:766:61: error: ‘struct xen_hyper_size_table’ has no member named ‘tss_struct’
 #define XEN_HYPER_SIZE(X)  (SIZE_verify(xen_hyper_size_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X))
                                                             ^
defs.h:5070:35: note: in definition of macro ‘GETBUF’
 #define GETBUF(X)   getbuf((long)(X))
                                   ^
x86.c:5609:15: note: in expansion of macro ‘XEN_HYPER_SIZE’
  buf = GETBUF(XEN_HYPER_SIZE(tss_struct));
               ^
In file included from x86.c:54:0:
xen_hyper_defs.h:766:61: error: ‘struct xen_hyper_size_table’ has no member named ‘tss_struct’
 #define XEN_HYPER_SIZE(X)  (SIZE_verify(xen_hyper_size_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X))
                                                             ^
x86.c:5611:4: note: in expansion of macro ‘XEN_HYPER_SIZE’
    XEN_HYPER_SIZE(tss_struct), "init_tss", RETURN_ON_ERROR)) {
    ^
In file included from x86.c:53:0:
xen_hyper_defs.h:767:67: error: ‘struct xen_hyper_offset_table’ has no member named ‘tss_struct_esp0’
 #define XEN_HYPER_OFFSET(X)  (OFFSET_verify(xen_hyper_offset_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X))
                                                                   ^
defs.h:2376:46: note: in definition of macro ‘ULONG’
 #define ULONG(ADDR)     *((ulong *)((char *)(ADDR)))
                                              ^
x86.c:5614:20: note: in expansion of macro ‘XEN_HYPER_OFFSET’
  esp = ULONG(buf + XEN_HYPER_OFFSET(tss_struct_esp0));
                    ^
In file included from x86.c:54:0:
x86.c: In function ‘x86_init_hyper’:
xen_hyper_defs.h:774:55: error: ‘struct xen_hyper_size_table’ has no member named ‘tss_struct’
 #define XEN_HYPER_ASSIGN_SIZE(X) (xen_hyper_size_table.X)
                                                       ^
xen_hyper_defs.h:777:43: note: in expansion of macro ‘XEN_HYPER_ASSIGN_SIZE’
 #define XEN_HYPER_STRUCT_SIZE_INIT(X, Y) (XEN_HYPER_ASSIGN_SIZE(X) = STRUCT_SIZE(Y))
                                           ^
x86.c:5748:3: note: in expansion of macro ‘XEN_HYPER_STRUCT_SIZE_INIT’
   XEN_HYPER_STRUCT_SIZE_INIT(tss_struct, "tss_struct");
   ^
xen_hyper_defs.h:775:59: error: ‘struct xen_hyper_offset_table’ has no member named ‘tss_struct_esp0’
 #define XEN_HYPER_ASSIGN_OFFSET(X) (xen_hyper_offset_table.X)
                                                           ^
xen_hyper_defs.h:779:48: note: in expansion of macro ‘XEN_HYPER_ASSIGN_OFFSET’
 #define XEN_HYPER_MEMBER_OFFSET_INIT(X, Y, Z) (XEN_HYPER_ASSIGN_OFFSET(X) = MEMBER_OFFSET(Y, Z))
                                                ^
x86.c:5749:3: note: in expansion of macro ‘XEN_HYPER_MEMBER_OFFSET_INIT’
   XEN_HYPER_MEMBER_OFFSET_INIT(tss_struct_esp0, "tss_struct", "esp0");
   ^
make[4]: *** [x86.o] Error 1
make[3]: *** [gdb] Error 2
make[2]: *** [rebuild] Error 2
make[1]: *** [gdb_merge] Error 2
make: *** [warn] Error 2

$

If you don't have a 32-bit x86 machine, or don't have the proper 
libraries to build a 32-bit crash binary on an x86_64 host with
"make target=X86", just re-post the patch with your best effort 
and I'll build-test it.

Thanks,
  Dave








More information about the Crash-utility mailing list