• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/common/libva


Commit MetaInfo

Revisionb7203fe3b1fa633cece9cd9e5715b6477a708455 (tree)
Time2018-12-03 14:43:38
AuthorMark Thompson <sw@jkqx...>
CommiterXinfengZhang

Log Message

Remove restrictions on vaSetDriverName()

The UID restriction has no effect, since any code capable of calling
vaSetDriverName() can also edit the internals of the structure itself.
(This check was inherited from the environment variable setting, where
it does do something.)

The name whitelist prevents loading drivers not currently named on the
list, such as the Mesa and V4L2-request drivers. I don't believe there
is any reason to prevent loading another driver, and it is already
possible via the LIBVA_DRIVER_NAME environment variable.

Signed-off-by: Mark Thompson <sw@jkqxz.net>

Change Summary

Incremental Difference

--- a/va/va.c
+++ b/va/va.c
@@ -605,13 +605,6 @@ const char *vaErrorStr(VAStatus error_status)
605605 return "unknown libva error / description missing";
606606 }
607607
608-const static char *prefer_driver_list[4] = {
609- "i965",
610- "hybrid",
611- "pvr",
612- "iHD",
613-};
614-
615608 VAStatus vaSetDriverName(
616609 VADisplay dpy,
617610 char *driver_name
@@ -620,15 +613,8 @@ VAStatus vaSetDriverName(
620613 VADriverContextP ctx;
621614 VAStatus vaStatus = VA_STATUS_SUCCESS;
622615 char *override_driver_name = NULL;
623- int i, found;
624616 ctx = CTX(dpy);
625617
626- if (geteuid() != getuid()) {
627- vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
628- va_errorMessage(dpy, "no permission to vaSetDriverName\n");
629- return vaStatus;
630- }
631-
632618 if (strlen(driver_name) == 0 || strlen(driver_name) >=256) {
633619 vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
634620 va_errorMessage(dpy, "vaSetDriverName returns %s\n",
@@ -636,25 +622,7 @@ VAStatus vaSetDriverName(
636622 return vaStatus;
637623 }
638624
639- found = 0;
640- for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) {
641- if (strlen(prefer_driver_list[i]) != strlen(driver_name))
642- continue;
643- if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) {
644- found = 1;
645- break;
646- }
647- }
648-
649- if (!found) {
650- vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER;
651- va_errorMessage(dpy, "vaSetDriverName returns %s. Incorrect parameter\n",
652- vaErrorStr(vaStatus));
653- return vaStatus;
654- }
655-
656625 override_driver_name = strdup(driver_name);
657-
658626 if (!override_driver_name) {
659627 vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
660628 va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n",