Bug 31935

Summary: dbus compilation issue on solaris. segfaulting after applying a patch for successful compilation.
Product: dbus Reporter: Praneeth Venkata <nvpraneeth>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED WORKSFORME QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: medium CC: msniko14, nvpraneeth
Version: 1.5Keywords: NEEDINFO
Hardware: All   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:
Attachments: complete dbus segfault backtrace

Description Praneeth Venkata 2010-11-26 05:00:59 UTC
Created attachment 40584 [details]
complete dbus segfault backtrace 

dbus-1.4.0 fails to compile by default on Solaris with below shown errors. I observed that this was failing because some of the struct/union member's were available conditionally in sys/socket.h. I was able to get past these errors by patching dbus/dbus-sysdeps-unix.c with below shown patch.

This worked well and compilation was successful but after this I found issues with dbus while using it. one of my application's is segfaulting. I have posted backtrace of the core file which indicated an issue with dbus especially at _dbus_read_socket_with_unix_fds at line number 292 of dbus-sysdeps-unix.c   

compilation erros. 
<<< >>>

make[3]: Entering directory `/var/tmp/navulurubuilds/dbus-1.4.0/dbus'
  CC     libdbus_1_la-dbus-sysdeps-unix.lo
"dbus-sysdeps-unix.c", line 283: undefined struct/union member: msg_controllen
"dbus-sysdeps-unix.c", line 283: warning: implicit function declaration: CMSG_SPACE
"dbus-sysdeps-unix.c", line 287: undefined struct/union member: msg_control
"dbus-sysdeps-unix.c", line 287: warning: implicit function declaration: alloca
"dbus-sysdeps-unix.c", line 287: improper member use: msg_controllen
"dbus-sysdeps-unix.c", line 288: improper member use: msg_control
"dbus-sysdeps-unix.c", line 288: improper member use: msg_controllen
"dbus-sysdeps-unix.c", line 288: warning: improper pointer/integer combination: arg #1

<<< >>>


sys/socket.h

<<< >>>
#if defined(_XPG4_2) || defined(_KERNEL)
        void            *msg_control;           /* ancillary data */
        socklen_t       msg_controllen;         /* ancillary data buffer len */
        int             msg_flags;              /* flags on received message */
#else
        caddr_t         msg_accrights;  /* access rights sent/received */
        int             msg_accrightslen;
#endif  /* defined(_XPG4_2) || defined(_KERNEL) */
};

<<< >>> 


Patch applied to dbus/dbus-sysdeps-unix.c 

<< >>

+#ifdef __sun
+#define _XPG4_2
+#endif

<< >>

backtrace of core 

<< >> 

#0  0xfffffd7fff293b3b in .memsetbyte32sse2 () from /lib/64/libc.so.1
#1  0xfffffd7ff9827d20 in _dbus_read_socket_with_unix_fds (fd=<value optimized out>, buffer=<value optimized out>,
    count=<value optimized out>, fds=<value optimized out>, n_fds=<value optimized out>) at dbus-sysdeps-unix.c:292
#2  0xfffffd7ff981ddb9 in do_reading (transport=<value optimized out>) at dbus-transport-socket.c:800
#3  0xfffffd7ff981e4f7 in socket_do_iteration (transport=<value optimized out>, flags=<value optimized out>,
    timeout_milliseconds=<value optimized out>) at dbus-transport-socket.c:1162
#4  0xfffffd7ff981ca21 in _dbus_transport_do_iteration (transport=<value optimized out>, flags=<value optimized out>,
    timeout_milliseconds=<value optimized out>) at dbus-transport.c:981
#5  0xfffffd7ff97fa65c in _dbus_connection_do_iteration_unlocked (connection=<value optimized out>,
    pending=<value optimized out>, flags=<value optimized out>, timeout_milliseconds=<value optimized out>)
    at dbus-connection.c:1207
#6  0xfffffd7ff97fc562 in _dbus_connection_block_pending_call (pending=<value optimized out>) at dbus-connection.c:2416
#7  0xfffffd7ff97fdfb3 in dbus_connection_send_with_reply_and_block (connection=<value optimized out>,
    message=<value optimized out>, timeout_milliseconds=<value optimized out>, error=<value optimized out>)
    at dbus-connection.c:3559
#8  0xfffffd7ff97f8b17 in dbus_bus_register (connection=<value optimized out>, error=<value optimized out>) at dbus-bus.c:698
#9  0xfffffd7ff97f8658 in dbus_bus_get (type=<value optimized out>, error=<value optimized out>) at dbus-bus.c:491
#10 0xfffffd7ff98b2bd5 in get_ior (start_if_not_found=38161477, failure_log=0x300000000000000) at gconf-internals.c:2444

<< >>


<< >>

(gdb) up
#1  0xfffffd7ff9827d20 in _dbus_read_socket_with_unix_fds (fd=<value optimized out>, buffer=<value optimized out>,
    count=<value optimized out>, fds=<value optimized out>, n_fds=<value optimized out>) at dbus-sysdeps-unix.c:292

<< >>


Can some quickly look at this and help me here?  

Thanks
Comment 1 Simon McVittie 2011-01-27 10:20:20 UTC
(In reply to comment #0)
> dbus-1.4.0 fails to compile by default on Solaris with below shown errors.

I think this is Bug #33465; my patch there is probably a cleaner way to fix this.

> #0  0xfffffd7fff293b3b in .memsetbyte32sse2 () from /lib/64/libc.so.1
> #1  0xfffffd7ff9827d20 in _dbus_read_socket_with_unix_fds (fd=<value optimized
> out>, buffer=<value optimized out>,
>     count=<value optimized out>, fds=<value optimized out>, n_fds=<value
> optimized out>) at dbus-sysdeps-unix.c:292

This might be Bug #33466; could you try building dbus with GNU ld, or without --gc-sections (currently requires patching configure.in)?

Otherwise, I have no idea what's going on there. You could try compiling without optimization to see if you can get a better backtrace?
Comment 2 Simon McVittie 2014-09-23 14:25:05 UTC
No more info provided in > 3.5 years, closing WORKSFORME.

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.