Commit Graph

4 Commits

Author SHA1 Message Date
Victor Hsieh 045f1e66ff Introduce authfs_service
authfs_service serves as a privileged process in order to facilitate
authfs mounting (which is a privileged operation) for the client.

Once the service exists on microdroid, we will re-architect compsvc to
get the FD from authfs_service.

Code review hints:
 - authfs.rs is a modified copy from compos/src/authfs.rs. The original
   file should later be deleted as part of the re-architecturing.
 - The implementation intends to tie the lifecycle of an authfs
   instance/process/mount to the IAuthFs object, and clean up on the
   Rust object's drop.

Bug: 194717985
Test: 1. Start an fd_server with some files opened for read and write
      2. Start authfs_service
      3. Write a binder client with proper AuthFsConfig to get an
         IAuthFs from authfs_service. Let the client retrieves the FDs
         and copy from one remote FD to the other.
      4. Observe the file copy is correct.

Change-Id: Ia9979ee8d23f87bc33e2b670e135f63fee016426
2021-08-06 08:46:44 -07:00
Victor Hsieh 9d0ab6267c authfs: support resizing file
There are three major changes:
1. Add resize() to MerkleLeaves as the simple hash container.
2. Handle resize for a writable file. The special case is that the hash
   of the new last chunk can change, and the only way to calculate is to
   read the original data back.
3. Handle the size change in FUSE.

Bug: 186265793
Test: atest
Test: dex2oat succeeds (with more local changes)

Change-Id: I1ec20b6f0c69fd3ec24a6d04fc34583962265479
2021-04-27 09:44:35 -07:00
Victor Hsieh 60acfd310c authfs: Remote file editor over binder
The remote editor allows to read/write from/to a remote file. This
change:
 - Adds new binder API `writeFile`.
 - Update fd_server to serve a read/writable fd. Read operation is done
   through the existing read API when applicable.
 - Adds `RemoteFileEditor` as a binder client for both read and write.

Bug: 171279640
Test: adb shell exec 9<>/data/local/tmp/output fd_server --rw-fds 9
Test: with changes in fusefs.rs, saw file changed correctly (md5sum)

Change-Id: I78ef198ee8a3a0f2d99717dc0c00fccde757f3de
2021-03-18 11:57:21 -07:00
Victor Hsieh 42cc776daf authfs: fd_server to expose local FD via binder interface
fd_server provides a binder service (currently local binder since remote
binder is not ready). The server starts with FDs specified in the
command line flags (and supposedly opened FDs passed from the parent
process).

fd_server is supposed to run in Android to provide backing file to
authfs.

Test: # Start the server to serve the file. Read from the client.
      adb shell 'exec
      9</system/bin/sh
      8</data/local/tmp/input.4m
      7</data/local/tmp/input.4m.merkle_dump
      6</data/local/tmp/input.4m.fsv_sig
      fd_server --ro-fds 9 --ro-fds 8:7:6'`
Bug: 171280169
Change-Id: Ide68f23d7177b726ffd48ef960276bd8cf5e5846
2021-02-25 09:37:47 -08:00