Bug 112600 - dcopserver crashes with self-test failed
Summary: dcopserver crashes with self-test failed
Status: RESOLVED UNMAINTAINED
Alias: None
Product: dcop
Classification: Frameworks and Libraries
Component: dcopserver (show other bugs)
Version: unspecified
Platform: OpenBSD OpenBSD
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-14 18:27 UTC by H.Gerlach
Modified: 2010-01-20 21:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.Gerlach 2005-09-14 18:27:18 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    OpenBSD Packages
OS:                OpenBSD

Hello, 

excuse for my bad engish first.
I installed OpenBSD 3.7 from the original CD's and installed X and the kdebase-3.3.2p3 package too from the bought OpenBSD CDs.

After installing that on my new system I'm able to start X without problems, but not able to start KDE. A look deeper shows, that the problem seems to be in DCOPServer. The problem I get is similar to Bug 38955 (dcopserver could not start (segmentation fault)). Bug is maked resolved but the problem seems to be exist anyway.
I get a message "DCOPServer self-test failed" and a core. If I start dcopserver --nofork it runs (until I run startkde). 

Looking around for a solution seems that nobody can hep me. So I had a look into the source-file 
http://developer.kde.org/documentation/library/3.3-api/dcop/html/dcopserver_8cpp-source.html

Assume that is the right one. I'm not a freak, but as far as I understand the situation there's something amazing. 

There's an uninitialize array defined:
00422 static int ready[2];
It contains file descriptors and will used later without any initialization between:
01004     write(ready[1], &c, 1); // dcopserver is started

Later it becomes a pipe, but the Fd's are still uninitialized:

01612     pipe(ready);

And now we come to my problem:

01614     if (!nofork) {
01615         pid_t pid = fork();
01616     if (pid > 0) {
01617         char c = 1;
01618         close(ready[1]);
01619         read(ready[0], &c, 1); // Wait till dcopserver is started
01620         close(ready[0]);
01622         if (c == 0)
                 :
01627                   return 0;
                  
01629             qWarning("DCOPServer self-test failed.");

If "read(ready..." get's an error e.g. in the case that the fd's in "ready" a not valid under the current OS c remains 1 and we get the selftest error.

Normally one would expect the all uninitialized variables are zeroed by the compiler and / or the OS but I'm not shure if it's true for all OSses/compilers. OpenBSD in details does something against bufferoverflows and so dealing with memory allocation/memory patterns.




Opened: 2002-03-04 19:03 
Product: dcop 
Component: dcopserver 
Version: unspecified 
Status: RESOLVED 
Platform: Debian testing 
Resolution: INVALID 
Reporter: boti@makacs.poliod.hu 
Assigned to: Matthias Ettrich 

(*** This bug was imported into bugs.kde.org ***) 

Package:           dcopserver 
Version:           KDE 2.2.2 
Severity:          normal 
Installed from:    Debian testing/unstable Packages 
Compiler:          Not Specified 
OS:                Linux 
OS/Compiler notes: Debian sid all packages are up to date updated from ftp.de.debian.org 

I started a pure X server only with an xterminal running on it. I typed the startkde command and I got this output: 
boti:~$ startkde 
DCOPServer self-test failed. 
kdeinit: DCOPServer could not be started aborting. 
/usr/bin/kde2: line 102: 22113 Segmentation fault      ksmserver --restore 
connect() failed: : Connection refused 

The command dcopserver returned with: 
DCOPServer self-test failed. 

The command dcopserver --nofork got segfault. 
I straced the docserver (w/o any argument) and its child go segfault too. 

(Submitted via bugs.kde.org
Comment 1 Waldo Bastian 2005-09-14 23:33:39 UTC
"pipe(ready)" is supposed to initialize the two file descriptors ready[0] and ready[1]
Maybe the pipe function fails? We should check the return value, but if it fails there is not much we can do about it.
Comment 2 H.Gerlach 2005-09-15 09:11:57 UTC
Yes, taking a deeper look it seems to be OK. pipe(ready) is called before constructing a new DCOPServer 
01612     pipe(ready);

01656     DCOPServer *server = new DCOPServer(suicide); // this sets the_server

And the constructor than calls the write
00915 DCOPServer::DCOPServer(bool _suicide)
01004     write(ready[1], &c, 1); 

Should work but means my problem is an other one. and so I have no Idea how to solve it. Using OpenBSD 3.4 and the KDE package delivered with 3.4 I no problems at all.
Comment 3 Dario Andres 2010-01-20 21:15:35 UTC
Closing as DCOP is unmaintained.