Commit graph

60938 commits

Author SHA1 Message Date
Martijn Coenen
4ff6531bc5 Merge changes from topic "fusectl" into rvc-dev am: 6030f2f016
Change-Id: I4888400ae48f4061e938832f49c8d1e453798244
2020-05-29 14:54:54 +00:00
Martijn Coenen
6030f2f016 Merge changes from topic "fusectl" into rvc-dev
* changes:
  Abort FUSE filesystems during shutdown.
  Abort FUSE filesystem when Zygote restarts.
  Mount fusectl filesystem.
2020-05-29 14:41:20 +00:00
Christopher Ferris
4f82ed57bd [automerger skipped] Fail explicitly on length overflow. am: bff51b88aa -s ours
am skip reason: Change-Id Ie49975b8949fd12bbde14346ec9bbb774ef88a51 with SHA-1 68604b9c29 is in history

Change-Id: I7eaaa53f408d2c1b2e7ea4c85b55c32e3361ad9e
2020-05-29 00:57:53 +00:00
Christopher Ferris
bff51b88aa Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29)
2020-05-28 15:46:51 -07:00
TreeHugger Robot
a913d2648c [automerger skipped] Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" into rvc-dev am: 87ee2378de -s ours
am skip reason: Change-Id I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c with SHA-1 a2cc1ebb72 is in history

Change-Id: Ib85cadc0fc64c4d4635202468c8f01fe2047bdc1
2020-05-28 17:28:39 +00:00
Martijn Coenen
860ba64393 Abort FUSE filesystems during shutdown.
To ensure we can shutdown cleanly, and don't hang an outstanding
requests to a FUSE host daemon that has already exited.

Bug: 153411204
Test: inspect logs during shutdown
Change-Id: I8e6479bd54dbc1fc85b087617aa6b16be9f15a3b
2020-05-28 19:11:07 +02:00
Martijn Coenen
dd0440f4e5 Abort FUSE filesystem when Zygote restarts.
The FUSE filesystem is implemented by a Zygote child. If Zygote dies,
all of its children die along with it, including the FUSE daemon. The
FUSE filesystem is cleaned up automatically whenever the /dev/fuse file
descriptor of the FUSE daemon is closed. However, due to the way the
binder driver holds on to the 'struct files' of processes in the kernel,
the closing of FDs of all of Zygote's children is serialized.

That in turn means that, if a process has a file with dirty pages on
FUSE, and that FD is closed *before* the FUSE FD, the FUSE kernel driver
will happily issue a request to the FUSE daemon to serve that request.
But since the FUSE userspace daemon is already dead, it will never get
served. And because the closing of all FDs is serialized, we will never
close the FUSE fd to unblock this request.

Solve this particular case by manually aborting the FUSE filesystem when
Zygote restarts. Because we now explicitly close the FUSE fd, the FUSE
filesystem will be cleaned up, all outstanding requests to it will be
cancelled, and new ones will be skipped.

Bug: 153411204
Test: kill zygote manually
Change-Id: I2cb6c1a03cc1a932461ff33558894a428ff35180
2020-05-28 19:11:01 +02:00
TreeHugger Robot
87ee2378de Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" into rvc-dev 2020-05-28 17:05:49 +00:00
Tom Cherry
4644c78ffe Merge changes I5cf0d014,Ib46f0646 am: 609630e7ba am: d090042c44
Change-Id: I552b8b216c2918826053657dac1c6a6786ede3e6
2020-05-28 15:35:36 +00:00
Elliott Hughes
bd81e6f1d5 Merge "Make systemTime() abort on bad input." am: 49cd73754e am: 9e4815691d
Change-Id: Ie0670256eb5afcf4be34c0aa5ad8db2c12e93ca6
2020-05-28 15:35:26 +00:00
Tom Cherry
d090042c44 Merge changes I5cf0d014,Ib46f0646 am: 609630e7ba
Change-Id: I66754d24b58cde35284b4e0b0621e3f40b587948
2020-05-28 15:29:37 +00:00
Tom Cherry
609630e7ba Merge changes I5cf0d014,Ib46f0646
* changes:
  logd: remove LogBufferElement dependency of LogReaderThread
  logd: rename FlushToResult to FilterResult
