minigbm: drv: Fix MINIGBM_DEBUG usage on Android

MINIGBM_DEBUG usage in drv_get_os_option() is broken on
Cuttlefish at the moment and we run into following selinux
denial.

W libc    : Access denied finding property "MINIGBM_DEBUG".
I auditd  : type=1400 audit(0.0:39): avc:  denied  { read } \
for  comm="android.hardwar" name="u:object_r:default_prop:s0" \
dev="tmpfs" ino=184 scontext=u:r:hal_graphics_allocator_default:s0 \
tcontext=u:object_r:default_prop:s0 tclass=file permissive=0

On Android builds, MINIGBM_DEBUG can translate to a vendor
property if not used as an env variable. To fix that property
usage on Android, we start with using the proper (lowercase)
Android property nomenclature. This will sadly break the usage
of MINIGBM_DEBUG env variable on Android builds and will
force users to use vendor.minigbm.debug property instead.

Change-Id: I05a6213d2460cf5f7d20d3d04a014965ca03bebe
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4630128
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Amit Pundir 2023-06-21 00:55:35 +05:30 committed by Chromeos LUCI
parent 844c5e5c09
commit 1376622a9b

5
drv.c
View file

@ -18,6 +18,9 @@
#ifdef __ANDROID__
#include <cutils/log.h>
#include <libgen.h>
#define MINIGBM_DEBUG "vendor.minigbm.debug"
#else
#define MINIGBM_DEBUG "MINIGBM_DEBUG"
#endif
#include "drv_helpers.h"
@ -114,7 +117,7 @@ struct driver *drv_create(int fd)
return NULL;
const char *minigbm_debug;
minigbm_debug = drv_get_os_option("MINIGBM_DEBUG");
minigbm_debug = drv_get_os_option(MINIGBM_DEBUG);
drv->compression = (minigbm_debug == NULL) || (strcmp(minigbm_debug, "nocompression") != 0);
drv->fd = fd;