how to use wsfb and non-root?

Jeremy C. Reed reed at reedmedia.net
Fri May 26 14:42:27 PDT 2006


I asked about a week ago about a list or documentation of known X drivers 
that do not need root.

Anyways, I am using wsfb on NetBSD/i386 3.99.20. It is uses NetBSD's 
wsdisplay(4) which "an abstraction layer for display devices within the 
wscons(4) framework." I am using my wsdisplay on vesafb which is a 
NetBSD-current-only graphics driver.

I created the autoconf files for driver/xf86-video-wsfb (and one patch for 
VERSION to WSFB_VERSION). I plan on committing them unless someone says 
no.

So I hear that some people run X as non root. I have even heard this for 
i386 systems.

How is this done?

Here are examples of my trials with this. Your feedback and comments and 
advice would be appreciated.

1) First problem is logfile. LogFile configuration is not enabled since it 
is already opened before configuration is read. And the -logfile switch is 
for root only.

I easily worked-around this since the default /usr/local/var/log was not 
used by anything else so I made it group-writable.

Maybe the -logfile switch check for root should not check for geteuid() != 
0  but only check for getuid() == 0.

Who cares if a non-root runs a non-setuid Xorg?

Or maybe the logging should not happen until config file is read.

2) Next problem is the suid check. I disabled that geteuid() code in 
./hw/xfree86/os-support/bsd/bsd_init.c.

Was something supposed to bypass that?

The Linux code only checks this for KeepTty.

3)

Next problem is:

xf86OpenConsole: No console driver found
        Supported drivers: pccons (with X support), wscons
        Check your kernel's console driver configuration and /dev entries

xf86OpenWScons attempts to open each ttyE?, but in my case they are only 
readable (and writable) by root. When I logged into second virtual 
console, then it was readable and writable by me.

4)  Xorg next failed on:

(WW) checkDevMem: failed to open /dev/mem (Permission denied)
...
(WW) xf86EnableIO: Failed to set IOPL for extended I/O(II) Addressable bus 
resource ranges are
...
(WW) xf86EnableIO: Failed to set IOPL for extended I/O(EE) No devices 
detected.

I read this is related to "machdep.allowaperture" or maybe
machdep.allow_vga_aperture sysctl on OpenBSD. I don't know for NetBSD yet.

This is i386_iopl which is restricted to root.

5) If I comment out the failure there, then I get:

(WW) checkDevMem: failed to open /dev/mem (Permission denied)
...                            
(WW) xf86EnableIO: Failed to set IOPL for extended I/O(II) PCI: Probing 
config type using method 1             

And signal 11 and it says "Abort".

ktrace shows:

  1009      1 Xorg     NAMI  "/dev/ttyE1"
  1009      1 Xorg     RET   open 5
  1009      1 Xorg     CALL  ioctl(5,_IOW('W',0x4c,0x4),0xbfbfec8c)
  1009      1 Xorg     GIO   fd 5 wrote 4 bytes
       "\^A\0\0\0"
  1009      1 Xorg     RET   ioctl 0
  1009      1 Xorg     CALL  write(0,0x81b0c20,0x19)
  1009      1 Xorg     GIO   fd 0 wrote 25 bytes
       "(--) Using wscons driver
       "
  1009      1 Xorg     RET   write 25/0x19
  1009      1 Xorg     CALL  write(2,0x8184483,0x10)
  1009      1 Xorg     GIO   fd 2 wrote 16 bytes
       "xf86OpenConsole
       "
  1009      1 Xorg     RET   write 16/0x10
  1009      1 Xorg     CALL  sysarch(2,0xbfbfebf0)
  1009      1 Xorg     RET   sysarch -1 errno 1 Operation not permitted
  1009      1 Xorg     CALL  write(0,0x81b0c20,0x36)
  1009      1 Xorg     GIO   fd 0 wrote 54 bytes
       "(WW) xf86EnableIO: Failed to set IOPL for extended I/O"
  1009      1 Xorg     RET   write 54/0x36
  1009      1 Xorg     CALL  write(0,0x81b0c20,0x2d)
  1009      1 Xorg     GIO   fd 0 wrote 45 bytes
       "(II) PCI: Probing config type using method 1
       "
  1009      1 Xorg     RET   write 45/0x2d
  1009      1 Xorg     PSIG  SIGSEGV caught handler=0x80b73d4 mask=(): 
code=SEGV_ACCERR, addr=0x80cd04c, trap=4)
  1009      1 Xorg     CALL  
__sigaction_sigtramp(SIGSEGV,0xbfbfe82c,0xbfbfe80c,0xbba6887c,2)
  1009      1 Xorg     RET   __sigaction_sigtramp 0


I don't want this PCI probing (I think?). I want to use my wsdisplay 
abstraction layer for display which already works as non-root.

Where do I disable or configure to skip that PCI probing?

 Jeremy C. Reed

p.s. Unrelated, I had error from dlopen when I didn't specifically "Load 
shadow". Maybe that should be documented?  I am not sure since I also 
tried with ShadowFB turned off.



More information about the xorg mailing list