2020-05-28 15:25:20 +00:00
Elliott Hughes
9e4815691d Merge "Make systemTime() abort on bad input." am: 49cd73754e
Change-Id: If0fe073f61a54a04abf8bb8f8d6a71bbaad204c4
2020-05-28 15:24:36 +00:00
Elliott Hughes
49cd73754e Merge "Make systemTime() abort on bad input." 2020-05-28 15:11:20 +00:00
Martijn Coenen
959dcf106d Mount fusectl filesystem.
To allow us to manually abort FUSE filesystems.

Bug: 153411204
Test: inspect /sys/fs/fuse/
Change-Id: I150597635d62932aa70ee696b4d978c822e6ea8d
2020-05-28 16:25:45 +02:00
Alistair Delva
e25f3d349a Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" am: 510d2437b4 am: f19c48f85f
Change-Id: I88a1fec9407fbdb9c175aaa0b35fd5e6dbc69519
2020-05-28 00:31:39 +00:00
Alistair Delva
f19c48f85f Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" am: 510d2437b4
Change-Id: Ic6737e2aaf9fc1309d4e5bd20e92378037686228
2020-05-28 00:19:05 +00:00
Alistair Delva
c631f94c77 Add ro.boot.fstab_suffix and modify mount_all to use it
Currently the ReadDefaultFstab function, which calls GetFstabPath,
makes some assumptions about what the fstab will be called and where
it is located. This is being used by vold to set up userdata encryption
and for gsid, and is even used in the default boot control HAL, so it
has become quite baked.

The original way for a board to specify things to mount was to use the
"mount_all /path/to/fstab" command in init.rc. However, due to the
above functionality, the path after mount_all is no longer very useful,
as it cannot differ from the inferred path, or userdata encryption and
other features will be broken.

On Cuttlefish, we have an interest in being able to test alternative
userdata configurations (ext4 vs f2fs, encryption on/off, etc.) and
currently the only way to achieve this is to either a) modify the
ro.hardware or ro.hardware.platform properties, which breaks a bunch
of things like default HAL filenames, or regenerate our odm.img or
vendor.img filesystems. We can't simply install another fstab and
point to it with "mount_all".

This change allows the fstab path to be omitted from "mount_all", and
adds another property which overrides the existing checks for
fstab.${ro.hardware} and fstab.${ro.hardware.platform}. Specifying
${ro.boot.fstab_suffix} will cause fstab.${ro.boot.fstab_suffix}
to be checked first.

Bug: 142424832
Test: booted cuttlefish with 'mount_all ${ro.hardware} --late'
Test: booted cuttlefish with 'mount_all --late'
Test: booted cuttlefish with 'mount_all --late' and fstab_suffix=f2fs
Test: partially booted cuttlefish with 'mount_all ${ro.hardware}'
Test: partially booted cuttlefish with 'mount_all'
Change-Id: I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c
Merged-In: I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c
2020-05-28 00:07:05 +00:00
Alistair Delva
510d2437b4 Merge "Add ro.boot.fstab_suffix and modify mount_all to use it" 2020-05-28 00:04:02 +00:00
Elliott Hughes
842e1cc17e Make systemTime() abort on bad input.
There's no CHECK in libutils, sadly.

Bug: http://b/157167405
Test: treehugger
Change-Id: I1532bf80ba7fdafad016610be3c782b547417126
2020-05-27 15:31:55 -07:00
Tom Cherry
70fadea36f logd: remove LogBufferElement dependency of LogReaderThread
In the future, not all log buffers will be implemented in terms of
LogBufferElement.

Test: build
Change-Id: I5cf0d01414857b1bfa08c92a4f8035b43ef2aad7
2020-05-27 15:13:52 -07:00
Tom Cherry
3e61a1368a logd: rename FlushToResult to FilterResult
This was a typo; the enum corresponds to the result of the 'Filter'
function, not the 'FlushTo' function.

