Zentific / vmidbg

PoC LibVMI-based GDB server for virtual machines
Other
53 stars 16 forks source link

version of libvmi to compile #2

Closed Wenzel closed 6 years ago

Wenzel commented 7 years ago

Hi,

I would like to compile your project, but you didn't specify which version of libvmi is needed for this.

The latest version is not compatible. I tried to use the tag v0.12, and the configure step is passing. however i cannot compile due to undefined structures:

make[2]: Entering directory '/home/wenzel/ownCloud/Projets/vmidbg/src'
gcc -DHAVE_CONFIG_H -I. -I..     -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -ggdb -g -O0  -MT vmidbg.o -MD -MP -MF .deps/vmidbg.Tpo -c -o vmidbg.o vmidbg.c
In file included from vmidbg.c:18:0:
vmidbg.h:49:5: error: unknown type name ‘vmi_event_t’
     vmi_event_t *int3_event;
     ^~~~~~~~~~~
vmidbg.h:86:5: error: unknown type name ‘vmi_event_t’
     vmi_event_t *event;
     ^~~~~~~~~~~
vmidbg.c:377:42: error: unknown type name ‘vmi_event_t’; did you mean ‘sigevent_t’?
 void gdb_step_notify(vmi_instance_t vmi, vmi_event_t *event){
                                          ^~~~~~~~~~~
                                          sigevent_t
vmidbg.c:412:40: error: unknown type name ‘vmi_event_t’; did you mean ‘sigevent_t’?
 void gdb_bp_notify(vmi_instance_t vmi, vmi_event_t *event){
                                        ^~~~~~~~~~~
                                        sigevent_t
vmidbg.c: In function ‘vmi_regs_to_gdb’:
vmidbg.c:486:2: warning: #warning libvmi needs 32bit registers defined [-Wcpp]
 #warning libvmi needs 32bit registers defined
  ^~~~~~~
vmidbg.c: In function ‘gdb_rsp_singlestep’:
vmidbg.c:1089:5: error: unknown type name ‘vmi_event_t’; did you mean ‘sigevent_t’?
     vmi_event_t *event = calloc(1, sizeof(vmi_event_t));
     ^~~~~~~~~~~
     sigevent_t
vmidbg.c:1089:43: error: ‘vmi_event_t’ undeclared (first use in this function); did you mean ‘sigevent_t’?
     vmi_event_t *event = calloc(1, sizeof(vmi_event_t));
                                           ^~~~~~~~~~~
                                           sigevent_t
vmidbg.c:1089:43: note: each undeclared identifier is reported only once for each function it appears in
vmidbg.c:1090:10: error: request for member ‘type’ in something not a structure or union
     event->type = VMI_EVENT_SINGLESTEP;
          ^~
vmidbg.c:1090:19: error: ‘VMI_EVENT_SINGLESTEP’ undeclared (first use in this function); did you mean ‘VMI_INIT_COMPLETE’?
     event->type = VMI_EVENT_SINGLESTEP;
                   ^~~~~~~~~~~~~~~~~~~~
                   VMI_INIT_COMPLETE
vmidbg.c:1091:10: error: request for member ‘vcpu_id’ in something not a structure or union
     event->vcpu_id = 0;
          ^~
vmidbg.c:1092:10: error: request for member ‘data’ in something not a structure or union
     event->data = ctx;
          ^~
vmidbg.c:1094:5: warning: implicit declaration of function ‘vmi_step_event’; did you mean ‘vmi_get_vmid’? [-Wimplicit-function-declaration]
     vmi_step_event(ctx->vmi, event, event->vcpu_id, 1, gdb_step_notify);
     ^~~~~~~~~~~~~~
     vmi_get_vmid
vmidbg.c:1094:42: error: request for member ‘vcpu_id’ in something not a structure or union
     vmi_step_event(ctx->vmi, event, event->vcpu_id, 1, gdb_step_notify);
                                          ^~
vmidbg.c:1094:56: error: ‘gdb_step_notify’ undeclared (first use in this function); did you mean ‘gdb_rsp_continue’?
     vmi_step_event(ctx->vmi, event, event->vcpu_id, 1, gdb_step_notify);
                                                        ^~~~~~~~~~~~~~~
                                                        gdb_rsp_continue
vmidbg.c: In function ‘handle_gdb’:
vmidbg.c:1440:22: warning: implicit declaration of function ‘vmi_events_listen’; did you mean ‘vmi_get_winver’? [-Wimplicit-function-declaration]
         status_t s = vmi_events_listen(ctx->vmi,100);
                      ^~~~~~~~~~~~~~~~~
                      vmi_get_winver
vmidbg.c: In function ‘main’:
vmidbg.c:1621:5: error: unknown type name ‘vmi_event_t’; did you mean ‘sigevent_t’?
     vmi_event_t *int3_event = calloc(1, sizeof(vmi_event_t));
     ^~~~~~~~~~~
     sigevent_t
vmidbg.c:1621:48: error: ‘vmi_event_t’ undeclared (first use in this function); did you mean ‘sigevent_t’?
     vmi_event_t *int3_event = calloc(1, sizeof(vmi_event_t));
                                                ^~~~~~~~~~~
                                                sigevent_t
vmidbg.c:1622:15: error: request for member ‘type’ in something not a structure or union
     int3_event->type = VMI_EVENT_INTERRUPT;
               ^~
vmidbg.c:1622:24: error: ‘VMI_EVENT_INTERRUPT’ undeclared (first use in this function); did you mean ‘SA_INTERRUPT’?
     int3_event->type = VMI_EVENT_INTERRUPT;
                        ^~~~~~~~~~~~~~~~~~~
                        SA_INTERRUPT
vmidbg.c:1623:15: error: request for member ‘interrupt_event’ in something not a structure or union
     int3_event->interrupt_event.reinject = 0;
               ^~
vmidbg.c:1624:15: error: request for member ‘interrupt_event’ in something not a structure or union
     int3_event->interrupt_event.intr = INT3;
               ^~
vmidbg.c:1624:40: error: ‘INT3’ undeclared (first use in this function); did you mean ‘EINTR’?
     int3_event->interrupt_event.intr = INT3;
                                        ^~~~
                                        EINTR
vmidbg.c:1625:15: error: request for member ‘callback’ in something not a structure or union
     int3_event->callback = gdb_bp_notify;
               ^~
vmidbg.c:1625:28: error: ‘gdb_bp_notify’ undeclared (first use in this function); did you mean ‘gdb_rsp_continue’?
     int3_event->callback = gdb_bp_notify;
                            ^~~~~~~~~~~~~
                            gdb_rsp_continue
vmidbg.c:1626:15: error: request for member ‘data’ in something not a structure or union
     int3_event->data = ctx;
               ^~
vmidbg.c:1630:5: warning: implicit declaration of function ‘vmi_register_event’; did you mean ‘vmi_read_str_va’? [-Wimplicit-function-declaration]
     vmi_register_event(vmi, int3_event);
     ^~~~~~~~~~~~~~~~~~
     vmi_read_str_va

Thanks !

smaresca commented 7 years ago

@Wenzel Oh yes, this definitely needs an update - it's from 2014 and quite stale. I have an internal version that is much more up to date, including configure.ac checks etc.

Will tag you in the PR

Wenzel commented 6 years ago

Hi @smaresca ,

any update on this new version of vmidbg ?

thanks !

smaresca commented 6 years ago

@Wenzel see #3 , just merged into master

tawan58 commented 6 years ago

Hi @Wenzel , @smaresca

Help me pls. I merged VMIdbg and libVMI but I can't compile it

Wenzel commented 6 years ago

1 open an issue 2 if you don't post what's wrong, we can't help you :)

tawan58 commented 6 years ago

@Wenzel @smaresca This my error when I try install vmidbg

server@server:~/Downloads/vmidbg-master$ sudo su [sudo] password for server: root@server:/home/server/Downloads/vmidbg-master# ./autogen.sh libtoolize: putting auxiliary files in '.'. libtoolize: copying file './ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'. libtoolize: copying file 'm4/libtool.m4' libtoolize: copying file 'm4/ltoptions.m4' libtoolize: copying file 'm4/ltsugar.m4' libtoolize: copying file 'm4/ltversion.m4' libtoolize: copying file 'm4/lt~obsolete.m4' libtoolize: Remember to add 'LT_INIT' to configure.ac. configure.ac:11: installing './compile' configure.ac:3: installing './missing' src/Makefile.am: installing './depcomp' root@server:/home/server/Downloads/vmidbg-master# make cd . && /bin/bash ./config.status Makefile config.status: creating Makefile make all-recursive make[1]: Entering directory '/home/server/Downloads/vmidbg-master' Making all in src make[2]: Entering directory '/home/server/Downloads/vmidbg-master/src' cd .. && /bin/bash ./config.status src/Makefile depfiles config.status: creating src/Makefile config.status: executing depfiles commands gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -ggdb -g -O0 -MT vmidbg.o -MD -MP -MF .deps/vmidbg.Tpo -c -o vmidbg.o vmidbg.c vmidbg.c: In function ‘get_executing_task’: vmidbg.c:95:9: error: too many arguments to function ‘vmi_translate_ksym2v’ vmi_translate_ksym2v(vmi, "per_cpu__current_task", &per_cpu_current_tas ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:804:8: note: declared here addr_t vmi_translate_ksym2v( ^ vmidbg.c:99:9: error: too many arguments to function ‘vmi_translate_ksym2v’ vmi_translate_ksym2v(vmi, "current_task", &per_cpu_current_task_offset) ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:804:8: note: declared here addr_t vmi_translate_ksym2v( ^ vmidbg.c: In function ‘gdb_step_notify’: vmidbg.c:399:9: warning: ‘return’ with no value, in function returning non-void return; ^ vmidbg.c:405:9: warning: ‘return’ with no value, in function returning non-void return; ^ vmidbg.c: In function ‘gdb_bp_notify’: vmidbg.c:435:9: warning: ‘return’ with no value, in function returning non-void return; ^ vmidbg.c:441:9: warning: ‘return’ with no value, in function returning non-void return; ^ vmidbg.c:460:9: warning: ‘return’ with no value, in function returning non-void return; ^ vmidbg.c: In function ‘vmi_regs_to_gdb’: vmidbg.c:505:2: warning: #warning libvmi needs 32bit registers defined [-Wcpp]

warning libvmi needs 32bit registers defined

^ vmidbg.c: In function ‘gdb_rsp_interrupt_sequence’: vmidbg.c:608:9: error: too many arguments to function ‘vmi_get_offset’ vmi_get_offset(ctx->vmi, "linux_pid", &pid_offset); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:1881:10: note: declared here uint64_t vmi_get_offset( ^ vmidbg.c:609:9: error: too many arguments to function ‘vmi_get_offset’ vmi_get_offset(ctx->vmi, "linux_tasks", &tasks_offset); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:1881:10: note: declared here uint64_t vmi_get_offset( ^ vmidbg.c:611:9: error: too many arguments to function ‘vmi_translate_ksym2v’ vmi_translate_ksym2v(ctx->vmi, "init_task", &list_head); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:804:8: note: declared here addr_t vmi_translate_ksym2v( ^ vmidbg.c: In function ‘gdb_rsp_read_mem’: vmidbg.c:732:40: warning: passing argument 4 of ‘vmi_read_va’ makes pointer from integer without a cast [-Wint-conversion] vmi_read_va(ctx->vmi, mem_addr, 0, mem_size, vmibuf, &bytes_read); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:1038:8: note: expected ‘void ’ but argument is of type ‘size_t {aka long unsigned int}’ size_t vmi_read_va( ^ vmidbg.c:732:50: warning: passing argument 5 of ‘vmi_read_va’ makes integer from pointer without a cast [-Wint-conversion] vmi_read_va(ctx->vmi, mem_addr, 0, mem_size, vmibuf, &bytes_read); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:1038:8: note: expected ‘size_t {aka long unsigned int}’ but argument is of type ‘uint8_t {aka unsigned char }’ size_t vmi_read_va( ^ vmidbg.c:732:5: error: too many arguments to function ‘vmi_read_va’ vmi_read_va(ctx->vmi, mem_addr, 0, mem_size, vmibuf, &bytes_read); ^ In file included from vmidbg.c:17:0: /usr/local/include/libvmi/libvmi.h:1038:8: note: declared here size_t vmi_read_va( ^ Makefile:351: recipe for target 'vmidbg.o' failed make[2]: [vmidbg.o] Error 1 make[2]: Leaving directory '/home/server/Downloads/vmidbg-master/src' Makefile:362: recipe for target 'all-recursive' failed make[1]: [all-recursive] Error 1 make[1]: Leaving directory '/home/server/Downloads/vmidbg-master' Makefile:303: recipe for target 'all' failed make: [all] Error 2 root@server:/home/server/Downloads/vmidbg-master#

Wenzel commented 6 years ago

--> open an issue --> format your post