summaryrefslogtreecommitdiff
path: root/libappfuse
AgeCommit message (Collapse)Author
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/coreBob Badour
Added SPDX-license-identifier-Apache-2.0 to: bootstat/Android.bp cli-test/Android.bp code_coverage/Android.bp cpio/Android.bp debuggerd/crasher/Android.bp debuggerd/proto/Android.bp diagnose_usb/Android.bp fs_mgr/libdm/Android.bp fs_mgr/libfiemap/Android.bp fs_mgr/liblp/Android.bp fs_mgr/libsnapshot/Android.bp fs_mgr/libstorage_literals/Android.bp fs_mgr/libvbmeta/Android.bp fs_mgr/tests/Android.bp fs_mgr/tools/Android.bp gatekeeperd/Android.bp healthd/Android.bp healthd/testdata/Android.bp init/Android.bp init/Android.mk init/sysprop/Android.bp init/test_kill_services/Android.bp init/test_service/Android.bp libappfuse/Android.bp libasyncio/Android.bp libbinderwrapper/Android.bp libcrypto_utils/Android.bp libcrypto_utils/tests/Android.bp libdiskconfig/Android.bp libgrallocusage/Android.bp libkeyutils/mini_keyctl/Android.bp libmodprobe/Android.bp libnetutils/Android.bp libpackagelistparser/Android.bp libprocessgroup/Android.bp libprocessgroup/cgrouprc/Android.bp libprocessgroup/cgrouprc_format/Android.bp libprocessgroup/profiles/Android.bp libprocessgroup/setup/Android.bp libqtaguid/Android.bp libsparse/Android.bp libstats/push_compat/Android.bp libsuspend/Android.bp libsync/Android.bp libsystem/Android.bp libsysutils/Android.bp libusbhost/Android.bp libutils/Android.bp libvndksupport/Android.bp libvndksupport/tests/Android.bp llkd/Android.bp llkd/tests/Android.bp property_service/libpropertyinfoparser/Android.bp property_service/libpropertyinfoserializer/Android.bp property_service/property_info_checker/Android.bp qemu_pipe/Android.bp reboot/Android.bp rootdir/Android.bp rootdir/Android.mk rootdir/avb/Android.bp rootdir/avb/Android.mk run-as/Android.bp sdcard/Android.bp set-verity-state/Android.bp shell_and_utilities/Android.bp storaged/Android.bp toolbox/Android.bp trusty/apploader/Android.bp trusty/confirmationui/Android.bp trusty/confirmationui/fuzz/Android.bp trusty/coverage/Android.bp trusty/fuzz/Android.bp trusty/fuzz/test/Android.bp trusty/gatekeeper/Android.bp trusty/gatekeeper/fuzz/Android.bp trusty/keymaster/Android.bp trusty/keymaster/fuzz/Android.bp trusty/libtrusty/Android.bp trusty/libtrusty/tipc-test/Android.bp trusty/secure_dpu/Android.bp trusty/storage/interface/Android.bp trusty/storage/lib/Android.bp trusty/storage/proxy/Android.bp trusty/storage/tests/Android.bp trusty/utils/spiproxyd/Android.bp trusty/utils/trusty-ut-ctrl/Android.bp usbd/Android.bp watchdogd/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: debuggerd/Android.bp fastboot/Android.bp libkeyutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT to: libcutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT to: fs_mgr/Android.bp fs_mgr/libfs_avb/Android.bp trusty/Android.bp trusty/utils/rpmb_dev/Android.bp Added SPDX-license-identifier-BSD to: fastboot/fuzzy_fastboot/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/core"Elliott Hughes
This reverts commit 187b7d19504ca8bdcbc6217c06a117017b4c6287. Reason for revert: system/core is multiple projects, not one. Change-Id: I790ea41741f8cd9b8b6db2f59a49e71fb0958fd6
2021-02-16[LSC] Add LOCAL_LICENSE_KINDS to system/coreBob Badour
Added SPDX-license-identifier-Apache-2.0 to: bootstat/Android.bp cli-test/Android.bp code_coverage/Android.bp cpio/Android.bp debuggerd/crasher/Android.bp debuggerd/proto/Android.bp diagnose_usb/Android.bp fs_mgr/libdm/Android.bp fs_mgr/libfiemap/Android.bp fs_mgr/liblp/Android.bp fs_mgr/libsnapshot/Android.bp fs_mgr/libstorage_literals/Android.bp fs_mgr/libvbmeta/Android.bp fs_mgr/tests/Android.bp fs_mgr/tools/Android.bp gatekeeperd/Android.bp healthd/Android.bp healthd/testdata/Android.bp init/Android.bp init/Android.mk init/sysprop/Android.bp init/test_kill_services/Android.bp init/test_service/Android.bp libappfuse/Android.bp libasyncio/Android.bp libbinderwrapper/Android.bp libcrypto_utils/Android.bp libcrypto_utils/tests/Android.bp libdiskconfig/Android.bp libgrallocusage/Android.bp libkeyutils/mini_keyctl/Android.bp libmodprobe/Android.bp libnetutils/Android.bp libpackagelistparser/Android.bp libprocessgroup/Android.bp libprocessgroup/cgrouprc/Android.bp libprocessgroup/cgrouprc_format/Android.bp libprocessgroup/profiles/Android.bp libprocessgroup/setup/Android.bp libqtaguid/Android.bp libsparse/Android.bp libstats/push_compat/Android.bp libsuspend/Android.bp libsync/Android.bp libsystem/Android.bp libsysutils/Android.bp libusbhost/Android.bp libutils/Android.bp libvndksupport/Android.bp libvndksupport/tests/Android.bp llkd/Android.bp llkd/tests/Android.bp property_service/libpropertyinfoparser/Android.bp property_service/libpropertyinfoserializer/Android.bp property_service/property_info_checker/Android.bp qemu_pipe/Android.bp reboot/Android.bp rootdir/Android.bp rootdir/Android.mk rootdir/avb/Android.bp rootdir/avb/Android.mk run-as/Android.bp sdcard/Android.bp set-verity-state/Android.bp shell_and_utilities/Android.bp storaged/Android.bp toolbox/Android.bp trusty/apploader/Android.bp trusty/confirmationui/Android.bp trusty/confirmationui/fuzz/Android.bp trusty/coverage/Android.bp trusty/fuzz/Android.bp trusty/fuzz/test/Android.bp trusty/gatekeeper/Android.bp trusty/gatekeeper/fuzz/Android.bp trusty/keymaster/Android.bp trusty/keymaster/fuzz/Android.bp trusty/libtrusty/Android.bp trusty/libtrusty/tipc-test/Android.bp trusty/secure_dpu/Android.bp trusty/storage/interface/Android.bp trusty/storage/lib/Android.bp trusty/storage/proxy/Android.bp trusty/storage/tests/Android.bp trusty/utils/spiproxyd/Android.bp trusty/utils/trusty-ut-ctrl/Android.bp usbd/Android.bp watchdogd/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: debuggerd/Android.bp fastboot/Android.bp libkeyutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT to: Android.bp libcutils/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT to: fs_mgr/Android.bp fs_mgr/libfs_avb/Android.bp trusty/utils/rpmb_dev/Android.bp Added SPDX-license-identifier-BSD to: fastboot/fuzzy_fastboot/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I5bd81adb5cdcf2b4dd4141b204eb430ff526af8f
2020-12-14Update for v5.10 kernel headers.Christopher Ferris
Test: Builds. Change-Id: I6c4b04751df026ef7cbb91627174188c5e6d137c
2020-02-18Fix Deadlock Issue On AppFuseBridgehyeeun.jun@samsung.com
There are two locks used by AppFuseBridge. First is it's object lock, and the second is a mutex lock in app fuse library. There are two oppsite routines to get those locks. (Thread A) Got Java lock -> Try to get Native lock (Thread B) Got Native lock -> Try to get Java lock Bug : https://issuetracker.google.com/issues/145707568 Signed-off-by: hyeeun.jun@samsung.com <hyeeun.jun@samsung.com> The order must be followed to obtain two locks. If not, the dead lock will be caused. Therefore we change the routine to get the mutex lock first, and the object lock later.
2019-05-31Merge "Close /dev/fuse FD before calling onClosed" into qt-devAnton Hansson
2019-05-31Close /dev/fuse FD before calling onClosedAnton Hansson
This works around a deadlock when a bridge that is about to be closed is reused for a new call to openFile. The call to open() ends up holding the vold lock, waiting for appfuse to respond. The appfuse event loop calls onClosed(), which ends up calling vold.unmountAppFuse(), which cannot get the lock. Closing this file descriptor causes any current calls to open() on its mount path to fail with either ECONNABORTED or ENOTCONN, allowing the event loop to make progress, call onClosed() and unmount the path. Note that the failed call to open() will result in a retry, which will create a new appfuse bridge. This is not ideal but not a new problem -- the common case here is that that each call to openProxyFileDescriptor creates a new bridge. This should ideally be improved. Bug: 132344997 Test: flick through info of photos with location info attached Exempt-From-Owner-Approval: verbal approval of approach Change-Id: I878e5cf86f18c5233f8505f52eb9db076bd72d01
2019-05-31Fix BridgeEpollController to handles EAGAIN correctlyDaichi Hirono
When reading/writing proxy FD, if it returns EAGAIN, BridgeEpollController updates epoll entries to observe specific FD events. Before updating epoll entries, BridgeEpollController checks if it really needs to update by comparing |state_| and |last_state_|. |last_state_| has not been updated correctly so it resulted in wrong epoll settings and keeps blocking the event loop. Bug: 134104939 Test: atest libappfuse_test Change-Id: I1c4a0164c1c016baf24ecfd523476ced981d3b28
2018-12-17use epoll_create1(EPOLL_CLOEXEC)Nick Kralevich
epoll_create(0) leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC) instead. Bug: 120983106 Test: compiles and boots Change-Id: I2a733d4482d6a74ceb3254e501cdb5f6de0cd5dc
2018-03-15Stop using SO_SNDBUFFORCERyo Hashimoto
Use SO_SNDBUF which doesn't require CAP_NET_ADMIN instead. Change the value of kFuseMaxWrite to 128KB. In the kernel code, there is a constant FUSE_MAX_PAGES_PER_REQ which limits the size of requests to 128KB. Bug: 74725300 Test: atest android.os.storage.cts.StorageManagerTest Change-Id: Ic3a8f1a7378d027a6c0ee054cedc2c9f4b7509ad
2018-02-16bpfmt.Elliott Hughes
Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2017-12-07Merge "Add OWNERS."Elliott Hughes
2017-12-07Add OWNERS.Elliott Hughes
Bug: N/A Test: N/A Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-07-25Merge "Remove LOCAL_CLANG and clang: true" am: 80ec81cf4b am: f7b315c985 am: ↵Lennart Wieboldt
8a8b97b271 am: e1332dd01b Change-Id: I193d86abf96e64b29efc7266f4fa3a26b5d2b3af
2017-07-25Merge "Remove LOCAL_CLANG and clang: true" am: 80ec81cf4b am: f7b315c985Lennart Wieboldt
am: 8a8b97b271 Change-Id: I7e691abe2e2ccec5d9477c528d603c081c0a5661
2017-07-25Merge "Remove LOCAL_CLANG and clang: true"Lennart Wieboldt
am: 80ec81cf4b Change-Id: Ia7f79d8e25ee9870fe44d198568d0e5dabdff811
2017-07-25Remove LOCAL_CLANG and clang: trueLennart Wieboldt
clang is the default compiler since Android nougat Test: mma & verified it´s still build with clang Change-Id: I34adaeef2f6558a09f26027271222bad94780507 Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-07-14Remove ScopedLogSeverity for debuggingDaichi Hirono
The ScopedLogSeverity was added to observe APCT failures, which turned out to be a compiler optimization error. Bug: 62429763 Test: None Change-Id: Ibb45d018d8eaf4b29cb417da80ae5f0b000dda8e
2017-06-23Add volatile to temporary variable.Daichi Hirono
FuseBuffer::HandleNotImpl save the value of |request.header.unique| to the temporary variable, clear the buffer which is a union of |request| and |response|, then write back the unique value to response.header.unique. Before the CL, the temporary variable was wrongly removed by the compiler optimization, and response.header.unique was always 0. The CL adds volatile modifier as workaround to prevent the compiler optimization from removing the temporary value. Bug: 62429763 Test: libappfuse_tests Change-Id: Ia853f805633f646f316f585a35c7b018000b6eb3 (cherry picked from commit a6dee5e279de56751238f750d12f8a6237992043)
2017-06-23Add volatile to temporary variable.Daichi Hirono
FuseBuffer::HandleNotImpl save the value of |request.header.unique| to the temporary variable, clear the buffer which is a union of |request| and |response|, then write back the unique value to response.header.unique. Before the CL, the temporary variable was wrongly removed by the compiler optimization, and response.header.unique was always 0. The CL adds volatile modifier as workaround to prevent the compiler optimization from removing the temporary value. Bug: 62429763 Test: libappfuse_tests Change-Id: Ia853f805633f646f316f585a35c7b018000b6eb3
2017-06-20Skip FUSE request from /dev/fuse if unique=0Daichi Hirono
APCT log shows that we got FUSE request unique=0 and replying to such request causes a EINVAL. The possible reasons of getting unique=0 here are: * /dev/fuse actually submits such requests. In this case, not replying to such request probabbly safe as the kernel cannot wait corresponding response without a unique number. We can observing the kernel code to find out what unique=0 actually means. * Memory corruption happens and unique number are cleared with zero. In this case, if we skip unique=0 request, libappfuse does not reply to the kernel request and APCT result will become timeout . To see which case happens, the CL ScopedLogSeverity to output verbose logs and lets FuseBridgeLoop skip a request from /dev/fuse if unique=0. Bug: 62429763 Test: libappfuse_tests Change-Id: I8c4d532564b690d55573b92260170b0cd68150ab
2017-06-12Add more logs for writing failures.Daichi Hirono
Bug: 62429763 Test: libappfuse_test Change-Id: Ie0eabd09ae9ad3f8ba8c4f38f871dad16b5c58ff
2017-05-17Merge "Change the CHECK failure into function failure." into oc-devDaichi Hirono
am: bf6e949727 Change-Id: Ic374fc076cc9584c375618a57371669c23aff539
2017-05-17Merge "Use SO_SNDBUFFORCE instead of SO_SNDBUF" into oc-devDaichi Hirono
am: 165dad791d Change-Id: I2da13af0ff1e4a50259847fd57695c3d616e59cc
2017-05-17Merge "Change the CHECK failure into function failure." into oc-devTreeHugger Robot
2017-05-17Change the CHECK failure into function failure.Daichi Hirono
Previously we have CHECK in WriteInternal function to observe short writing. However it turns out short write can happen according to the bug report. To prevent app from crashing due to CHECK failure, the CL removes the CHECK and let WriteInternal return a failure value. Bug: 37561460 Test: libappfuse_tests, manually re-wrote the return value of write() and checked logcat. Change-Id: I6a1e233c3ddb8eb68f59e7c606ad0459b5ca2c6e
2017-04-28Use SO_SNDBUFFORCE instead of SO_SNDBUFDaichi Hirono
When /proc/sys/net/core/wmem_max is smaller than kMaxMessageSize, we need to override the limitation. Bug: 37561460 Test: libappfuse_tests Change-Id: Ibaac8db61290d661459fdc46f0ae8416f7db1d9e
2017-04-05Merge "Add test config to libappfuse_test" am: dccf5a1dc8 am: 31d4b50cc4Dan Shi
am: b44505e956 Change-Id: Iefe160951c3f638faee7e8e1f1ff63ed9133325c
2017-03-31Add test config to libappfuse_testDan Shi
This change allows TradeFederation to run the test directly. Refer to b/35882476 for design and discussion of this change. Bug: 35882476 Test: local test tradefed.sh run template/local --template:map test=libappfuse_test Change-Id: Ic3a23d9d609036658fd37fc72571e2fc7db0e88d
2017-03-31Retry write operation when getting ENOBUFS.Daichi Hirono
Previously libappfuse set SO_SNDBUF to the maximum message size. However it does not prevent ENOBUF and it made AppFusePerfTest#testReadWriteFile flaky. The CL let FuseBuffer retry write operation when getting ENOBUFS. Bug: 34903085 Test: libappfuse Change-Id: I1602474d852e1599f6e69103bcf6f18277a5644b
2017-03-29Change FuseAppLoop so that it can process messages asynchronously.Daichi Hirono
Previously FuseAppLoopCallback needs to return values in a synchrnous manner. The CL changes it to asynchronous mannger so that apps can process FUSE message asynchrnously. Bug: 35229514 Test: FuseAppLoopTest Change-Id: I8edcfdb003a25cfd5e9c490ec871140220b21e35 (cherry picked from commit f5d15f9fc4b8bd7a866660fe208bf857dea839ba)
2017-03-23Enable FuseBridgeLoop to accept new mount point after startingDaichi Hirono
The CL turns StartFuseBridgeLoop function into FuseBridgeLoop class, and adds a method adding new appfuse mount to the loop. After doing this, one FuseBridgeLoop can process FUSE commands from multiple AppFuse mounts. Bug: 34903085 Test: libappfuse_test Change-Id: I54f11f54bc26c551281b9c32e9bb91f8f043774c
2017-03-23Add FuseMessage::WriteWithBody functionDaichi Hirono
The funciton is going to be used to write FUSE header with external body. Bug: 35229514 Test: libappfuse_tests Change-Id: I303022b555deca960b8e08f26140a5ef10133efe
2017-03-15Add new EpollController class.Daichi Hirono
The class is a thin wrapper for C epoll functions. Bug: 34903085 Test: Build EpollController.cc and libappfuse_test after applying future changes locally. Change-Id: Iedce7f35e4397f80cde1054d53261ad94f9e58a8
2017-03-14Add ReadOrAgain and WriteOrAgain methods to FuseMessage.Daichi Hirono
These methods return kAgain if operation cannot be done without blocking the current thread. The CL also introduecs new helper function SetupMessageSockets so that FuseMessages are always transfered via sockets that save message boundaries. Bug: 34903085 Test: libappfuse_test Change-Id: I34544372cc1b0c7bc9622e581ae16c018a123fa9
2017-02-08Add permission bits to open() with O_CREAT.George Burgess IV
It's an error to pass open O_CREAT without giving it mode bits: https://linux.die.net/man/3/open Bug: 32073964 Test: Compiles with clang FORTIFY. Change-Id: I6b2a3694f85565afdeb782585c6af36e8c4d1557
2016-12-12Support SOCK_STREAM for bridge between system and appDaichi Hirono
Previously AppFuse use SOCK_SEQPACKET for sockets communicating system and app. However SOCK_SEQPACKET requires the buffer of message size in the kernel and sometimes failed to write with ENOBUF. The CL updates libappfuse so that it can use SOCK_STREAM instead of SOCK_SEQPACKET. Bug: 33279206 Test: libappfuse_test Change-Id: I622ada9ac1d71d0c57b6cfff0904c7829cea7995
2016-12-12Fix checks for reading and writing FuseMessage.Daichi Hirono
Previously FuseMessage were checking result of read/write operation after checking header.len value is valid. This was wrong because header.len does not contain correct value when read function does not read any bytes and returns zero. Bug: 33278098 Test: libappfuse_test Change-Id: Icf998ca6c3eeee20cbc4aa2f65195a87e59ffc27
2016-11-17Remove FuseBridgeLoop class.Daichi Hirono
Bug: 32779923 Test: libappfuse_test Change-Id: I29a76701d141ae061ec1fe32993d27460a0c694a
2016-11-17Stops the loop when all files are closed.Daichi Hirono
The CL changes FuseBridgeLoop so that it exits when all files opened on the AppFuse mount point are closed. Note that the client code will unmount the FUSE mount point after the loop exits. Bug: 32260320 Test: libappfuse_test Change-Id: I4965fbb48de8a280c6306e70757a07376b1956a7
2016-11-16Merge "Use FUSE_COMPAT_22_INIT_OUT_SIZE always if available."Treehugger Robot
2016-11-16Use FUSE_COMPAT_22_INIT_OUT_SIZE always if available.Daichi Hirono
We return the minor version number 15 to FUSE_INIT since we don't handle BATCH_FORGET. Thus the kernel does not accept the latest size of fuse_init_out. Instead we need to use FUSE_COMPAT_22_INIT_OUT_SIZE. Bug: 32779923 Test: libappfuse_test Change-Id: I5c979d0e45344ca8adfe3ad3f4a9561442abcb3a
2016-11-15Add static assert to check if FuseBuffer is standard layout union.Daichi Hirono
Bug: 32260320 Test: libappfuse_test Change-Id: I6430c11fdeb2405996410c97044b4260c25209b8
2016-11-15Add FuseAppLoop to libappfuse.Daichi Hirono
The class is used at the app side (StorageManager) to parse FUSE commands. Bug: 32260320 Test: libappfuse_test Change-Id: I1ae2904d3290a041f1efbf8fc10ba032eda5449c
2016-10-27Add FuseBridgeLoop to libappfuse.Daichi Hirono
The CL adds FuseBridgeLoop class to libappfuse, which is used in the system service to proxy fuse commands to applications. Bug: 29970149 Test: libappfuse_test Change-Id: I0708f608b3868721ab16ba4028fd2c17a6735af7
2016-10-27Add utility functions for FUSE.Daichi Hirono
The CL adds utility functions to framework to parse FUSE messages from the kernel. The library will be used from framework JNI and service JNI. Bug: 32260320 Test: libappfuse_test Change-Id: Ib89b26d34789e6c26a3288beceb3ea145c1ae780