Test: build
Change-Id: Ib46f0646570b6dbaac17ae9fc95c990128cdbe72
2020-05-27 15:09:34 -07:00
Treehugger Robot
2381262ed7 Merge "liblp: delete unused function and fields" am: 37e8b5e587 am: f5a19271e1
Change-Id: Ic6e0c2b66c5fe9ef0972b75968ca6aef601cf951
2020-05-27 19:07:24 +00:00
Treehugger Robot
f5a19271e1 Merge "liblp: delete unused function and fields" am: 37e8b5e587
Change-Id: I9217122c87b32d92664c22287a7ba45d5f204059
2020-05-27 18:47:47 +00:00
Treehugger Robot
37e8b5e587 Merge "liblp: delete unused function and fields" 2020-05-27 18:35:05 +00:00
Chen Zhu
f260aa74a9 Merge "Add test config to libstatspull_test and libstatssocket_test" into rvc-dev am: f584432c90
Change-Id: I80f6d0b6d24f4af3dd6901e6347dedc3f5c15ada
2020-05-27 07:54:29 +00:00
Chen Zhu
f584432c90 Merge "Add test config to libstatspull_test and libstatssocket_test" into rvc-dev 2020-05-27 07:47:03 +00:00
TreeHugger Robot
7455e4dbae Merge changes I1118f2e2,I6c039b32 into rvc-dev am: d4c8a20d4b
Change-Id: Ic811514863a3a408105540bb147bdff821fa8c2e
2020-05-27 05:47:04 +00:00
TreeHugger Robot
d4c8a20d4b Merge changes I1118f2e2,I6c039b32 into rvc-dev
* changes:
  adb: only submit USB writes on the worker thread.
  adbd: don't use libc++_static.
2020-05-27 05:15:55 +00:00
Christopher Ferris
2cf65a0f82 Merge "Fail explicitly on length overflow." am: d46eb21906 am: a40e0504be
Change-Id: I526a830e8a3fcdf22f09372046d37784c35f8dd7
2020-05-27 03:52:50 +00:00
Christopher Ferris
a40e0504be Merge "Fail explicitly on length overflow." am: d46eb21906
Change-Id: I3722824bf8aad86ced2765a8eda8f6cd54fba805
2020-05-27 03:37:56 +00:00
Christopher Ferris
d46eb21906 Merge "Fail explicitly on length overflow." 2020-05-27 03:17:03 +00:00
Yifan Hong
bcf3cc8cce liblp: delete unused function and fields
Test: builds
Change-Id: Ib7c93cfadacedc4f8d983c490e55fb4672cc9c1d
2020-05-26 23:02:31 +00:00
Christopher Ferris
68604b9c29 Fail explicitly on length overflow.
Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
2020-05-26 12:00:07 -07:00
Elliott Hughes
10b59d4044 Merge "libcutils: reimplement system property functions with libbase." am: 95e79c63a4 am: 854b9898ae
Change-Id: I4f99d73f376e853a0b125439e105ae781af02e30
2020-05-26 18:00:45 +00:00
Elliott Hughes
854b9898ae Merge "libcutils: reimplement system property functions with libbase." am: 95e79c63a4
Change-Id: I2151d62faefced4e95ed7bef96be3580f59ac732
2020-05-26 17:40:42 +00:00
Elliott Hughes
95e79c63a4 Merge "libcutils: reimplement system property functions with libbase." 2020-05-26 17:27:56 +00:00
Tom Cherry
e9f984abad Merge changes If6e29418,I6d90838e,Ie488f8ac am: f8f95a41f4 am: 473b02289c
Change-Id: I3bd6a97bee5a46c884fcbe01b2fa401832f3ac50
2020-05-26 15:45:24 +00:00
Tom Cherry
473b02289c Merge changes If6e29418,I6d90838e,Ie488f8ac am: f8f95a41f4
Change-Id: I6c6bfd78d879aaac8df26d0f387f280ce038889e
2020-05-26 15:31:59 +00:00
Tom Cherry
f8f95a41f4 Merge changes If6e29418,I6d90838e,Ie488f8ac
* changes:
  logd: create SimpleLogBuffer and implement ChattyLogBuffer in terms of it
  logd: separate Chatty only vs generic LogBufferTests
  logd: move current sequence from LogBufferElement to LogBuffer
2020-05-26 15:19:44 +00:00
Paul Crowley
effd821287 [automerger skipped] Merge "emmc_optimized means stable_inodes" into rvc-dev am: c05e7c0236 -s ours
am skip reason: Change-Id Id7f906564457c240ddf6677dd536698881385385 with SHA-1 c2f37683bc is in history

