[ icewm-Bugs-3125471 ] SIGBUS on OpenBSD/sparc64

"SourceForge.net" <[email protected]> Fri, 03 Dec 2010 10:25:09 +0000
Newsgroups gmane.comp.window-managers.icewm.devel
Message-ID <[email protected]>
Bugs item #3125471, was opened at 2010-12-02 13:24
Message generated for change (Comment added) made by sfandino
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100031&aid=3125471&group_id=31

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Salvador Fandiño García (sfandino)
Assigned to: Nobody/Anonymous (nobody)
Summary: SIGBUS on OpenBSD/sparc64

Initial Comment:
XChangeProperty is being called for changing property _XA_NET_WM_PID passing a pointer to a *pid_t instead of the expected pointer to a *long. On my box they are 32bit and 64bit integers respectively and so the application crashes because of an unaligned access.

See this bug report on the OpenBSD bugtracker for further details: http://cvs.openbsd.org/cgi-bin/query-pr-wrapper?full=yes&numbers=6522

The following patch solves the problem:

--- wmapp.cc~   Sun Oct 31 15:09:36 2010
+++ wmapp.cc    Thu Dec  2 13:00:51 2010
@@ -219,7 +219,7 @@
                     PropModeReplace, (unsigned char *)win_proto, i);
 #endif

-    pid_t pid = getpid();
+    long pid = getpid();
     const char wmname[] = "IceWM "VERSION" ("HOSTOS"/"HOSTCPU")";

 #ifdef GNOME1_HINTS


----------------------------------------------------------------------

Comment By: Salvador Fandiño García (sfandino)
Date: 2010-12-03 11:25

Message:
The problem is not getpid returning a value of type pid_t but later
XChangeProperty requiring a pointer to a long for 32 bits data.

From the XChangeProperty manual page:

" If the specified format is 8, the property data must be a char array. 
If the specified format is 16, the property data must be a short array.  If
the specified format is 32, the property data must be a long array."

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2010-12-02 20:56

Message:
Seriously?

GETPID(2)		    BSD System Calls Manual		     GETPID(2)
...
       pid_t getpid(void);

If you get some memory corruption then you maybe should fix your headers
and make sure that it's the same signature as libc uses. I guess it isn't!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100031&aid=3125471&group_id=31

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Icewm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icewm-devel