diff options
Diffstat (limited to 'meta/packages/xorg-xserver/xserver-xf86-dri-lite/xserver-no-root-2.patch')
| -rw-r--r-- | meta/packages/xorg-xserver/xserver-xf86-dri-lite/xserver-no-root-2.patch | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/meta/packages/xorg-xserver/xserver-xf86-dri-lite/xserver-no-root-2.patch b/meta/packages/xorg-xserver/xserver-xf86-dri-lite/xserver-no-root-2.patch new file mode 100644 index 0000000000..afc94dcc5c --- /dev/null +++ b/meta/packages/xorg-xserver/xserver-xf86-dri-lite/xserver-no-root-2.patch | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c | ||
| 2 | index 7f40857..cf58c01 100644 | ||
| 3 | --- a/hw/xfree86/os-support/linux/lnx_init.c | ||
| 4 | +++ b/hw/xfree86/os-support/linux/lnx_init.c | ||
| 5 | @@ -49,6 +49,7 @@ static Bool KeepTty = FALSE; | ||
| 6 | static int VTnum = -1; | ||
| 7 | static Bool VTSwitch = TRUE; | ||
| 8 | static Bool ShareVTs = FALSE; | ||
| 9 | +Bool NoHwAccess = FALSE; | ||
| 10 | static int activeVT = -1; | ||
| 11 | |||
| 12 | static int vtPermSave[4]; | ||
| 13 | @@ -80,9 +81,11 @@ saveVtPerms(void) | ||
| 14 | static void | ||
| 15 | restoreVtPerms(void) | ||
| 16 | { | ||
| 17 | - /* Set the terminal permissions back to before we started. */ | ||
| 18 | - chown("/dev/tty0", vtPermSave[0], vtPermSave[1]); | ||
| 19 | - chown(vtname, vtPermSave[2], vtPermSave[3]); | ||
| 20 | + if (geteuid() == 0) { | ||
| 21 | + /* Set the terminal permissions back to before we started. */ | ||
| 22 | + (void)chown("/dev/tty0", vtPermSave[0], vtPermSave[1]); | ||
| 23 | + (void)chown(vtname, vtPermSave[2], vtPermSave[3]); | ||
| 24 | + } | ||
| 25 | } | ||
| 26 | |||
| 27 | static void *console_handler; | ||
| 28 | @@ -210,20 +213,22 @@ xf86OpenConsole(void) | ||
| 29 | xf86Msg(X_WARNING, | ||
| 30 | "xf86OpenConsole: Could not save ownership of VT\n"); | ||
| 31 | |||
| 32 | - /* change ownership of the vt */ | ||
| 33 | - if (chown(vtname, getuid(), getgid()) < 0) | ||
| 34 | - xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n", | ||
| 35 | - vtname, strerror(errno)); | ||
| 36 | - | ||
| 37 | - /* | ||
| 38 | - * the current VT device we're running on is not "console", we want | ||
| 39 | - * to grab all consoles too | ||
| 40 | - * | ||
| 41 | - * Why is this needed?? | ||
| 42 | - */ | ||
| 43 | - if (chown("/dev/tty0", getuid(), getgid()) < 0) | ||
| 44 | - xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n", | ||
| 45 | - strerror(errno)); | ||
| 46 | + if (geteuid() == 0) { | ||
| 47 | + /* change ownership of the vt */ | ||
| 48 | + if (chown(vtname, getuid(), getgid()) < 0) | ||
| 49 | + xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n", | ||
| 50 | + vtname, strerror(errno)); | ||
| 51 | + | ||
| 52 | + /* | ||
| 53 | + * the current VT device we're running on is not | ||
| 54 | + * "console", we want to grab all consoles too | ||
| 55 | + * | ||
| 56 | + * Why is this needed?? | ||
| 57 | + */ | ||
| 58 | + if (chown("/dev/tty0", getuid(), getgid()) < 0) | ||
| 59 | + xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n", | ||
| 60 | + strerror(errno)); | ||
| 61 | + } | ||
| 62 | } | ||
| 63 | |||
| 64 | /* | ||
| 65 | @@ -433,6 +438,11 @@ xf86ProcessArgument(int argc, char *argv[], int i) | ||
| 66 | ShareVTs = TRUE; | ||
| 67 | return(1); | ||
| 68 | } | ||
| 69 | + if (!strcmp(argv[i], "-nohwaccess")) | ||
| 70 | + { | ||
| 71 | + NoHwAccess = TRUE; | ||
| 72 | + return(1); | ||
| 73 | + } | ||
| 74 | if ((argv[i][0] == 'v') && (argv[i][1] == 't')) | ||
| 75 | { | ||
| 76 | if (sscanf(argv[i], "vt%2d", &VTnum) == 0) | ||
| 77 | @@ -454,5 +464,6 @@ xf86UseMsg() | ||
| 78 | ErrorF("don't detach controlling tty (for debugging only)\n"); | ||
| 79 | ErrorF("-novtswitch don't immediately switch to new VT\n"); | ||
| 80 | ErrorF("-sharevts share VTs with another X server\n"); | ||
| 81 | + ErrorF("-nohwaccess don't access hardware ports directly\n"); | ||
| 82 | return; | ||
| 83 | } | ||
| 84 | diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c | ||
| 85 | index 688106a..34a845b 100644 | ||
| 86 | --- a/hw/xfree86/os-support/linux/lnx_video.c | ||
| 87 | +++ b/hw/xfree86/os-support/linux/lnx_video.c | ||
| 88 | @@ -51,6 +51,7 @@ | ||
| 89 | #define MAP_FAILED ((void *)-1) | ||
| 90 | #endif | ||
| 91 | |||
| 92 | +extern Bool NoHwAccess; | ||
| 93 | static Bool ExtendedEnabled = FALSE; | ||
| 94 | |||
| 95 | #ifdef __ia64__ | ||
| 96 | @@ -509,6 +510,9 @@ xf86EnableIO(void) | ||
| 97 | int fd; | ||
| 98 | unsigned int ioBase_phys; | ||
| 99 | #endif | ||
| 100 | + /* Fake it... */ | ||
| 101 | + if (NoHwAccess) | ||
| 102 | + return TRUE; | ||
| 103 | |||
| 104 | if (ExtendedEnabled) | ||
| 105 | return TRUE; | ||
