2006-May-26
When wsfb exits (using vesafb), the console becomes greenish.Working on getting Xorg to run without root. 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.
Next problem is the suid check. I disabled that code in ./hw/xfree86/os-support/bsd/bsd_init.c. Next problem is:
xf86OpenConsole: No console driver found Supported drivers: pccons (with X support), wscons Check your kernel's console driver configuration and /dev entriesxf86OpenWScons 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, and 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 resou rce ranges areand
(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.
The ktrace showed:
9698 1 Xorg CALL sysarch(2,0xbfbfebe0) 9698 1 Xorg RET sysarch -1 errno 1 Operation not permittedThis is i386_iopl which is restricted to root. 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 t ype using method 1And signal 11 and it says "Abort". gdb of core dumps says:
#5 0x080b744e in xf86SigHandler (signo=11) at xf86Events.c:1495 #6So disabled that in xf86Init.c and next error:#7 ix86PciSelectCfgmech () at ../../../../hw/xfree86/common/compiler.h:1467 #8 0x080a89a8 in ix86PciInit () at ix86Pci.c:695 #9 0x080a6c47 in pciInit () at Pci.c:267 #10 0x080a79c5 in xf86scanpci (flags=0) at Pci.c:919 #11 0x080ca28d in FindPCIVideoInfo () at xf86pciBus.c:198 #12 0x080aa6fe in xf86BusProbe () at xf86Bus.c:116 #13 0x080970ff in InitOutput (pScreenInfo=0x81b3a60, argc=1, argv=0xbfbfee28) at xf86Init.c:391
#5 0x080b744a in xf86SigHandler (signo=11) at xf86Events.c:1495 #6#7 CheckGenericGA () at compiler.h:1447 #8 0x080ae789 in xf86FindPrimaryDevice () at xf86Bus.c:3038 #9 0x08097244 in InitOutput (pScreenInfo=0x81b3a40, argc=1, argv=0xbfbfee28) at xf86Init.c:493
Using xdm does not work -- can not type but shows something happening at bottom of screen like a cursor. And when press enter (with invalid login) screen goes blank and then doesn't redraw the xdm login. Then with setuid root Xorg ...
When running startx, I see nothing usable and can't zap. Output has:
AUDIT: Fri May 26 13:39:50 2006: 18730 X: client 1 rejected from local host AUDIT: Fri May 26 13:39:52 2006: 18730 X: client 1 rejected from local host ...Then same thing happened with "via" driver which worked great before. When using xdm via "via" it works fine. Just does not work with startx now.
I removed ~/.Xauthority and startx worked again. I recall I had this problem a couple years ago. xdm was configured wrong for me.
Also with setuid root Xorg I was able to startx with wsfb X driver on the first console. The resolution is bad (low) but I will see if I can improve that later.
I improved the resolution! I used for my kernel configuration:
options VESAFB_WIDTH=1024 options VESAFB_HEIGHT=768 options VESAFB_DEPTH=16And the kernel said:
vesafb0: fb 1024x768x16 @0xd8000000The text console had many more lines, but readable and usable.
As before, Xorg started with:
(EE) wsfb(0): error saving colormap Invalid argument (==) wsfb(0): Backing store disabledThe X logging also had when I was running without setuid root:
ioctl FBIOGETCMAP: Invalid argument ioctl FBIOPUTCMAP: Invalid argumentThat is also from wsfb_driver.c code. Or maybe the above ioctl issues were with root, but when I had lower resolution. Maybe I will look at that later.