--- a/hw/xfree86/os-support/solaris/sun_vid.c Fri Jun 5 08:19:40 2015
+++ b/hw/xfree86/os-support/solaris/sun_vid.c Thu Nov 12 14:44:00 2015
@@ -22,7 +22,7 @@
* OF THIS SOFTWARE.
*
*/
-/* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -81,14 +81,27 @@
xf86EnableIO(void)
{
#if defined(__i386__) || defined(__i386) || defined(__x86)
+ uid_t user_id;
if (ExtendedEnabled)
return TRUE;
+ user_id = geteuid();
+ if (user_id != 0) { /* reset privs back to root */
+ if (seteuid(0) < 0) {
+ xf86Msg(X_WARNING, "Error in resetting euid to root \n");
+ }
+ }
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n");
return FALSE;
}
- ExtendedEnabled = TRUE;
+ else
+ ExtendedEnabled = TRUE;
+ if (user_id != 0) { /* reset privs back to user */
+ if (seteuid(user_id) < 0) {
+ xf86Msg(X_WARNING, "Error in resetting euid to %d\n", user_id);
+ }
+ }
#endif /* i386 */
return TRUE;
}
@@ -100,8 +113,9 @@
if (!ExtendedEnabled)
return;
- sysi86(SI86V86, V86SC_IOPL, 0);
-
- ExtendedEnabled = FALSE;
+ if (sysi86(SI86V86, V86SC_IOPL, 0) < 0)
+ xf86Msg(X_WARNING, "xf86DisableIOPorts: Failed to set IOPL for I/O\n");
+ else
+ ExtendedEnabled = FALSE;
#endif /* i386 */
}