Change-Id: Id20bd0597c8aa590d00ebcfb245823368e834c84
2020-05-23 22:37:54 +00:00
Paul Crowley
c05e7c0236 Merge "emmc_optimized means stable_inodes" into rvc-dev 2020-05-23 22:20:06 +00:00
Treehugger Robot
15ed882026 Merge "Update TEST_MAPPING." am: aa15ef4d0e am: 075f813c3b
Change-Id: I02f1a04c5ba9f9411792638e7e5214b775885f22
2020-05-22 02:18:20 +00:00
Treehugger Robot
075f813c3b Merge "Update TEST_MAPPING." am: aa15ef4d0e
Change-Id: Ib8a1db306ab284880d56c08fe1d4023051591f5b
2020-05-22 02:03:36 +00:00
Treehugger Robot
aa15ef4d0e Merge "Update TEST_MAPPING." 2020-05-22 01:46:29 +00:00
Alistair Delva
a2cc1ebb72 Add ro.boot.fstab_suffix and modify mount_all to use it
Currently the ReadDefaultFstab function, which calls GetFstabPath,
makes some assumptions about what the fstab will be called and where
it is located. This is being used by vold to set up userdata encryption
and for gsid, and is even used in the default boot control HAL, so it
has become quite baked.

The original way for a board to specify things to mount was to use the
"mount_all /path/to/fstab" command in init.rc. However, due to the
above functionality, the path after mount_all is no longer very useful,
as it cannot differ from the inferred path, or userdata encryption and
other features will be broken.

On Cuttlefish, we have an interest in being able to test alternative
userdata configurations (ext4 vs f2fs, encryption on/off, etc.) and
currently the only way to achieve this is to either a) modify the
ro.hardware or ro.hardware.platform properties, which breaks a bunch
of things like default HAL filenames, or regenerate our odm.img or
vendor.img filesystems. We can't simply install another fstab and
point to it with "mount_all".

This change allows the fstab path to be omitted from "mount_all", and
adds another property which overrides the existing checks for
fstab.${ro.hardware} and fstab.${ro.hardware.platform}. Specifying
${ro.boot.fstab_suffix} will cause fstab.${ro.boot.fstab_suffix}
to be checked first.

Bug: 142424832
Test: booted cuttlefish with 'mount_all ${ro.hardware} --late'
Test: booted cuttlefish with 'mount_all --late'
Test: booted cuttlefish with 'mount_all --late' and fstab_suffix=f2fs
Test: partially booted cuttlefish with 'mount_all ${ro.hardware}'
Test: partially booted cuttlefish with 'mount_all'
Change-Id: I3e10f66aecfcd48bdb9ebf1d304b7aae745cbd3c
2020-05-21 16:38:40 -07:00
S Vasudev Prasad
100b08a848 libcutils: reimplement system property functions with libbase.
This makes the system property functions available on the host too, and
ensures a consistent view of system properties between libcutils and
libbase, if you have code running on the host that uses both.

Bug: http://b/151789258
Test: treehugger
Change-Id: Ie524a77d0c392d7b23e9d12becbb1bf53c81eac6
2020-05-21 16:20:16 -07:00
Paul Crowley
e96d6a9067 emmc_optimized means stable_inodes
If the emmc_optimized filesystem flag is set, then like
inlinecrypt_optimized, we have to ensure that stable_inodes is set
on the filesystem.

Bug: 144046242
Test: Cuttlefish, ext4: set the flag in fstab, check for the
    stable_inodes flag using tunefs -l
Cherry-Picked-From: c2f37683bc
Merged-In: Id7f906564457c240ddf6677dd536698881385385
Change-Id: Id7f906564457c240ddf6677dd536698881385385
2020-05-21 15:20:51 -07:00
Josh Gao
6da375fdc9 adb: only submit USB writes on the worker thread.
After USB disconnection, io_submit will block until the endpoint comes
back up. We handle this in the worker thread by sending it a signal to
break it out of io_submit when we notice that USB has gone down, but
opportunistic writes from the main thread can get stuck in this scenario
as well. Submitting the writes only on the worker thread doesn't have a
measurable impact on performance, so avert this scenario by only
submitting writes from the worker thread.

Bug: http://b/157078255
Test: test_device.py
Change-Id: I1118f2e2a70d13f15592eb996e7084033ed5cb9d
(cherry picked from commit 962551000b)
2020-05-21 14:55:46 -07:00
Josh Gao
2081cf31b3 adbd: don't use libc++_static.
We have dependencies that use libc++_shared, which results in ODR
violation manifesting as host adbd crashing on launch in libc++ locale
initialization.

Bug: http://b/151056300
Test: adbd on host
Change-Id: I6c039b325308fb8c36dfe5c1d090ff4ebe9e3433
(cherry picked from commit d5d5ba1644)
2020-05-21 14:55:38 -07:00