Library: libSM The docs for the RegisterClient callback says: Call free on the previous_id pointer when it is no longer needed. However, if the callback returns zero, SmsProcessMessage() still tries to access previousId even though the callback should have freed it. Problem shown up by some valgrinding on gnome-session by Kjatan Maraas. Attaching what I think looks like a reasonable patch.
Created attachment 962 [details] [review] patch against lib/SM/sm_process.c
Who can review the patch ?
This is still causing reports of invalid reads in gnome-session, could someone take a look at this patch in the not too distant future?
this looks good to me. i'll commit in a day or so if no one complains.
applied to head, closing. thanks!
Reopening since I'm still seeing this in gnome-session: ==4915== Invalid read of size 1 ==4915== at 0x1BA1F847: _SmsProcessMessage (in /usr/X11R6/lib/libSM.so.6.0) ==4915== by 0x1BA2BC7F: IceProcessMessages (in /usr/X11R6/lib/libICE.so.6.3) ==4915== by 0x1B9611B5: process_ice_messages (gnome-ice.c:57) ==4915== by 0x1C67495A: g_io_unix_dispatch (giounix.c:162) ==4915== by 0x1C64E7A1: g_main_context_dispatch (gmain.c:1934) ==4915== by 0x1C651575: g_main_context_iterate (gmain.c:2565) ==4915== by 0x1C651A76: g_main_loop_run (gmain.c:2769) ==4915== by 0x1BB97834: gtk_main (gtkmain.c:976) ==4915== by 0x805412C: main (main.c:464) ==4915== Address 0x1CED3FF8 is 0 bytes inside a block of size 9 free'd ==4915== at 0x1B90237F: free (vg_replace_malloc.c:235) ==4915== by 0x8051DDD: register_client (manager.c:889) ==4915== by 0x1BA1F82C: _SmsProcessMessage (in /usr/X11R6/lib/libSM.so.6.0) ==4915== by 0x1BA2BC7F: IceProcessMessages (in /usr/X11R6/lib/libICE.so.6.3) ==4915== by 0x1B9611B5: process_ice_messages (gnome-ice.c:57) ==4915== by 0x1C67495A: g_io_unix_dispatch (giounix.c:162) ==4915== by 0x1C64E7A1: g_main_context_dispatch (gmain.c:1934) ==4915== by 0x1C651575: g_main_context_iterate (gmain.c:2565) ==4915== by 0x1C651A76: g_main_loop_run (gmain.c:2769) ==4915== by 0x1BB97834: gtk_main (gtkmain.c:976) ==4915== by 0x805412C: main (main.c:464)
Btw, this is current Fedora rawhide with gnome 2.12 built from CVS
Kjartan: no-one said anything about this being fixed in rawhide. The fix went into CVS after 6.8.2
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.