Bug 24705

Summary: Bug concerning Xwrapper/XFree86-4.0.2
Product: Ports & Packages Reporter: sepp <sepp>
Component: Individual Port(s)Assignee: jmz
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description sepp 2001-01-28 21:30:01 UTC
	The bug occured when I was trying to start my recently installed 
        XFree86-4.0.2 (installed by the ports) with the little help of 
        Xwrapper that is delivered with the dists of xfree. Together with a 
        script I wrote, every tiny little user (without any special rights) 
        on your system is able to shut it down (like doing "halt").

Fix: 

I have fixed it by reconfigure the rights of some executable files 
        that you can mostly find in /usr/X11R6/bin like startx, xinit or X 
        for example.
How-To-Repeat: 
	All you need to reproduce this problem is a current version of 
        Xwrapper with x-right, that you get by ftp for example, an account 
        (e.g. telnet) and a 
        self-written script called .xserverrc, that contains following 
        phrase:
        exec Xwrapper $dspnum &args
        It is _very important_ that you use an "&" instead of "$" in front 
        of "args"!  
        After all, you configurate your script with the typical rights (e.g. 
        "777"), execute "startx" (you will have x-right for it by 
        default), and the systems shuts down its daemons.        
        By the way: You do not need root-rights...
Comment 1 Trevor Johnson 2001-01-29 12:17:15 UTC
> 	The bug occured when I was trying to start my recently installed
>         XFree86-4.0.2 (installed by the ports) with the little help of
>         Xwrapper that is delivered with the dists of xfree.

> 	All you need to reproduce this problem is a current version of
>         Xwrapper with x-right, that you get by ftp for example, an account

Hi, Sebastian.  Looking at
ftp://ftp.xfree86.org/pub/XFree86/4.0.2/source/FILES, I don't see a
wrapper.c file listed.  Are you using the one from an older version of
XFree86?  Are you using the one from x11/wrapper in the ports collection
(it doesn't sound like you are)?  Are you using one from another operating
system?  Let us know where to find it.

>         (e.g. telnet) and a
>         self-written script called .xserverrc, that contains following
>         phrase:
>         exec Xwrapper $dspnum &args
>         It is _very important_ that you use an "&" instead of "$" in front
>         of "args"!

I placed the .xserverrc file in my $HOME, which is where startx usually
looks for it.  With the startx script I have--unmodified from the way it
was installed from the XFree86-4.0.1_3 port--I get:

	$ startx

	args: not found

	Fatal server error:
	Server is already active for display 0
	        If this server is no longer running, remove /tmp/.X0-lock
	        and start again.


	When reporting a problem related to a server crash, please send
	the full server output, not just the last messages.
	This can be found in the log file "/var/log/XFree86.".


I tried making the .xserverrc read:

	exec startx $dspnum &args

and it forked numerous times, after which I got the message:

	xinit:  X server slow to shut down, sending KILL signal.

but X kept running.  Do you have a command called "args" in your path?
Have you set resource limits in /etc/login.conf?  By default they are
turned off.

>         After all, you configurate your script with the typical rights (e.g.
>         "777"), execute "startx" (you will have x-right for it by
>         default), and the systems shuts down its daemons.
>         By the way: You do not need root-rights...
>
> >Fix:
>
> 	I have fixed it by reconfigure the rights of some executable files
>         that you can mostly find in /usr/X11R6/bin like startx, xinit or X
>         for example.

What were the permissions originally, and what have you changed them to?
-- 
Trevor Johnson
http://jpj.net/~trevor/gpgkey.txt
Comment 2 tmoestl 2001-01-29 13:30:07 UTC
> > The bug occured when I was trying to start my recently installed
> > XFree86-4.0.2 (installed by the ports) with the little help of
> > Xwrapper that is delivered with the dists of xfree.
> > All you need to reproduce this problem is a current version of
> > Xwrapper with x-right, that you get by ftp for example, an account
      
> Hi, Sebastian.  Looking at
> ftp://ftp.xfree86.org/pub/XFree86/4.0.2/source/FILES, I don't see a
> wrapper.c file listed.  Are you using the one from an older version of
> XFree86?  Are you using the one from x11/wrapper in the ports collection
> (it doesn't sound like you are)?  Are you using one from another operating
> system?  Let us know where to find it.
I guess he is using the x11/wrapper port. I can reproduce it using that
one.
      
> > (e.g. telnet) and a
> > self-written script called .xserverrc, that contains following
> > phrase:
> > exec Xwrapper $dspnum &args
> > It is _very important_ that you use an "&" instead of "$" in front
> > of "args"!
> I placed the .xserverrc file in my $HOME, which is where startx usually
> looks for it.  With the startx script I have--unmodified from the way it
> was installed from the XFree86-4.0.1_3 port--I get:
>      
> 	$ startx
>  
> 	args: not found
>     
> 	Fatal server error:
> 	Server is already active for display 0
>                     If this server is no longer running, remove /tmp/.X0-lock
>                     and start again.
> [...]
I have not experienced this error. Are you sure that you did not have an
instance of XFree86 running on display 0?

> I tried making the .xserverrc read:
>
>       exec startx $dspnum &args
>      
>  and it forked numerous times, after which I got the message:
>      
>       xinit:  X server slow to shut down, sending KILL signal.
>      
> but X kept running.  Do you have a command called "args" in your path?
> Have you set resource limits in /etc/login.conf?  By default they are
> turned off.
This has nothing to do with the "args". A .xserverrc of
	exec Xwrapper $dspnum &
or 
	exec XFree86 $dspnum &
(run as root) will suffice. This is triggered when XFree86 is put in the
background in the .xserverrc (there are other possible constellations
where this might happen without using xinit). I have only tried this on 
4.0.2, but the that part code does not seem to have changed much since 
4.0.

The following patch should eliminate this behaviour:
------------------------------------------------------------------------
*** xc/programs/Xserver/os/connection.c.orig	Mon Jan 29 04:16:54 2001
--- xc/programs/Xserver/os/connection.c	Mon Jan 29 04:08:32 2001
***************
*** 408,414 ****
  	RunFromSmartParent = TRUE;
      ParentProcess = getppid ();
      if (RunFromSmartParent) {
! 	if (ParentProcess > 0) {
  	    kill (ParentProcess, SIGUSR1);
  	}
      }
--- 408,414 ----
  	RunFromSmartParent = TRUE;
      ParentProcess = getppid ();
      if (RunFromSmartParent) {
! 	if (ParentProcess > 1) {
  	    kill (ParentProcess, SIGUSR1);
  	}
      }
------------------------------------------------------------------------
For a complete explanation, please see my recent post on -security
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=18733+0+current/freebsd-security
(sorry, non-permanent location).

	- thomas
Comment 3 Mario Sergio Fujikawa Ferreira freebsd_committer freebsd_triage 2001-04-11 03:38:31 UTC
Responsible Changed
From-To: freebsd-ports->trevor

Over to maintainer of wrapper.
Comment 4 Trevor Johnson freebsd_committer freebsd_triage 2001-04-11 04:02:10 UTC
Responsible Changed
From-To: trevor->jmz

proposed patch is for X server, not X wrapper
Comment 5 dwcjr 2001-06-12 04:00:26 UTC
Has this been fixed in 4.0.3_3 or 4.1.0?
Comment 6 dwcjr 2001-06-16 06:35:27 UTC
just wondering if this is valid for xwindows 4.1.0, if no response I'll 
close it monday or tuesday.
Comment 7 dwcjr freebsd_committer freebsd_triage 2001-07-23 04:43:54 UTC
State Changed
From-To: open->closed

timeout from originator(over 1 month)