From: ivanmeler Date: Wed, 9 Feb 2022 09:40:03 +0000 (+0000) Subject: Disable fdsan for camera using wrapper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9be6958262546561ae7d2dfd7392692eb7e3c1ac;p=GitHub%2Fexynos8895%2Fandroid_device_samsung_universal8895-common.git Disable fdsan for camera using wrapper We had issues with fdsan and camera for a long time now, previous workaround was to remove fd close from libexynoscamera3 but that solution wasnt perfect as fd's would add up and once there were too many (around 20 min into video recording/video call/just having camera preview open) it would stop working untill we restart cameraserver or device, this really isnt perfect in world where video calls are neccesary So now using a wrapper we disable fdsan and that it turn disables checks on libexynoscamera3. This works because way we load camera goes something like this (simplified) cameraserver -> camera-impl/provider -> camera wrapper (camera.exynos5) -> camera.vendor.exynos5 -> libexynoscamera3 And fdsan dissabled gets passed by to libexynoscamera3 from this wrapper *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/hero2ltexx/hero2lte:8.0.0/R16NW/G935FXXU2ERD5:user/release-keys' Revision: '0' ABI: 'arm' Timestamp: 2022-02-09 08:57:48.238455176+0100 Process uptime: 0s Cmdline: /vendor/bin/hw/vendor.samsung.hardware.camera.provider@2.4-service pid: 3672, tid: 8081, name: putBufferThread >>> /vendor/bin/hw/vendor.samsung.hardware.camera.provider@2.4-service <<< uid: 1047 signal 35 (), code -1 (SI_QUEUE), fault addr -------- Abort message: 'attempted to close file descriptor 90, expected to be unowned, actually owned by unique_fd 0xedd16514' r0 00000000 r1 00001f91 r2 00000023 r3 e5ea15c8 r4 e5ea15c8 r5 00000e58 r6 e5ea15dc r7 0000016b r8 e5ea13c0 r9 ee490138 r10 00000014 r11 0000005a ip 00001f91 sp e5ea13b8 lr ee43b165 pc ee43b178 backtrace: 00 pc 0003b178 /apex/com.android.runtime/lib/bionic/libc.so (fdsan_error(char const*, ...)+256) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0) 01 pc 0003af23 /apex/com.android.runtime/lib/bionic/libc.so (android_fdsan_close_with_tag+482) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0) 02 pc 0003b5a3 /apex/com.android.runtime/lib/bionic/libc.so (close+6) (BuildId: d59fbfecb49aca653dd2461fc94ec0e0) 03 pc 00073edf /system/vendor/lib/libexynoscamera3.so (android::sp::operator=(android::Fence*)+58) (BuildId: 5b3a513f7a0544d5e9c5725337e71346) 04 pc 00073feb /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraFence::~ExynosCameraFence()+26) (BuildId: 5b3a513f7a0544d5e9c5725337e71346) 05 pc 00074087 /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraFence::~ExynosCameraFence()+2) (BuildId: 5b3a513f7a0544d5e9c5725337e71346) 06 pc 00074ba7 /system/vendor/lib/libexynoscamera3.so (android::ServiceExynosCameraBufferManager::m_getBuffer(int*, int*, int*)+274) (BuildId: 5b3a513f7a0544d5e9c5725337e71346) 07 pc 000719e3 /system/vendor/lib/libexynoscamera3.so (android::ExynosCameraBufferManager::getBuffer(int*, android::EXYNOS_CAMERA_BUFFER_POSITION, android::ExynosCameraBuffer*)+62) (BuildId: 5b3a513f7a0544d5e9c5725337e71346) --- diff --git a/hardware/camera/Camera2Wrapper.cpp b/hardware/camera/Camera2Wrapper.cpp index 1217c89..39522e3 100644 --- a/hardware/camera/Camera2Wrapper.cpp +++ b/hardware/camera/Camera2Wrapper.cpp @@ -18,6 +18,7 @@ #define LOG_PARAMETERS #define LOG_TAG "Camera2Wrapper" +#include #include #include @@ -60,6 +61,7 @@ static camera_module_t *gVendorModule = 0; static int check_vendor_module() { + android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); int rv = 0; ALOGV("%s", __FUNCTION__); diff --git a/hardware/camera/Camera3Wrapper.cpp b/hardware/camera/Camera3Wrapper.cpp index 1478460..9683e32 100644 --- a/hardware/camera/Camera3Wrapper.cpp +++ b/hardware/camera/Camera3Wrapper.cpp @@ -17,6 +17,7 @@ #define LOG_NDEBUG 1 #define LOG_TAG "Camera3Wrapper" +#include #include #include "CameraWrapper.h" @@ -39,6 +40,7 @@ static camera_module_t *gVendorModule = 0; static int check_vendor_module() { + android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); int rv = 0; ALOGV("%s", __FUNCTION__); diff --git a/hardware/camera/CameraWrapper.cpp b/hardware/camera/CameraWrapper.cpp index cb969ff..5612c71 100644 --- a/hardware/camera/CameraWrapper.cpp +++ b/hardware/camera/CameraWrapper.cpp @@ -18,6 +18,7 @@ #define LOG_PARAMETERS #define LOG_TAG "CameraWrapper" +#include #include #include "CameraWrapper.h" @@ -39,6 +40,7 @@ static int camera_init(); static int check_vendor_module() { + android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); int rv = 0; ALOGV("%s", __FUNCTION__);