mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
Merge main into playstore for 0.6.9.2 (version code 20)
Brings the main fixes and features since 8a8bb2053 to the Play line.
Main's new code keeps the Play gates: bundled PRoot, AddonPack and
ComponentDownloads gates, the SDK guards, PackageInfoCompat and the
accessibility consent check, which now also covers system-key capture.
The accessibility disclosure is rewritten in every locale to describe
the hardware-keyboard keys it keeps in a session. The MaliBridge server
task uses the AGP NDK provider. Review notes are in tools/playstore/POLICY.md.
This commit is contained in:
commit
95cb9159de
517 files changed
+46804
-2489
No files matched your search
+192
-31
@@ -4,13 +4,19 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_HANDLES 4096
|
||||
#ifndef F_DUPFD_QUERY
|
||||
#define F_DUPFD_QUERY 1027
|
||||
#endif
|
||||
#define PVR_HANDLE_BIT UINT32_C(0x80000000)
|
||||
|
||||
struct gem_close {
|
||||
uint32_t handle;
|
||||
@@ -22,11 +28,14 @@ struct handle_entry {
|
||||
uint32_t handle;
|
||||
int dma_fd;
|
||||
int drm_fd;
|
||||
int owned_drm_fd; /* PowerVR: pin the open file description, not its reusable fd number. */
|
||||
int powervr;
|
||||
};
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static struct handle_entry handle_entries[MAX_HANDLES];
|
||||
static uint32_t next_handle = 1;
|
||||
static uint32_t next_pvr_handle = PVR_HANDLE_BIT;
|
||||
static dev_t kgsl_dev;
|
||||
static int kgsl_state;
|
||||
|
||||
@@ -34,13 +43,42 @@ static int is_kgsl(int fd) {
|
||||
struct stat st;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (kgsl_state == 0) {
|
||||
kgsl_state = stat("/dev/kgsl-3d0", &st) == 0 ? 1 : -1;
|
||||
kgsl_dev = st.st_rdev;
|
||||
const char *standin = getenv("BL_DRM_STANDIN");
|
||||
kgsl_state = stat("/dev/kgsl-3d0", &st) == 0 || (standin && *standin && stat(standin, &st) == 0) ? 1 : -1;
|
||||
if (kgsl_state > 0) kgsl_dev = st.st_rdev;
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return kgsl_state > 0 && fstat(fd, &st) == 0 && S_ISCHR(st.st_mode) && st.st_rdev == kgsl_dev;
|
||||
}
|
||||
|
||||
/* Keep the opt-in separate from GPU detection: manual ICDs must retain native DRM behavior. */
|
||||
struct bl_drm_version {
|
||||
int major, minor, patch;
|
||||
size_t name_len;
|
||||
char *name;
|
||||
size_t date_len;
|
||||
char *date;
|
||||
size_t desc_len;
|
||||
char *desc;
|
||||
};
|
||||
#define BL_DRM_VERSION _IOWR('d', 0x00, struct bl_drm_version)
|
||||
|
||||
static int is_powervr(int fd) {
|
||||
const char *enabled = getenv("BL_POWERVR_DRM_HANDLES");
|
||||
if (!enabled || strcmp(enabled, "1")) return 0;
|
||||
const char *path = getenv("BL_POWERVR_RENDER_NODE");
|
||||
if (!path || !*path) return 0;
|
||||
struct stat node, candidate;
|
||||
if (stat(path, &node) || fstat(fd, &candidate) ||
|
||||
!S_ISCHR(candidate.st_mode) || !S_ISCHR(node.st_mode) ||
|
||||
candidate.st_rdev != node.st_rdev) return 0;
|
||||
char name[16] = {0};
|
||||
struct bl_drm_version version = {.name_len = sizeof(name) - 1, .name = name};
|
||||
/* Bypass the preload's ioctl dispatcher to avoid recursively entering this hook. */
|
||||
return syscall(SYS_ioctl, fd, BL_DRM_VERSION, &version) == 0 &&
|
||||
version.name_len == 3 && !memcmp(name, "pvr", 3);
|
||||
}
|
||||
|
||||
static void *real(const char *name) {
|
||||
void *fn = dlsym(RTLD_NEXT, name);
|
||||
if (!fn) {
|
||||
@@ -49,35 +87,124 @@ static void *real(const char *name) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
static int same_by_flock(int a, int b) {
|
||||
struct stat sa, sb;
|
||||
if (fstat(a, &sa) || fstat(b, &sb) || sa.st_dev != sb.st_dev || sa.st_ino != sb.st_ino ||
|
||||
flock(a, LOCK_EX | LOCK_NB)) {
|
||||
return 0;
|
||||
}
|
||||
int same = flock(b, LOCK_EX | LOCK_NB) == 0;
|
||||
flock(a, LOCK_UN);
|
||||
return same;
|
||||
}
|
||||
|
||||
static int same_file_description(int a, int b) {
|
||||
if (a == b) {
|
||||
return 1;
|
||||
}
|
||||
#ifdef SYS_kcmp
|
||||
int saved_errno = errno;
|
||||
long ret = syscall(SYS_kcmp, getpid(), getpid(), 0 , a, b);
|
||||
errno = saved_errno;
|
||||
return ret == 0;
|
||||
#else
|
||||
return 0;
|
||||
int ret = -1;
|
||||
#ifdef SYS_kcmp
|
||||
static int kcmp_missing;
|
||||
if (!kcmp_missing) {
|
||||
long k = syscall(SYS_kcmp, getpid(), getpid(), 0, a, b);
|
||||
if (k >= 0) {
|
||||
ret = k == 0;
|
||||
} else if (errno == ENOSYS || errno == EPERM) {
|
||||
kcmp_missing = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ret < 0) {
|
||||
const char *standin = getenv("BL_DRM_STANDIN");
|
||||
ret = standin && *standin ? same_by_flock(a, b) : 0;
|
||||
}
|
||||
errno = saved_errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Android kernels before 6.10 have no F_DUPFD_QUERY, while the app seccomp policy blocks kcmp.
|
||||
* F_SETOWN_EX updates the open file description, so a duplicate observes a temporary owner marker
|
||||
* and an independent open of the same render node does not. Restore the original owner before
|
||||
* returning; no signal is armed because these DRM descriptors do not have O_ASYNC set.
|
||||
*/
|
||||
static int same_owner_description(int owned, int fd) {
|
||||
struct f_owner_ex original_owned, original_fd, observed;
|
||||
if (fcntl(owned, F_GETOWN_EX, &original_owned) < 0 ||
|
||||
fcntl(fd, F_GETOWN_EX, &original_fd) < 0) {
|
||||
return -1;
|
||||
}
|
||||
const struct f_owner_ex candidates[] = {
|
||||
{.type = F_OWNER_TID, .pid = getpid()},
|
||||
{.type = F_OWNER_PID, .pid = getpid()},
|
||||
{.type = F_OWNER_PGRP, .pid = getpgrp()},
|
||||
};
|
||||
const struct f_owner_ex *marker = NULL;
|
||||
for (size_t i = 0; i < sizeof(candidates) / sizeof(candidates[0]); i++) {
|
||||
if (candidates[i].type != original_fd.type || candidates[i].pid != original_fd.pid) {
|
||||
marker = &candidates[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!marker || fcntl(owned, F_SETOWN_EX, marker) < 0) return -1;
|
||||
int observed_result = fcntl(fd, F_GETOWN_EX, &observed);
|
||||
int observed_errno = errno;
|
||||
int restore_result = fcntl(owned, F_SETOWN_EX, &original_owned);
|
||||
int restore_errno = errno;
|
||||
if (restore_result < 0) {
|
||||
errno = restore_errno;
|
||||
return -1;
|
||||
}
|
||||
if (observed_result < 0) {
|
||||
errno = observed_errno;
|
||||
return -1;
|
||||
}
|
||||
return observed.type == marker->type && observed.pid == marker->pid;
|
||||
}
|
||||
|
||||
static int same_owned_description(int owned, int fd) {
|
||||
int saved_errno = errno;
|
||||
int result = fcntl(owned, F_DUPFD_QUERY, fd);
|
||||
if (result >= 0) {
|
||||
errno = saved_errno;
|
||||
return result == 1;
|
||||
}
|
||||
#ifdef SYS_kcmp
|
||||
long compared = syscall(SYS_kcmp, getpid(), getpid(), 0 /* KCMP_FILE */, owned, fd);
|
||||
if (compared >= 0) {
|
||||
errno = saved_errno;
|
||||
return compared == 0;
|
||||
}
|
||||
#endif
|
||||
int owner_match = same_owner_description(owned, fd);
|
||||
errno = saved_errno;
|
||||
return owner_match == 1;
|
||||
}
|
||||
|
||||
static int find_handle_locked(int fd, uint32_t handle) {
|
||||
for (int i = 0; i < MAX_HANDLES; i++) {
|
||||
if (handle_entries[i].handle == handle &&
|
||||
same_file_description(handle_entries[i].drm_fd, fd)) {
|
||||
(handle_entries[i].powervr
|
||||
? same_owned_description(handle_entries[i].owned_drm_fd, fd)
|
||||
: same_file_description(handle_entries[i].drm_fd, fd))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static uint32_t alloc_handle_locked(void) {
|
||||
static uint32_t alloc_handle_locked(int powervr) {
|
||||
for (int tries = 0; tries <= MAX_HANDLES; tries++) {
|
||||
uint32_t candidate = next_handle++;
|
||||
if (next_handle == 0) {
|
||||
next_handle = 1;
|
||||
uint32_t candidate;
|
||||
if (powervr) {
|
||||
candidate = next_pvr_handle++;
|
||||
if (!(next_pvr_handle & PVR_HANDLE_BIT)) next_pvr_handle = PVR_HANDLE_BIT;
|
||||
} else {
|
||||
candidate = next_handle++;
|
||||
if (next_handle == PVR_HANDLE_BIT) next_handle = 1;
|
||||
}
|
||||
if (candidate == 0) {
|
||||
continue;
|
||||
@@ -97,25 +224,49 @@ static uint32_t alloc_handle_locked(void) {
|
||||
}
|
||||
|
||||
int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle) {
|
||||
if (!is_kgsl(fd)) {
|
||||
int kgsl = is_kgsl(fd);
|
||||
int powervr = !kgsl && is_powervr(fd);
|
||||
if (!kgsl) {
|
||||
int (*fn)(int, int, uint32_t *) = (int (*)(int, int, uint32_t *)) real("drmPrimeFDToHandle");
|
||||
return fn ? fn(fd, prime_fd, handle) : -ENOSYS;
|
||||
if (!fn) return -ENOSYS;
|
||||
int result = fn(fd, prime_fd, handle);
|
||||
if (!result || !powervr || errno != EINVAL) return result;
|
||||
}
|
||||
if (!handle) { errno = EINVAL; return -EINVAL; }
|
||||
int owner = -1;
|
||||
if (powervr) {
|
||||
owner = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (owner < 0) return -errno;
|
||||
/* The old-kernel owner probe mutates shared OFD state briefly; serialize it with lookups. */
|
||||
pthread_mutex_lock(&lock);
|
||||
int owner_matches = same_owned_description(owner, fd);
|
||||
pthread_mutex_unlock(&lock);
|
||||
if (!owner_matches) {
|
||||
close(owner);
|
||||
errno = EOPNOTSUPP;
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
int dup_fd = fcntl(prime_fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (dup_fd < 0) {
|
||||
return -errno;
|
||||
int error = errno;
|
||||
if (owner >= 0) close(owner);
|
||||
errno = error;
|
||||
return -error;
|
||||
}
|
||||
int ret = -ENOMEM;
|
||||
pthread_mutex_lock(&lock);
|
||||
for (int i = 0; i < MAX_HANDLES; i++) {
|
||||
if (handle_entries[i].handle == 0) {
|
||||
uint32_t token = alloc_handle_locked();
|
||||
uint32_t token = alloc_handle_locked(powervr);
|
||||
if (!token) {
|
||||
break;
|
||||
}
|
||||
handle_entries[i].handle = token;
|
||||
handle_entries[i].dma_fd = dup_fd;
|
||||
handle_entries[i].drm_fd = fd;
|
||||
handle_entries[i].owned_drm_fd = owner;
|
||||
handle_entries[i].powervr = powervr;
|
||||
*handle = token;
|
||||
ret = 0;
|
||||
break;
|
||||
@@ -124,24 +275,32 @@ int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle) {
|
||||
pthread_mutex_unlock(&lock);
|
||||
if (ret) {
|
||||
close(dup_fd);
|
||||
if (owner >= 0) close(owner);
|
||||
errno = -ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd) {
|
||||
if (!is_kgsl(fd)) {
|
||||
int (*fn)(int, uint32_t, uint32_t, int *) = (int (*)(int, uint32_t, uint32_t, int *)) real("drmPrimeHandleToFD");
|
||||
return fn ? fn(fd, handle, flags, prime_fd) : -ENOSYS;
|
||||
}
|
||||
int kgsl = is_kgsl(fd);
|
||||
int ret = -EINVAL;
|
||||
pthread_mutex_lock(&lock);
|
||||
int index = find_handle_locked(fd, handle);
|
||||
if (index >= 0) {
|
||||
*prime_fd = fcntl(handle_entries[index].dma_fd, F_DUPFD_CLOEXEC, 0);
|
||||
ret = *prime_fd < 0 ? -errno : 0;
|
||||
if (!prime_fd || (handle_entries[index].powervr && (flags & ~(O_CLOEXEC | O_RDWR)))) {
|
||||
errno = EINVAL;
|
||||
} else {
|
||||
int command = handle_entries[index].powervr && !(flags & O_CLOEXEC) ? F_DUPFD : F_DUPFD_CLOEXEC;
|
||||
*prime_fd = fcntl(handle_entries[index].dma_fd, command, 0);
|
||||
ret = *prime_fd < 0 ? -errno : 0;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&lock);
|
||||
return ret;
|
||||
if (index >= 0 || kgsl) return ret;
|
||||
/* Unknown handles (including real PowerVR GEM handles) retain kernel semantics. */
|
||||
int (*fn)(int, uint32_t, uint32_t, int *) =
|
||||
(int (*)(int, uint32_t, uint32_t, int *)) real("drmPrimeHandleToFD");
|
||||
return fn ? fn(fd, handle, flags, prime_fd) : -ENOSYS;
|
||||
}
|
||||
|
||||
static int release_handle(int fd, uint32_t handle) {
|
||||
@@ -150,6 +309,7 @@ static int release_handle(int fd, uint32_t handle) {
|
||||
int index = find_handle_locked(fd, handle);
|
||||
if (index >= 0) {
|
||||
close(handle_entries[index].dma_fd);
|
||||
if (handle_entries[index].powervr) close(handle_entries[index].owned_drm_fd);
|
||||
handle_entries[index] = (struct handle_entry){0};
|
||||
found = 1;
|
||||
}
|
||||
@@ -158,22 +318,23 @@ static int release_handle(int fd, uint32_t handle) {
|
||||
}
|
||||
|
||||
int drmCloseBufferHandle(int fd, uint32_t handle) {
|
||||
if (!is_kgsl(fd)) {
|
||||
int (*fn)(int, uint32_t) = (int (*)(int, uint32_t)) real("drmCloseBufferHandle");
|
||||
return fn ? fn(fd, handle) : -ENOSYS;
|
||||
}
|
||||
return release_handle(fd, handle) ? 0 : -EINVAL;
|
||||
if (release_handle(fd, handle)) return 0;
|
||||
if (is_kgsl(fd)) { errno = EINVAL; return -EINVAL; }
|
||||
int (*fn)(int, uint32_t) = (int (*)(int, uint32_t)) real("drmCloseBufferHandle");
|
||||
return fn ? fn(fd, handle) : -ENOSYS;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_drm_gem_close(int fd, unsigned long request, void *arg, int *rc) {
|
||||
if (request != GEM_CLOSE || !arg || !is_kgsl(fd)) {
|
||||
if (request != GEM_CLOSE || !arg) {
|
||||
return 0;
|
||||
}
|
||||
if (release_handle(fd, ((struct gem_close *) arg)->handle)) {
|
||||
*rc = 0;
|
||||
} else {
|
||||
} else if (is_kgsl(fd)) {
|
||||
errno = EINVAL;
|
||||
*rc = -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,112 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define KGSL_IOC_TYPE 0x09
|
||||
#define KGSL_TIMESTAMP_RETIRED 0x00000002
|
||||
#include "../../quest/kgsl_compat.h"
|
||||
|
||||
struct kgsl_device_waittimestamp_ctxtid {
|
||||
unsigned int context_id;
|
||||
unsigned int timestamp;
|
||||
unsigned int timeout;
|
||||
};
|
||||
#define KGSL_CONTEXTS 1024
|
||||
|
||||
struct kgsl_cmdstream_readtimestamp_ctxtid {
|
||||
unsigned int context_id;
|
||||
unsigned int type;
|
||||
unsigned int timestamp;
|
||||
};
|
||||
static struct {
|
||||
uint32_t submitted;
|
||||
uint32_t retired;
|
||||
int owner;
|
||||
} contexts[KGSL_CONTEXTS];
|
||||
|
||||
#define IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID \
|
||||
_IOW(KGSL_IOC_TYPE, 0x7, struct kgsl_device_waittimestamp_ctxtid)
|
||||
#define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID \
|
||||
_IOWR(KGSL_IOC_TYPE, 0x16, struct kgsl_cmdstream_readtimestamp_ctxtid)
|
||||
static void report_denied(unsigned long request, int error) {
|
||||
static unsigned reports;
|
||||
int saved = errno;
|
||||
|
||||
if (__atomic_fetch_add(&reports, 1, __ATOMIC_RELAXED) < 8)
|
||||
fprintf(stderr, "[QuestKGSL] ioctl 0x%lx refused, errno=%d\n", request & 0xff, error);
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
static void note_submit(unsigned int context_id, unsigned int timestamp) {
|
||||
uint32_t known;
|
||||
|
||||
if (context_id >= KGSL_CONTEXTS) return;
|
||||
known = __atomic_load_n(&contexts[context_id].submitted, __ATOMIC_RELAXED);
|
||||
while ((int32_t)(timestamp - known) > 0 &&
|
||||
!__atomic_compare_exchange_n(&contexts[context_id].submitted, &known, timestamp, 1,
|
||||
__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
|
||||
}
|
||||
}
|
||||
|
||||
static int wait_retired(int (*real)(int, unsigned long, void *), int fd, uint32_t id, uint32_t timestamp) {
|
||||
/* KGSL reads a timeout of 0 as wait forever. */
|
||||
struct kgsl_device_waittimestamp_ctxtid wait = {.context_id = id, .timestamp = timestamp, .timeout = 1};
|
||||
|
||||
if (real(fd, IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID, &wait) == 0) return 0;
|
||||
return errno == ETIMEDOUT || errno == ETIME || errno == EINTR || errno == EAGAIN ? 1 : -1;
|
||||
}
|
||||
|
||||
/* shortcut: an unfinished timestamp sleeps a jiffy per poll, read the memstore instead if Quest's mmap of it is proven */
|
||||
static int read_retired(int (*real)(int, unsigned long, void *), int fd,
|
||||
struct kgsl_cmdstream_readtimestamp_ctxtid *read) {
|
||||
uint32_t id = read->context_id;
|
||||
uint32_t timestamp, submitted;
|
||||
int result;
|
||||
|
||||
if (read->type != KGSL_TIMESTAMP_RETIRED || id >= KGSL_CONTEXTS ||
|
||||
__atomic_load_n(&contexts[id].owner, __ATOMIC_RELAXED) != fd + 1)
|
||||
return -1;
|
||||
timestamp = __atomic_load_n(&contexts[id].retired, __ATOMIC_RELAXED);
|
||||
submitted = __atomic_load_n(&contexts[id].submitted, __ATOMIC_RELAXED);
|
||||
/* KGSL checks a context's owner on every wait, which catches one that died with a reused descriptor. */
|
||||
if (timestamp == submitted && wait_retired(real, fd, id, timestamp) < 0) return -1;
|
||||
while (timestamp != submitted) {
|
||||
result = wait_retired(real, fd, id, timestamp + 1);
|
||||
if (result < 0) return -1;
|
||||
if (result > 0) break;
|
||||
timestamp++;
|
||||
__atomic_store_n(&contexts[id].retired, timestamp, __ATOMIC_RELAXED);
|
||||
}
|
||||
read->timestamp = timestamp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Quest refuses some KGSL ioctls, and Mesa 27 turns a failed timestamp read into VK_ERROR_UNKNOWN. */
|
||||
__attribute__((visibility("hidden"))) void bl_kgsl_track(int (*real)(int, unsigned long, void *),
|
||||
int fd, unsigned long request, void *arg,
|
||||
int *rc) {
|
||||
int saved = errno;
|
||||
|
||||
if (arg == NULL) return;
|
||||
if (*rc == 0) {
|
||||
if (request == IOCTL_KGSL_GPU_COMMAND) {
|
||||
const struct kgsl_gpu_command *submit = arg;
|
||||
note_submit(submit->context_id, submit->timestamp);
|
||||
} else if (request == IOCTL_KGSL_GPU_AUX_COMMAND) {
|
||||
const struct kgsl_gpu_aux_command *submit = arg;
|
||||
note_submit(submit->context_id, submit->timestamp);
|
||||
} else if (request == IOCTL_KGSL_DRAWCTXT_CREATE) {
|
||||
const struct kgsl_drawctxt_create *create = arg;
|
||||
if (create->drawctxt_id < KGSL_CONTEXTS) {
|
||||
__atomic_store_n(&contexts[create->drawctxt_id].submitted, 0, __ATOMIC_RELAXED);
|
||||
__atomic_store_n(&contexts[create->drawctxt_id].retired, 0, __ATOMIC_RELAXED);
|
||||
/* User timestamps can leave gaps that would take one wait per integer, so their reads stay failed. */
|
||||
__atomic_store_n(&contexts[create->drawctxt_id].owner,
|
||||
create->flags & KGSL_CONTEXT_USER_GENERATED_TS ? 0 : fd + 1, __ATOMIC_RELAXED);
|
||||
}
|
||||
} else if (request == IOCTL_KGSL_DRAWCTXT_DESTROY) {
|
||||
const struct kgsl_drawctxt_destroy *destroy = arg;
|
||||
if (destroy->drawctxt_id < KGSL_CONTEXTS)
|
||||
__atomic_store_n(&contexts[destroy->drawctxt_id].owner, 0, __ATOMIC_RELAXED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_IOC_TYPE(request) == KGSL_IOC_TYPE && (saved == EACCES || saved == EPERM ||
|
||||
request == IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID))
|
||||
report_denied(request, saved);
|
||||
if (request != IOCTL_KGSL_CMDSTREAM_READTIMESTAMP_CTXTID || saved == EBADF) return;
|
||||
if (read_retired(real, fd, arg) == 0)
|
||||
*rc = 0;
|
||||
else if (errno != saved)
|
||||
report_denied(IOCTL_KGSL_DEVICE_WAITTIMESTAMP_CTXTID, errno);
|
||||
}
|
||||
|
||||
static int enabled(void) {
|
||||
static int cached = -1;
|
||||
|
||||
@@ -54,6 +54,9 @@ static int is_lock_query(int cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
int bl_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void bl_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
int fcntl(int fd, int cmd, ...) {
|
||||
static int (*real_fcntl)(int, int, ...);
|
||||
va_list ap;
|
||||
@@ -69,7 +72,11 @@ int fcntl(int fd, int cmd, ...) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
void *nl_state = NULL;
|
||||
int duplicate = cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC;
|
||||
if (duplicate && bl_nl_before_dup(fd, &nl_state) != 0) return -1;
|
||||
result = real_fcntl(fd, cmd, arg);
|
||||
if (duplicate) bl_nl_after_dup(nl_state, result);
|
||||
if (result >= 0 || !unsupported(errno)) return result;
|
||||
if (is_lock_command(cmd)) return 0;
|
||||
if (is_lock_query(cmd) && arg != NULL) {
|
||||
|
||||
@@ -111,10 +111,16 @@ typedef int (*accept4_fn)(int, struct sockaddr *, socklen_t *, int);
|
||||
static unsigned guarded_port(void);
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_udevmon_stand_in(int fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_bind(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_connect(int fd, const struct sockaddr *addr,
|
||||
socklen_t len, int *rc);
|
||||
|
||||
int bind(int fd, const struct sockaddr *addr, socklen_t len) {
|
||||
static bind_fn real;
|
||||
int nl_rc;
|
||||
if (!real) real = (bind_fn)dlsym(RTLD_NEXT, "bind");
|
||||
if (bl_nl_bind(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (bl_udevmon_stand_in(fd)) {
|
||||
if (addr == NULL || len < sizeof(struct sockaddr_nl) || addr->sa_family != AF_NETLINK) {
|
||||
errno = EINVAL;
|
||||
@@ -223,6 +229,8 @@ static int guest_peer(int fd) {
|
||||
|
||||
int connect(int fd, const struct sockaddr *addr, socklen_t len) {
|
||||
static connect_fn real;
|
||||
int nl_rc;
|
||||
if (bl_nl_connect(fd, addr, len, &nl_rc)) return nl_rc;
|
||||
if (!real) real = (connect_fn)dlsym(RTLD_NEXT, "connect");
|
||||
bind_before_loopback_connect(fd, addr, len);
|
||||
unsigned peer = loopback_family(addr, len) ? addr_port(addr, len) : 0;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1442,16 +1442,25 @@ static void ns_received(struct msghdr *msg) {
|
||||
|
||||
int bl_udevmon_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
ssize_t *result) __attribute__((visibility("hidden")));
|
||||
int bl_nl_recvmsg(int fd, struct msghdr *msg, int flags, ssize_t (*real_recvmsg)(int, struct msghdr *, int),
|
||||
ssize_t *result) __attribute__((visibility("hidden")));
|
||||
void bl_nl_received(struct msghdr *msg) __attribute__((visibility("hidden")));
|
||||
void bl_nl_closed(int fd) __attribute__((visibility("hidden")));
|
||||
void bl_nl_range_closed(unsigned int first, unsigned int last) __attribute__((visibility("hidden")));
|
||||
int bl_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void bl_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
ssize_t recvmsg(int fd, struct msghdr *msg, int flags) {
|
||||
static ssize_t (*real)(int, struct msghdr *, int);
|
||||
if (!real) real = (ssize_t (*)(int, struct msghdr *, int))dlsym(RTLD_NEXT, "recvmsg");
|
||||
ssize_t answered;
|
||||
if (msg && bl_nl_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
if (msg && bl_udevmon_recvmsg(fd, msg, flags, real, &answered)) return answered;
|
||||
ssize_t r = real(fd, msg, flags);
|
||||
if (r >= 0 && msg && msg->msg_control && msg->msg_controllen && ns_on()) {
|
||||
if (r >= 0 && msg && msg->msg_control && msg->msg_controllen) {
|
||||
int saved = errno;
|
||||
ns_received(msg);
|
||||
bl_nl_received(msg);
|
||||
if (ns_on()) ns_received(msg);
|
||||
errno = saved;
|
||||
}
|
||||
return r;
|
||||
@@ -1465,6 +1474,7 @@ int close(int fd) {
|
||||
if (fd >= 0) bl_fsync_fds_closed((unsigned int)fd, (unsigned int)fd);
|
||||
bl_venc_closed(fd);
|
||||
bl_vdec_closed(fd);
|
||||
bl_nl_closed(fd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && fd >= 0 && fd < NS_FDS && __atomic_load_n(&t[fd], __ATOMIC_ACQUIRE)) ns_forget(fd);
|
||||
int saved = errno;
|
||||
@@ -1480,19 +1490,29 @@ int close(int fd) {
|
||||
int dup2(int oldfd, int newfd) {
|
||||
static int (*real)(int, int);
|
||||
if (!real) real = (int (*)(int, int))dlsym(RTLD_NEXT, "dup2");
|
||||
if (oldfd == newfd) return real(oldfd, newfd);
|
||||
void *nl_state;
|
||||
if (bl_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) bl_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && oldfd != newfd && newfd >= 0 && newfd < NS_FDS && __atomic_load_n(&t[newfd], __ATOMIC_ACQUIRE)) ns_forget(newfd);
|
||||
return real(oldfd, newfd);
|
||||
int result = real(oldfd, newfd);
|
||||
bl_nl_after_dup(nl_state, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int dup3(int oldfd, int newfd, int flags) {
|
||||
static int (*real)(int, int, int);
|
||||
if (!real) real = (int (*)(int, int, int))dlsym(RTLD_NEXT, "dup3");
|
||||
if (oldfd == newfd) return real(oldfd, newfd, flags);
|
||||
void *nl_state;
|
||||
if (bl_nl_before_dup(oldfd, &nl_state) != 0) return -1;
|
||||
if (oldfd != newfd && newfd >= 0) bl_fsync_fds_closed((unsigned int)newfd, (unsigned int)newfd);
|
||||
uint64_t *t = __atomic_load_n(&ns_fdt, __ATOMIC_ACQUIRE);
|
||||
if (t && oldfd != newfd && newfd >= 0 && newfd < NS_FDS && __atomic_load_n(&t[newfd], __ATOMIC_ACQUIRE)) ns_forget(newfd);
|
||||
return real(oldfd, newfd, flags);
|
||||
int result = real(oldfd, newfd, flags);
|
||||
bl_nl_after_dup(nl_state, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void ns_forget_range(unsigned int first, unsigned int last) {
|
||||
@@ -1513,7 +1533,9 @@ int close_range(unsigned int first, unsigned int last, int flags) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
return real(first, last, flags);
|
||||
int result = real(first, last, flags);
|
||||
if (result == 0 && !(flags & CLOSE_RANGE_CLOEXEC)) bl_nl_range_closed(first, last);
|
||||
return result;
|
||||
}
|
||||
|
||||
void closefrom(int lowfd) {
|
||||
@@ -1523,7 +1545,10 @@ void closefrom(int lowfd) {
|
||||
bl_fsync_fds_closed((unsigned int)lowfd, ~0u);
|
||||
ns_forget_range((unsigned int)lowfd, ~0u);
|
||||
}
|
||||
if (real) real(lowfd);
|
||||
if (real) {
|
||||
real(lowfd);
|
||||
if (lowfd >= 0) bl_nl_range_closed((unsigned int)lowfd, ~0u);
|
||||
}
|
||||
}
|
||||
|
||||
static void ns_fork_prepare(void) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Based on jdmg28's DroidDeck-Mali fork (commit 6be00e00, GPL-3.0): steam-launch-wrapper runs every
|
||||
* game with --oom-score-adjust 900. Android's lmkd reads 900 as CACHED_APP_MIN_ADJ and kills the
|
||||
* foreground game first when memory runs short; on Linux 6.1 the raise also becomes the process's
|
||||
* permanent minimum. An app's processes cannot go below the score they inherit, so the only writes
|
||||
* that succeed from in here are raises: every write-open of an oom_score_adj file goes to /dev/null.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int is_oom_score_adj(const char *path) {
|
||||
if (path == NULL || strncmp(path, "/proc/", 6) != 0) return 0;
|
||||
const char *p = path + 6;
|
||||
if (strncmp(p, "self/", 5) == 0) {
|
||||
p += 5;
|
||||
} else if (strncmp(p, "thread-self/", 12) == 0) {
|
||||
p += 12;
|
||||
} else {
|
||||
const char *digits = p;
|
||||
while (*p >= '0' && *p <= '9') p++;
|
||||
if (p == digits || *p != '/') return 0;
|
||||
p++;
|
||||
if (strncmp(p, "task/", 5) == 0) {
|
||||
p += 5;
|
||||
digits = p;
|
||||
while (*p >= '0' && *p <= '9') p++;
|
||||
if (p == digits || *p != '/') return 0;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return strcmp(p, "oom_score_adj") == 0 || strcmp(p, "oom_adj") == 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) const char *bl_oom_adj_redirect(const char *path, int writing) {
|
||||
static int logged;
|
||||
if (!writing || !is_oom_score_adj(path)) return path;
|
||||
if (!__atomic_exchange_n(&logged, 1, __ATOMIC_RELAXED)) {
|
||||
static const char msg[] = "droiddeck: an oom_score_adj raise was dropped (Android would treat this program as a cached app)\n";
|
||||
int saved = errno;
|
||||
ssize_t ignored = write(STDERR_FILENO, msg, sizeof(msg) - 1);
|
||||
(void)ignored;
|
||||
errno = saved;
|
||||
}
|
||||
return "/dev/null";
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
int bl_status_without_tracer(const char *path, int flags, const void *caller) __attribute__((visibility("hidden")));
|
||||
int bl_writable_retry(int dirfd, const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_ntsync_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
const char *bl_oom_adj_redirect(const char *path, int writing) __attribute__((visibility("hidden")));
|
||||
int bl_venc_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_vdec_open(const char *path, int flags) __attribute__((visibility("hidden")));
|
||||
int bl_dircache_create(int dirfd, const char *path, int flags, mode_t mode,
|
||||
@@ -53,6 +54,7 @@ int open(const char *path, int flags, ...) {
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, __builtin_return_address(0))) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
@@ -80,6 +82,7 @@ int openat(int dirfd, const char *path, int flags, ...) {
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, __builtin_return_address(0))) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
@@ -8,6 +9,8 @@
|
||||
|
||||
#define FUSE_MAGIC 0x65735546
|
||||
#define SDCARDFS_MAGIC 0x5dca2df5
|
||||
#define FAT_MAGIC 0x4d44
|
||||
#define EXFAT_MAGIC 0x2011bab0
|
||||
|
||||
static int is_wineserver(void) {
|
||||
static int cached = -1;
|
||||
@@ -27,15 +30,42 @@ static int is_wineserver(void) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
static int has_no_unix_owner(int fd) {
|
||||
struct statfs fs;
|
||||
|
||||
if (fstatfs(fd, &fs) != 0) return 0;
|
||||
return fs.f_type == FUSE_MAGIC || fs.f_type == SDCARDFS_MAGIC || fs.f_type == FAT_MAGIC ||
|
||||
(unsigned int)fs.f_type == EXFAT_MAGIC;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden")))
|
||||
void bl_storage_owner(int fd, struct stat *st) {
|
||||
struct statfs fs;
|
||||
int saved = errno;
|
||||
uid_t uid;
|
||||
|
||||
if (st != NULL && is_wineserver()) {
|
||||
uid = getuid();
|
||||
if (st->st_uid != uid && fstatfs(fd, &fs) == 0 && (fs.f_type == FUSE_MAGIC || fs.f_type == SDCARDFS_MAGIC)) st->st_uid = uid;
|
||||
if (st->st_uid != uid && has_no_unix_owner(fd)) st->st_uid = uid;
|
||||
}
|
||||
errno = saved;
|
||||
}
|
||||
|
||||
int fchmod(int fd, mode_t mode) {
|
||||
static int (*next_fchmod)(int, mode_t);
|
||||
int saved = errno, result;
|
||||
|
||||
if (next_fchmod == NULL) next_fchmod = dlsym(RTLD_NEXT, "fchmod");
|
||||
if (next_fchmod == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
result = next_fchmod(fd, mode);
|
||||
if (result != 0 && errno == EPERM && is_wineserver()) {
|
||||
if (has_no_unix_owner(fd)) {
|
||||
errno = saved;
|
||||
return 0;
|
||||
}
|
||||
errno = EPERM;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* tools/linuxfs/preload/subreaper.c
|
||||
*
|
||||
* Mark every process that loads libblsession.so as a child subreaper.
|
||||
*
|
||||
* wlroots starts Xwayland with a double fork: gamescope -> middle process
|
||||
* (exits immediately) -> Xwayland. With no subreaper in the tree, Xwayland
|
||||
* is reparented to pid 1 and becomes an orphan. On some vendor kernels
|
||||
* (observed on Meizu / Flyme 12) an orphan reaper SIGKILLs it in that window,
|
||||
* which makes gamescope wait forever in wlserver_init() and the UI hangs on
|
||||
* "Starting display and audio".
|
||||
*
|
||||
* With PR_SET_CHILD_SUBREAPER the reparent target becomes the nearest marked
|
||||
* ancestor instead of init, so the orphan event never happens.
|
||||
*
|
||||
* Harmless for processes that do not fork, and cheap (one syscall at load).
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/prctl.h>
|
||||
|
||||
__attribute__((constructor))
|
||||
static void bl_session_set_subreaper(void)
|
||||
{
|
||||
(void)prctl(PR_SET_CHILD_SUBREAPER, 1);
|
||||
}
|
||||
@@ -102,6 +102,21 @@ static int make_stand_in(int type) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) int bl_nl_socket(int type, int *fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_owns(int fd);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockname(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getpeername(int fd, struct sockaddr *addr,
|
||||
socklen_t *len, int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_setsockopt(int fd, int level, int option,
|
||||
const void *value, socklen_t len,
|
||||
int (*real)(int, int, int, const void *, socklen_t),
|
||||
int *rc);
|
||||
__attribute__((visibility("hidden"))) int bl_nl_getsockopt(int fd, int level, int option,
|
||||
void *value, socklen_t *len,
|
||||
int (*real)(int, int, int, void *, socklen_t *),
|
||||
int *rc);
|
||||
|
||||
int socket(int domain, int type, int protocol) {
|
||||
static int (*real_socket)(int, int, int);
|
||||
int fd;
|
||||
@@ -111,6 +126,11 @@ int socket(int domain, int type, int protocol) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
if (domain == AF_NETLINK && protocol == NETLINK_ROUTE) {
|
||||
int route_fd;
|
||||
bl_nl_socket(type, &route_fd);
|
||||
return route_fd;
|
||||
}
|
||||
fd = real_socket(domain, type, protocol);
|
||||
if (fd >= 0 || domain != AF_NETLINK || protocol != NETLINK_KOBJECT_UEVENT)
|
||||
return fd;
|
||||
@@ -129,7 +149,9 @@ __attribute__((visibility("hidden"))) int bl_udevmon_stand_in(int fd) {
|
||||
int getsockname(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
static int (*real_getsockname)(int, struct sockaddr *, socklen_t *);
|
||||
struct sockaddr_nl nl;
|
||||
int route_rc;
|
||||
|
||||
if (bl_nl_getsockname(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (is_stand_in(fd)) {
|
||||
if (addr == NULL || len == NULL) {
|
||||
errno = EFAULT;
|
||||
@@ -150,21 +172,43 @@ int getsockname(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
return real_getsockname(fd, addr, len);
|
||||
}
|
||||
|
||||
int getpeername(int fd, struct sockaddr *addr, socklen_t *len) {
|
||||
static int (*real)(int, struct sockaddr *, socklen_t *);
|
||||
int route_rc;
|
||||
if (bl_nl_getpeername(fd, addr, len, &route_rc)) return route_rc;
|
||||
if (real == NULL) real = dlsym(RTLD_NEXT, "getpeername");
|
||||
return real(fd, addr, len);
|
||||
}
|
||||
|
||||
int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) {
|
||||
static int (*real_setsockopt)(int, int, int, const void *, socklen_t);
|
||||
int route_rc;
|
||||
|
||||
if (real_setsockopt == NULL) real_setsockopt = dlsym(RTLD_NEXT, "setsockopt");
|
||||
if (real_setsockopt == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
if (bl_nl_setsockopt(fd, level, optname, optval, optlen, real_setsockopt, &route_rc)) return route_rc;
|
||||
if (is_stand_in(fd)) {
|
||||
if (level == SOL_NETLINK)
|
||||
return 0;
|
||||
if (level == SOL_SOCKET && (optname == SO_ATTACH_FILTER || optname == SO_DETACH_FILTER))
|
||||
return 0;
|
||||
}
|
||||
if (real_setsockopt == NULL) real_setsockopt = dlsym(RTLD_NEXT, "setsockopt");
|
||||
if (real_setsockopt == NULL) {
|
||||
return real_setsockopt(fd, level, optname, optval, optlen);
|
||||
}
|
||||
|
||||
int getsockopt(int fd, int level, int option, void *value, socklen_t *len) {
|
||||
static int (*real)(int, int, int, void *, socklen_t *);
|
||||
int route_rc;
|
||||
if (real == NULL) real = dlsym(RTLD_NEXT, "getsockopt");
|
||||
if (real == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
return real_setsockopt(fd, level, optname, optval, optlen);
|
||||
if (bl_nl_getsockopt(fd, level, option, value, len, real, &route_rc)) return route_rc;
|
||||
return real(fd, level, option, value, len);
|
||||
}
|
||||
|
||||
struct monitor_netlink_header {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Zink keeps kopper when the session draws through Venus.
|
||||
*
|
||||
* On Mali the session reaches the GPU through Venus over vtest, and Xwayland has no DRM node to
|
||||
* build glamor on, so it offers no DRI3. Without DRI3, Zink can only present through kopper (its
|
||||
* Vulkan WSI path). Steam's steamwebhelper.sh exports LIBGL_KOPPER_DISABLE=true for the client
|
||||
* interface unconditionally, so on Mali every GL context the interface asked for failed and the
|
||||
* webhelper restarted until Steam gave up on GPU acceleration. Steam restores that script when
|
||||
* it verifies its install, so the variable is dropped here instead, before Mesa reads it.
|
||||
*/
|
||||
#define _GNU_SOURCE 1
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
__attribute__((constructor)) static void bl_venus_keep_kopper(void) {
|
||||
const char *debug = getenv("VN_DEBUG");
|
||||
if (debug && strstr(debug, "vtest")) unsetenv("LIBGL_KOPPER_DISABLE");
|
||||
}
|
||||
Reference in new issue
Block a user