Clang static analyzer worries that strcpy to a field may overwrites
other fields. Use snprintf() instead.
Test: built without seeing the warning.
Change-Id: I75d8edf1353b5d052fd14a954362bd0632c258fa
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>
Sdcardfs has been modified to use bind mounts
in place of three separate mounts. This lowers
resource usage, and removes a number of race
conditions around updates via differnt views.
Test: Run storage cts tests with sdcardfs enabled
Change-Id: Icdc196ba3d6f46d54d27ef91c01ffebcf81dd47e
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.
Previously the code unintentionally used FUSE_COMPAT_22_INIT_OUT_SIZE always
because we override the minor version out->minor to 15. Because sdcard.c shares
the buffer for |in| and |out|, it overrides the version number of in->minnor as
well.
The if closure in the previous code "if (in->minor <= 22)" was always true. The
CL removes the if closure to explicitly use FUSE_COMPAT_22_INIT_OUT_SIZE always.
Bug: 32779923
Test: Manually boot Android and check if the storage shows up in Settings app.
Change-Id: Ibbc50da7fb82be148acfc5f1a3d46fefbe211f9d
- Add TEMP_FAILURE_RETRY around all relevant system calls.
- Cleanup some of the read calls.
- Add error log messages when read/write calls do not actually read/write the
expected number of bytes.
- Add error messages for write failures in fuse_status/fuse_replay.
Test: Attached to the sdcard process and stepped through most of the modified
Test: code. Also, create/read/write/delete files in /storage/emulated/0
Test: directory.
Change-Id: I73e4c0db861960f4c0af1bf96b06cd61fa74be69
A few changes got dropped along merge resolution. This adds them back
Affected CLs:
Ie188cb044be2ad87166f2d43c32a1f6b97660de0
Ibdb72ad16a1e6c3a01edcb03d003c42de7a03cd6
Change-Id: I1924f5a4bd7564ceaf9bb3a45b7fb7804b3619d7
Use a non yet maintainer reviewed kernel patch from QCOM that greatly
improves IO speed in case it is available from the device specific
kernel headers.
Bug: 24216004
Bug: 30222859
Change-Id: I4101d80082c9ad9d042dde5c620ddb309d193d52
"PRI{u,x}64" was not compiling on C++ because of macro expansions.
Implement DLOG the same way DCHECK is implemented in
<android-base/logging.h>, and mechanically replace the problematic
lines with C++ logging. Remaining TRACE() lines will be replaced in a
follow-up CL.
Bug: 30222003
Change-Id: I377a91722eb4c035093fc96b79438c4f638b9a45
Having CaseInsensitiveCompare use strcasecomp is not ideal, but other
solutions are not prettier.
Also, add a TODO to fix FUSE_TRACE, broken by the switch to C++.
Bug: 27147273
Change-Id: I0017c3a7d0254eb81abd128b97cd06c5ad0d1dff
Having so many copies of privilege-dropping code leads to errors.
De-duplicate this code and use Minijail for it.
Bug: 30156807
Change-Id: I36c85962b913a12efe5648a23cbacc5bcbb3853c
This gets rid of a bunch of "strerror(errno)" bits.
Will convert fuse.cpp after
https://android-review.googlesource.com/#/c/247780 lands.
Bug: 30110940
Change-Id: Iacefe5b6519b217ed687c709763fe5827b3b0b59
Fix string literals and cast void* appropriately. Alternatively, we
could switch some of the allocations to new/delete, but we would need
to make sure that none of those end up passed to other code that will
call free(3) on them.
Bug: 30110940
Change-Id: I6f39df65cd960930530e5a1f8420a28d50adc25d
sdcard.c is a *really* big file. This makes it hard to do things like
improving priv dropping or adding more sandboxing. Extract all
FUSE-related code to a separate unit, fuse.{h|c}, which exports only
two functions. Convert the rest of sdcard.c to C++ as sdcard.cpp.
fuse.c is kept as C (at least for now) since interacting with the FUSE
API is realistically easier from C.
Bug: 30110940
Change-Id: I188bfdc21c184742117e07539adb09090d4d747c
The previous false positive fix (df9c4a01) is enough to pass tests, and
it doesn't appear that there are any remaining issues.
Change-Id: Ib9812f1201ff0cd2ae8c8371737754fc328765b5
This allows inotify requests on FUSE to be alerted when any
other stacked filesystem would trigger an inotify for the
same file.
Bug: 23904372
Change-Id: I4289b38230c314432eaf2c0d20d4ccefc058f59e
An incorrect size was causing an unsigned value
to wrap, causing it to write past the end of
the buffer.
Bug: 28085658
Change-Id: Ie9625c729cca024d514ba2880ff97209d435a165
am: 20ca983
* commit '20ca9836b9a780c41a22850f478a29f29677553e':
Give users and devices control over sdcardfs.
Change-Id: I0144b346157952f79fdde5100f0fdc01daa58d9b
Instead of relying only on kernel support for sdcardfs, give each
device the ability to quickly toggle between sdcardfs and FUSE. Also
add the ability to users to explicitly enable/disable the behavior
for testing and debugging purposes.
Bug: 27991427
Change-Id: Ie188cb044be2ad87166f2d43c32a1f6b97660de0
Add ability to use sdcardfs if kernel support is found.
In the future, we will likely remove the fuse components
entirely, but for now, just use sdcardfs when possible.
Bug: 19160983
Change-Id: I35e4d6cb5976c00c6f87ff7fc478ba9f9d212c05
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Use a non yet maintainer reviewed kernel patch from QCOM that greatly
improves IO speed in case it is available from the device specific
kernel headers.
Bug: 24216004
Change-Id: I4101d80082c9ad9d042dde5c620ddb309d193d52
When packages change, existing package-specific directories may have
gained/lost a UID mapping, so we need to update the permissions for
any in-memory nodes.
This allows an app to deliver data for another package before that
package is installed, which is the typical pattern of how OBB files
are delivered.
Also fix bug by re-deriving permissions when files are moved.
Bug: 25399427
Change-Id: I06f38a24ad7dee5f5099ba81429aef03208e5683