hi,

I have this little standalone testprogram (compile and run instructions
in comment at the top, no fancy dependencies):
http://buzztard.svn.sourceforge.net/viewvc/buzztard/trunk/buzztard/design/udev/udevls.c?revision=3231&view=markup

It behaves differently when run under valgrind:

$ G_SLICE=always-malloc G_DEBUG=gc-friendly GLIBCPP_FORCE_NEW=1
GLIBCXX_FORCE_NEW=1 valgrind --tool=memcheck --leak-check=full
--leak-resolution=high --trace-children=yes --num-callers=20
--log-file=./valgrind.log ./udevls
  | 0x43634b0,/dev/input/event2 | 0x43634b0,/dev/input/event2
  | 0x4363f88,/dev/input/event4 | 0x4363f88,/dev/input/event4
 <snip>
  | 0x436c7c0,/dev/input/event9 | 0x436c7c0,/dev/input/event9
  | 0x436d0a8,/dev/input/mouse2 | 0x436d0a8,/dev/input/mouse2
  | 0x436d9c0,/dev/input/event8 | 0x436d9c0,/dev/input/event8
! | 0x436e388,/dev/input/mice | 0x436e520,/dev/input/mice

What matters is the last line. When *not* run under valgrind the
addresses are the same. When run under valgrind I get a couple of
==1989== Invalid read of size 1
==1989==    at 0x41C9B33: vfprintf (vfprintf.c:1614)
==1989==    by 0x41D0ACF: printf (printf.c:35)
==1989==    by 0x8048785: main (udevcls.c:57)
==1989==  Address 0x4358b58 is 0 bytes inside a block of size 16 free'd
==1989==    at 0x40267ED: free (vg_replace_malloc.c:366)
==1989==    by 0x42EA335: ??? (in /lib/libudev.so.0.9.1)
==1989==    by 0x42EB38E: ??? (in /lib/libudev.so.0.9.1)
==1989==    by 0x42EB7A0: udev_device_get_devnode (in /lib/libudev.so.0.9.1)
==1989==    by 0x404A965: g_udev_device_get_device_file (in
/usr/lib/libgudev-1.0.so.0.0.1)
==1989==    by 0x804873A: main (udevcls.c:56)

full log: http://pastebin.com/4eBCtdxW

The udev-source code can be looked at
http://git.kernel.org/?p=linux/hotplug/udev.git;a=tree

I get this behaviour on various distributions and several people
confirmed. I now wonder if there is a bug in udev or something is wrong
in valgrind? Any idea from the valgrind perspective?

thanks,
Stefan

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to