Repository navigation
server: release guard crash charge on stopped devices and clamp protectedMemory - #101
Open
ExecuteOrd66 wants to merge 2 commits into
Open
ExecuteOrd66 wants to merge 2 commits into
ExecuteOrd66 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two correctness and stability fixes in the bridge server:
Release crash-containment charge when stopped or retained devices are abandoned (
server_guard.c,server_conn.c,server_instance.c)server_guard.ccharges each contained driver fault to its device (charged[t->id]) and subtracts it fromprocess_crashesinvkb_guard_device_destroy(), so thatPROCESS_MAX(64) limits faults from currently running programs rather than accumulating over the server's lifetime.vkb_lost_stop) or kept alive due to an active sync-fd export (vkb_syncfd_device_destroy), the teardown paths invkb_proc_cleanup(),vkb_srv_instance_orphans(), andvkb_sv_vkDestroyDevice()skipdevice_cleanup()/vkb_guard_device_destroy()so the unsafe device handle is never touched again.continue,charged[t->id]was never refunded when a short-lived faulting client exited, allowing repeated restarts to monotonically exhaustPROCESS_MAXand disable containment for the whole bridge server.__atomic_exchange_n(&charged[t->id], 0, __ATOMIC_RELAXED)) intovkb_guard_device_release_charge(vkb_srv_table *t)and invoke it on those early-return /continuepaths (always outsidetables_lock, without touching driver handles or freeing guard state) as well as fromvkb_guard_device_destroy().Hide and clamp
protectedMemoryover the bridge (server_emu.c)VkPhysicalDeviceProtectedMemoryFeatures::protectedMemory(orVkPhysicalDeviceVulkan11Features::protectedMemory) invkCreateDevicecan cause mobile Vulkan drivers to fail to initialize or omit standard (flags = 0) queues, resulting in aNULLqueue handle andSIGSEGVinside the Android Vulkan loader onvkGetDeviceQueue.protectedMemory = VK_FALSEinvkb_emu_report_features2()and clear it toVK_FALSEinvkb_emu_device_clamp_features()beforevkCreateDevicereaches the driver.Verification
libvkbridge_server.soandlibvkbridge_jni.soforarm64-v8awith Android NDK r27c (clean build, zero warnings).vkGetDeviceQueuefaults drop to 0 and the bridge server stays alive without exhaustingPROCESS_MAX.