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

"SourceForge.net" <[email protected]> Sun, 02 Jan 2011 15:41:51 +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 captnmark
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: icewm-1.3
>Group: crash
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Salvador Fandiño García (sfandino)
>Assigned to: Marko Macek (captnmark)
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: Marko Macek (captnmark)
Date: 2011-01-02 16:41

Message:
applied  to icewm-1.3 branch

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

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

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Icewm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icewm-devel