valgrind support for Xen privcmd ioctls / hypercalls
Hi , lan :
1. Yes , In my first email i fix some errors to let your patch match
valgrind-3.6.1 . My patch is nearly the same as yours. only some line numbers is different . And my patch is xen_patch.patch.
2. after patch it . this time i use autoconf/automake inside valgrind-3.6.1
and run "./configure --with-xen=/usr/include/xen/"
and the output is file : output_message.txt
3, Now I run make , it has the error messages, and is in the file error_message.txt in the attach .
4, I am now doing a research about the memory leak of hypervisor of xen in
my college with my teacher . and i wonder if you have the valgrind tool
support for xen hypervisor ? and if you have the valgrind tool support for
hypervisor well , can you give me one ? I need the tool to finish my job
however i can't handle it well .....sigh...
5, another question is : if i have the valgrind tool support for hypervisor
, how to use the memcheck tool to detect the memory leak of xen hypervisor ?
i know how to use the tool to detect normal binary file but i don't know how
to detect xen hypervisor .
for example , there is a normal c file name test.c . first use "gcc -g -o
test test.c" to produce binary file test . then use "valgrind
--tool=memcheck --leak-check=yes ./test" to detect the memory leak of "test"
.
however , how to use the memcheck tool to do my job ?
1) first compile the xen_4.1.1 src files ? -----------------------> will produce a binary file , say it /usr/src/xen-4.0.0/xen/xen
2) second how to use your valgrind tool? ---------------------> run valgrind --tool=memcheck --leak-check=full ./xen ? is this right ?
Thank you !
View this message in context: http://xen.1045712.n5.nabble.com/PATCHv2-valgrind-support-for-Xen-privcmd-ioctls-hypercalls-tp2640861p4568310.html
Sent from the Xen - Dev mailing list archive at Nabble.com.
configure.in +5 -0
@@ -1608,6 +1608,11 @@ elif test x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_AIX5 ; then mflag_secondary=-q32 fi +AC_ARG_WITH(xen, + [ --with-xen= Specify location of Xen headers], + XEN_CFLAGS=-I$withval +) +AC_SUBST(XEN_CFLAGS) AC_ARG_WITH(mpicc, [ --with-mpicc= Specify name of MPI2-ised C compiler],
coregrind/Makefile.am +3 -1
@@ -211,6 +211,7 @@ m_syswrap/priv_syswrap-aix5.h \ m_syswrap/priv_syswrap-darwin.h \ m_syswrap/priv_syswrap-main.h \ + m_syswrap/priv_syswrap-xen.h \ m_ume/priv_ume.h #----------------------------------------------------------------------------
@@ -338,6 +339,7 @@ m_syswrap/syswrap-ppc64-aix5.c \ m_syswrap/syswrap-x86-darwin.c \ m_syswrap/syswrap-amd64-darwin.c \ + m_syswrap/syswrap-xen.c \ m_ume/elf.c \ m_ume/macho.c \ m_ume/main.c \
@@ -350,7 +352,7 @@ libcoregrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CPPFLAGS = \ $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) libcoregrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CFLAGS = \ - $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) + $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) @XEN_CFLAGS@ libcoregrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CCASFLAGS = \ $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) if VGCONF_HAVE_PLATFORM_SEC
coregrind/m_debuginfo/debuginfo.c +5 -0
@@ -637,6 +637,11 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV )if (!filename)return 0 ; +if (strncmp (filename,"/proc/xen/" ,10 ) ==0 ) { +//VG_(printf)("ignoring mmap of %s\n", filename); +return 0 ; + } +if (debug)VG_ (printf)("di_notify_mmap-2: %s\n" , filename);
coregrind/m_syswrap/priv_syswrap-xen.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __PRIV_SYSWRAP_XEN_H +#define __PRIV_SYSWRAP_XEN_H + +DECL_TEMPLATE (xen, ioctl_privcmd_hypercall); +DECL_TEMPLATE (xen, ioctl_privcmd_mmap); +DECL_TEMPLATE (xen, ioctl_privcmd_mmapbatch); +DECL_TEMPLATE (xen, ioctl_privcmd_mmapbatch_v2); + +#endif // __PRIV_SYSWRAP_XEN_H + +/*--------------------------------------------------------------------*/ +/*--- end ---*/ +/*--------------------------------------------------------------------*/
coregrind/m_syswrap/syswrap-linux.c +28 -1
@@ -57,7 +57,7 @@#include "priv_types_n_macros.h" #include "priv_syswrap-generic.h" #include "priv_syswrap-linux.h" - +#include "priv_syswrap-xen.h" // Run a thread from beginning to end and return the thread's // scheduler-return-code.
@@ -4864,6 +4864,20 @@ PRE(sys_ioctl) }break ; + +case VKI_XEN_IOCTL_PRIVCMD_HYPERCALL : +WRAPPER_PRE_NAME (xen, ioctl_privcmd_hypercall)(tid, layout, arrghs, status, flags); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAP : +WRAPPER_PRE_NAME (xen, ioctl_privcmd_mmap)(tid, layout, arrghs, status, flags); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH : +WRAPPER_PRE_NAME (xen, ioctl_privcmd_mmapbatch)(tid, layout, arrghs, status, flags); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 : +WRAPPER_PRE_NAME (xen, ioctl_privcmd_mmapbatch_v2)(tid, layout, arrghs, status, flags); +break ; +default :/* EVIOC* are variable length and return size written on success */ switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
@@ -5676,6 +5676,19 @@ POST(sys_ioctl) }break ; +case VKI_XEN_IOCTL_PRIVCMD_HYPERCALL : +WRAPPER_POST_NAME (xen, ioctl_privcmd_hypercall)(tid, arrghs, status); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAP : +WRAPPER_POST_NAME (xen, ioctl_privcmd_mmap)(tid, arrghs, status); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH : +WRAPPER_POST_NAME (xen, ioctl_privcmd_mmapbatch)(tid, arrghs, status); +break ; +case VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 : +WRAPPER_POST_NAME (xen, ioctl_privcmd_mmapbatch_v2)(tid, arrghs, status); +break ; +default :/* EVIOC* are variable length and return size written on success */ switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
coregrind/m_syswrap/syswrap-xen.c new file +751 -0
751 lines not on this page · raw message
include/Makefile.am +2 -1
@@ -54,7 +54,8 @@ vki/vki-scnums-ppc32-linux.h \ vki/vki-scnums-ppc64-linux.h \ vki/vki-scnums-x86-linux.h \ vki/vki-scnums-arm-linux.h \ - vki/vki-scnums-darwin.h + vki/vki-scnums-darwin.h + vki/vki-xen.h noinst_HEADERS = \ vki/vki-ppc32-aix5.h \
include/pub_tool_vki.h +1 -0
@@ -47,6 +47,7 @@#if defined(VGO_linux)# include "vki/vki-linux.h" +# include "vki/vki-xen.h" #elif defined(VGP_ppc32_aix5)# include "vki/vki-ppc32-aix5.h" #elif defined(VGP_ppc64_aix5)
include/vki/vki-linux.h +45 -0
51 lines not on this page · raw message
include/vki/vki-xen.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef __VKI_XEN_H +#define __VKI_XEN_H + +#endif // __VKI_XEN_H + +/*--------------------------------------------------------------------*/ +/*--- end ---*/ +/*--------------------------------------------------------------------*/
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes checking how to run the C preprocessor... gcc -E
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for a sed that does not truncate output... /bin/sed checking for ar... /usr/bin/ar
checking for perl... /usr/bin/perl
checking for gdb... /usr/bin/gdb
checking dependency style of gcc... gcc3
checking for diff -u... yes
checking for a supported version of gcc... ok (4.1.2)
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a supported CPU... ok (i686)
checking for a 64-bit only build... no
checking for a 32-bit only build... no
checking for a supported OS... ok (linux-gnu)
checking for the kernel version... 2.6 family (2.6.18.8-xen) checking for a supported CPU/OS combination... ok (x86-linux) checking for use as an inner Valgrind... no
checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking features.h usability... yes
checking features.h presence... yes
checking for features.h... yes
checking the GLIBC_VERSION version... 2.7 family
checking for CLOCK_MONOTONIC... yes
checking for PTHREAD_MUTEX_ADAPTIVE_NP... yes
checking for PTHREAD_MUTEX_ERRORCHECK_NP... yes
checking for PTHREAD_MUTEX_RECURSIVE_NP... yes
checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP... yes checking for pthread_mutex_t.__m_kind... no
checking for pthread_mutex_t.__data.__kind... yes
checking for Altivec... no
checking for [email protected]()... yes
checking for eventfd()... no
checking if gcc accepts -m32... yes
checking if gcc accepts -maix32... no
checking if gcc accepts -m64... no
checking if gcc accepts -maix64... no
checking if gcc accepts -mmmx... yes
checking if gcc accepts -msse... yes
checking if gcc accepts -mpreferred-stack-boundary... yes checking if gcc accepts -Wno-pointer-sign... yes
checking if gcc accepts -Wno-empty-body... no
checking if gcc accepts -Wno-format-zero-length... yes
checking if gcc accepts -Wno-uninitialized... yes
checking if gcc accepts -Wextra or -W... -Wextra
checking if gcc accepts -fno-stack-protector... yes
checking if gcc accepts --param inline-unit-growth... yes checking if the linker accepts -Wl,--build-id=none... yes checking if ppc32/64 as supports mtocrf/mfocrf... no
checking if x86/amd64 assembler speaks SSE3... yes
checking if x86/amd64 assembler speaks SSSE3... no
checking if x86/amd64 assembler supports 'pclmulqdq'... no checking if x86/amd64 assembler supports 'lzcnt'... no
checking for TLS support... yes
checking for ANSI C header files... (cached) yes
checking asm/unistd.h usability... yes
checking asm/unistd.h presence... yes
checking for asm/unistd.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking mqueue.h usability... yes
checking mqueue.h presence... yes
checking for mqueue.h... yes
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/eventfd.h usability... no
checking sys/eventfd.h presence... no
checking for sys/eventfd.h... no
checking sys/klog.h usability... yes
checking sys/klog.h presence... yes
checking for sys/klog.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/signal.h usability... yes
checking sys/signal.h presence... yes
checking for sys/signal.h... yes
checking sys/signalfd.h usability... no
checking sys/signalfd.h presence... no
checking for sys/signalfd.h... no
checking sys/syscall.h usability... yes
checking sys/syscall.h presence... yes
checking for sys/syscall.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking for uid_t in sys/types.h... yes
checking for off_t... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes checking for working memcmp... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking return type of signal handlers... void
checking for clock_gettime in -lrt... yes
checking for clock_gettime... yes
checking for epoll_create... yes
checking for epoll_pwait... yes
checking for floor... no
checking for klogctl... yes
checking for mallinfo... yes
checking for memchr... yes
checking for memset... yes
checking for mkdir... yes
checking for mremap... yes
checking for ppoll... yes
checking for pthread_barrier_init... yes
checking for pthread_condattr_setclock... yes
checking for pthread_mutex_timedlock... yes
checking for pthread_rwlock_timedrdlock... yes
checking for pthread_rwlock_timedwrlock... yes
checking for pthread_spin_lock... yes
checking for pthread_yield... yes
checking for readlinkat... yes
checking for semtimedop... yes
checking for signalfd... yes
checking for sigwaitinfo... yes
checking for strchr... yes
checking for strdup... yes
checking for strpbrk... yes
checking for strrchr... yes
checking for strstr... yes
checking for syscall... yes
checking for timerfd... no
checking for utimensat... yes
checking primary target for usable MPI2-compliant C compiler and mpi.h... no checking secondary target for usable MPI2-compliant C compiler and mpi.h... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for boost... yes
checking for OpenMP... yes
checking if gcc supports __sync_bool_compare_and_swap... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating VEX/Makefile
config.status: creating valgrind.spec
config.status: creating valgrind.pc
config.status: creating glibc-2.X.supp
config.status: creating docs/Makefile
config.status: creating tests/Makefile
config.status: creating tests/vg_regtest
config.status: creating perf/Makefile
config.status: creating perf/vg_perf
config.status: creating include/Makefile
config.status: creating auxprogs/Makefile
config.status: creating mpi/Makefile
config.status: creating coregrind/Makefile
config.status: creating memcheck/Makefile
config.status: creating memcheck/tests/Makefile
config.status: creating memcheck/tests/amd64/Makefile config.status: creating memcheck/tests/x86/Makefile config.status: creating memcheck/tests/linux/Makefile config.status: creating memcheck/tests/darwin/Makefile config.status: creating memcheck/tests/amd64-linux/Makefile config.status: creating memcheck/tests/x86-linux/Makefile config.status: creating memcheck/tests/ppc32/Makefile config.status: creating memcheck/tests/ppc64/Makefile config.status: creating memcheck/perf/Makefile
config.status: creating cachegrind/Makefile
config.status: creating cachegrind/tests/Makefile
config.status: creating cachegrind/tests/x86/Makefile config.status: creating cachegrind/cg_annotate
config.status: creating cachegrind/cg_diff
config.status: creating callgrind/Makefile
config.status: creating callgrind/callgrind_annotate config.status: creating callgrind/callgrind_control config.status: creating callgrind/tests/Makefile
config.status: creating helgrind/Makefile
config.status: creating helgrind/tests/Makefile
config.status: creating massif/Makefile
config.status: creating massif/tests/Makefile
config.status: creating massif/perf/Makefile
config.status: creating massif/ms_print
config.status: creating lackey/Makefile
config.status: creating lackey/tests/Makefile
config.status: creating none/Makefile
config.status: creating none/tests/Makefile
config.status: creating none/tests/amd64/Makefile
config.status: creating none/tests/ppc32/Makefile
config.status: creating none/tests/ppc64/Makefile
config.status: creating none/tests/x86/Makefile
config.status: creating none/tests/arm/Makefile
config.status: creating none/tests/linux/Makefile
config.status: creating none/tests/darwin/Makefile config.status: creating none/tests/x86-linux/Makefile config.status: creating exp-ptrcheck/Makefile
config.status: creating exp-ptrcheck/tests/Makefile config.status: creating drd/Makefile
config.status: creating drd/scripts/download-and-build-splash2 config.status: creating drd/tests/Makefile
config.status: creating exp-bbv/Makefile
config.status: creating exp-bbv/tests/Makefile
config.status: creating exp-bbv/tests/x86/Makefile config.status: creating exp-bbv/tests/x86-linux/Makefile config.status: creating exp-bbv/tests/amd64-linux/Makefile config.status: creating exp-bbv/tests/ppc32-linux/Makefile config.status: creating exp-bbv/tests/arm-linux/Makefile config.status: creating exp-dhat/Makefile
config.status: creating exp-dhat/tests/Makefile
config.status: creating coregrind/link_tool_exe_linux config.status: creating coregrind/link_tool_exe_darwin config.status: creating coregrind/link_tool_exe_aix5 config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Maximum build arch: x86
Primary build arch: x86
Secondary build arch:
Build OS: linux
Primary build target: X86_LINUX
Secondary build target:
Default supp files: exp-ptrcheck.supp xfree-3.supp xfree-4.supp
glibc-2.X-drd.supp glibc-2.34567-NPTL-helgrind.supp glibc-2.X.supp
echo "# This is a generated file, composed of the following suppression
rules:" > default.supp
echo "# " exp-ptrcheck.supp xfree-3.supp xfree-4.supp glibc-2.X-drd.supp glibc-2.34567-NPTL-helgrind.supp glibc-2.X.supp >> default.supp cat exp-ptrcheck.supp xfree-3.supp xfree-4.supp glibc-2.X-drd.supp glibc-2.34567-NPTL-helgrind.supp glibc-2.X.supp >> default.supp make all-recursive
make[1]: Entering directory `/home/popo/valgrind-3.6.1'
Making all in include
make[2]: Entering directory /home/popo/valgrind-3.6.1/include' make[2]: Nothing to be done for all'.
make[2]: Leaving directory `/home/popo/valgrind-3.6.1/include' Making all in VEX
make[2]: Entering directory `/home/popo/valgrind-3.6.1/VEX'
make all-am
make[3]: Entering directory /home/popo/valgrind-3.6.1/VEX' make[3]: Nothing to be done for all-am'.
make[3]: Leaving directory /home/popo/valgrind-3.6.1/VEX' make[2]: Leaving directory /home/popo/valgrind-3.6.1/VEX' Making all in coregrind
make[2]: Entering directory `/home/popo/valgrind-3.6.1/coregrind' make all-am
make[3]: Entering directory `/home/popo/valgrind-3.6.1/coregrind' gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"x86-linux\"" -m32 -mpreferred-stack-boundary=2 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing @XEN_CFLAGS@ -Wno-long-long -Wno-pointer-sign -fno-stack-protector -MT libcoregrind_x86_linux_a-m_debuglog.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-m_debuglog.Tpo -c -o libcoregrind_x86_linux_a-m_debuglog.o test -f 'm_debuglog.c' || echo './'m_debuglog.c
gcc: @XEN_CFLAGS@:doesn't exist the file or directory
make[3]: *** [libcoregrind_x86_linux_a-m_debuglog.o] error 1 make[3]: Leaving directory `/home/popo/valgrind-3.6.1/coregrind' make[2]: *** [all] error 2
make[2]: Leaving directory `/home/popo/valgrind-3.6.1/coregrind' make[1]: *** [all-recursive] error 1
make[1]: Leaving directory `/home/popo/valgrind-3.6.1'
make: *** [all] error 2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel