Commit graph

58796 commits

Author SHA1 Message Date
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
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
Paul Crowley
c05e7c0236 Merge "emmc_optimized means stable_inodes" into rvc-dev 2020-05-23 22:20:06 +00: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
TreeHugger Robot
de933e859e Merge "fastbootd: Support TCP protocol." into rvc-dev 2020-05-20 16:31:18 +00:00
David Anderson
a0e4932ccb Merge "libsnapshot_test: Fix running on DSUs." into rvc-dev 2020-05-20 00:06:14 +00:00
Mark Salyzyn
7a6a01a09f Merge "init: support wait timeout with more precision" into rvc-dev 2020-05-19 22:48:29 +00:00
Howard Ro
48d5b6fd03 Merge "Remove statsd enable check when logging" into rvc-dev 2020-05-19 21:58:10 +00:00
Howard Ro
516b632ff4 Remove statsd enable check when logging
statsd should now be enabled on all devices and this check is
unnnecessarily adding a check for each time there's a call into the
socket, which is inefficient.

Bug: 157082130
Test: make, statsd_test
Change-Id: I0bb0ae0c93516c3a02cb971742c3eba602668a09
2020-05-19 21:52:14 +00:00
Mark Salyzyn
61de0d226d init: support wait timeout with more precision
A one second timeout is so coarse and can affect boot time when
the possibility that the file does not exist.  Switch to accepting
a floating point number for seconds for the wait for file command.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 151950334
Test: wait_for_file sleep 0.05 reports an appropriate delay
Change-Id: I8d8ed386519ab54270b05ce91663d0add30f12e7
2020-05-19 13:25:07 -07:00
TreeHugger Robot
9113e7be95 Merge changes I2fcd093e,I24210426 into rvc-dev
* changes:
  Optimizing install-multi-package to use ABB.
  Incremental install mode for install-multi.
2020-05-19 20:12:04 +00:00
Hongguang Chen
7516ebe63b fastbootd: Support TCP protocol.
The current fastbootd only supports USB protocol. But some Android TV
devices are built without USB port. The fastbootd cannot be used on
those ATV devices due to it.
This change adds TCP protocol for such devices and fastbootd.protocol
property is added to control which protocol to use.

BUG: 152544169
BUG: 155198345
Test: manual test.
Change-Id: Idc391e677eb6a1880036419ba5f6c4160e8dbcbc
Merged-In: Idc391e677eb6a1880036419ba5f6c4160e8dbcbc
2020-05-19 19:11:25 +00:00
David Anderson
42d676db47 libsnapshot_test: Fix running on DSUs.
Because DSUs mount userdata via a fiemap, libfiemap has trouble creating
additional fiemaps on top of it. The complex stacking of dm-linear is
not supported. For other libfiemap tests we've hacked around this
limitation. If LpMetadata is in a folder named "test", we allow the
backing device search to stop at a dm node, whereas otherwise it would
need to stop at a physical device.

However this was not quite enough for vts_libsnapshot_test, because (1)
the test folder was not included in the pattern match, and (2)
CreateLogicalPartition() could not handle device-mapper names, as it
expects a named physical partition. Addressing both of these allows the
tests to pass on DSUs.

Bug: 156713441
Test: vts_libsnapshot_test on DSU
Change-Id: Ie7ee70e31dff0809a5f0c402ed132d80dd03d9b1
Merged-In: Ie7ee70e31dff0809a5f0c402ed132d80dd03d9b1
2020-05-19 18:48:10 +00:00
TreeHugger Robot
5b07f4f322 Merge "init: failed to set sys.usb.controller" into rvc-dev 2020-05-19 13:48:39 +00:00
Alex Buynytskyy
61f4ab89a2 Optimizing install-multi-package to use ABB.
Bug: 150803885
Test: atest adb_test adbd_test
Test: adb install-multi-package Picsart_9.30.5.apk Pinterest_6.54.0.apk
Change-Id: I2fcd093e61afdd16d481194e1d5f8f66acf6a66c
Merged-In: I2fcd093e61afdd16d481194e1d5f8f66acf6a66c
2020-05-19 04:26:42 +00:00
Alex Buynytskyy
f1e187be01 Incremental install mode for install-multi.
Bug: 150803885
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I242104267273bac21ab41390d3e77a434ffa565d
Merged-In: I242104267273bac21ab41390d3e77a434ffa565d
2020-05-18 21:26:10 -07:00
Steve Muckle
b510d2bff3 add API to get hash descriptor
The GKI verification VTS test will need to examine the boot partition's
hash descriptor, so add support to access this descriptor.

Bug: 148800209
Test: atest AvbTest#Boot
Change-Id: I92e32f61a265671ae0940c44147391f73776e66a
Merged-In: I92e32f61a265671ae0940c44147391f73776e66a
2020-05-18 12:38:18 -07:00
Jooyung Han
8de46ae39d Merge "backtrace: Set min_sdk_version" into rvc-dev 2020-05-18 06:34:01 +00:00
Jooyung Han
148f7b32d7 backtrace: Set min_sdk_version
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 152655956
Test: m
Merged-In: I9ff06ca47c8bc2cc5632ffb3494e4fb8eb79d5a3
Change-Id: I9ff06ca47c8bc2cc5632ffb3494e4fb8eb79d5a3
(cherry picked from commit bc62a19448)
2020-05-18 06:33:37 +00:00
TreeHugger Robot
56c1c590ac Merge "fastbootd: copy AVB footer on boot image to end of block device" into rvc-dev 2020-05-18 04:37:37 +00:00
TreeHugger Robot
c6c000d1a5 Merge "Set apex_available property" into rvc-dev 2020-05-18 04:24:55 +00:00
Steve Muckle
bd98e25439 fastbootd: copy AVB footer on boot image to end of block device
If the flashed boot image is smaller than the block device, the AVB
footer will not be at the end of the partition. Although images are
normally created to match the partition size the GKI boot.img must work
on all devices, and the size of the boot partition will vary.

Copy the AVB footer to the end of the partition before flashing, if it
is not there already.

Bug: 156036850
Change-Id: I11f0c7d32d1b6c74edd4f84f815d175605280cb8
Merged-In: I11f0c7d32d1b6c74edd4f84f815d175605280cb8
2020-05-17 17:01:25 -07:00
Alex Buynytskyy
74e9e3c27a Passing additional flags to incremental installation.
Bug: 150803885
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: Ifa9b9e570259d35eb0121817bbb791044c6efcfd
Merged-In: Ifa9b9e570259d35eb0121817bbb791044c6efcfd
2020-05-14 21:00:10 +00:00
Mark Salyzyn
6fca594fc2 init: failed to set sys.usb.controller
With GKI we find in certain situations the timing of the drivers
loading is delayed as compared to a monolithic kernel.  This
introduces a race where during second stage init, the attributes
inside /sys/class/udc/ might not be set by the time
SetUsbController() is called.

To address this, we also call SetUsbController() until the property
sys.usb.controller is set at the bottom of the event loop.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 151950334
Test: make sure user space fastbootd comes up reliably for a GKI kernel
Change-Id: Iececd8ffa3e6641554d215d622d8dab72d85d34d
2020-05-14 13:05:42 -07:00
Jooyung Han
7937f29be8 Set min_sdk_version to be part of mainline modules
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: Ida890adfe6dfac79267fc0e18b63d2330266438c
Change-Id: Ida890adfe6dfac79267fc0e18b63d2330266438c
(cherry picked from commit 7ea0d74bc8)
2020-05-13 12:10:36 +09:00
Christopher Ferris
310b46c1ca Merge "Fix mac build." into rvc-dev 2020-05-12 17:17:25 +00:00
Christopher Ferris
99dfe5ebba Merge "Change call to mmap64." into rvc-dev 2020-05-12 17:17:25 +00:00
TreeHugger Robot
7499783fd9 Merge changes Idaa27ce2,I06644a72,I453c63fe into rvc-dev
* changes:
  processgroup: Set min_sdk_version
  gralloc: Set min_sdk_version
  libcutils: Set min_sdk_version
2020-05-12 09:00:50 +00:00
Maciej Zenczykowski
ce7d0ba607 Merge changes I57cb2003,I569d2b81,I01a10e36 into rvc-dev
* changes:
  libnetutils/packet.c - create socket with close-on-exec
  libnetutils/packet.c - fix a raw socket reception race
  libnetutils/packet.c - fix a socket leak on bind error
2020-05-12 01:57:56 +00:00
TreeHugger Robot
8601d37213 Merge "libsnapshot: fix incorrect assumption of cow images" into rvc-dev 2020-05-12 00:32:22 +00:00
TreeHugger Robot
f2caf7de6c Merge "vts_processgroup_validate_test: make deps static" into rvc-dev 2020-05-11 23:33:28 +00:00
Christopher Ferris
1500d0e7a9 Fix mac build.
Add an inline for mmap64 to use on mac.

Bug: 155662887
Bug: 156053599

Test: Builds.
Change-Id: Id02e2c2f40acea2bdef604e9b80b70a85a941927
(cherry picked from commit 8a6dff22dc)
2020-05-11 23:07:53 +00:00
Maciej Żenczykowski
ecfb05d4ce libnetutils/packet.c - create socket with close-on-exec
This prevents fork/exec leaking sockets to child processes.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I57cb2003dd75b0bc5528978fd131730273e37a43
Merged-In: I57cb2003dd75b0bc5528978fd131730273e37a43
2020-05-11 15:58:02 -07:00
Maciej Żenczykowski
74346aac9c libnetutils/packet.c - fix a raw socket reception race
A socket created bound to a specific protocol can receive packets before
it's bound to a specific interface/mac.

It's best to rely on the bind().

This replicates the way packet sockets are created in external/android-clat.
See: ring.c ring_create() and clatd.c configure_packet_socket()

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I569d2b81a396f352ab5d1b71bd5ad0d96217aab1
Merged-In: I569d2b81a396f352ab5d1b71bd5ad0d96217aab1
2020-05-11 15:57:53 -07:00
Maciej Żenczykowski
b9add4a315 libnetutils/packet.c - fix a socket leak on bind error
and clean up the code a little bit while at it.

Test: builds, atest
Bug: 155297277
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I01a10e36f852cde1b93a91f95b51294a434885ab
Merged-In: I01a10e36f852cde1b93a91f95b51294a434885ab
2020-05-11 15:57:44 -07:00
Yifan Hong
01840c53e8 vts_processgroup_validate_test: make deps static
Test: pass
Fixes: 155959743
Change-Id: I730526955a40ae00a97f487e423a00c743f75d53
(cherry picked from commit 2572f23af8)
Merged-In: I730526955a40ae00a97f487e423a00c743f75d53
2020-05-11 12:32:26 -07:00
Ruchir Rastogi
b797431342 Merge "Use proper platform version checks (libstats)" into rvc-dev 2020-05-11 17:22:24 +00:00
Woody Lin
8fb6e3fdaf InitFatalReboot: Trigger panic explicitly for init_fatal_panic
The exit of init panics the system *after* process context (mm, stack,
...etc.) are recycled, according to Linux kernel's 'do_exit'
implementation. To preserve most init process context for debugging,
triggers the panic via proc-sysrq explicitly.

Note: after this change, there will be no "Attempt to kill init" panic
when androidboot.init_fatal_panic is set.

Test: Insert data abort fault in init, the full process context is
      preserved in memory dump captured after panic.
Bug: 155940351
Change-Id: I3393bd00f99b8cb432cfa19a105b7d636b411764
(cherry picked from commit be1cf9006a)
2020-05-11 14:50:27 +00:00
Jooyung Han
d1d5fdfc2a processgroup: Set min_sdk_version
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: Idaa27ce24cc13d13145eaef85a08b9033922c7bc
Change-Id: Idaa27ce24cc13d13145eaef85a08b9033922c7bc
(cherry picked from commit 4f55f3efd3)
2020-05-11 17:45:27 +09:00
Jooyung Han
3c20c62cdd gralloc: Set min_sdk_version
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: I06644a725eb8f4ce0c7d8e1f09359b55e1b668d7
Change-Id: I06644a725eb8f4ce0c7d8e1f09359b55e1b668d7
(cherry picked from commit 72a6b3137e)
2020-05-11 17:44:29 +09:00
Jooyung Han
86455d7f87 libcutils: Set min_sdk_version
Modules contributing mainline modules (APK/APEX) should set
min_sdk_version as well as apex_available.

For now setting min_sdk_version doesn't change build outputs.
But build-time checks will be added soon.

Bug: 152655956
Test: m
Merged-In: I453c63fe29607ea0312da5465b03c741486fb670
Change-Id: I453c63fe29607ea0312da5465b03c741486fb670
(cherry picked from commit 88f00f2d43)
2020-05-11 17:43:04 +09:00
Lorenzo Colitti
c00d57d353 Simplify code that parses ifa_flags.
When parsing an RTM_NEWADDR or RTM_DELADDR, ifaddr is always
present (unless the message is invalid). So ifaddr->ifa_flags is
always known before any attributes are parsed.

Bug: 155005831
Test: atest NetworkStackNextIntegrationTests:IpClientIntegrationTest continues to apss
Change-Id: Id1998faccca7d81c1b7f3e85e4912aa22919e94a
2020-05-11 11:37:17 +09:00
Lorenzo Colitti
3991ca5657 Parse IFA_F_* values above 0x80.
In RTM_NEWADDR messages, the first 8 flags are reported in the
ifa_flags field in struct ifaddrmsg, but flags above 0x80 are
reported in the IFA_FLAGS attribute. NetlinkEvent currently only
looks at ifa_flags, so it cannot see higher-value flags such as
IFA_F_STABLE_PRIVACY. Fix this by parsing the IFA_FLAGS
attribute.

Bug: 155005831
Test: makes new test in aosp/1295495 pass
Original-Change: https://android-review.googlesource.com/1295670
Merged-In: I723f1106cbcea2186fc6452305942a0f8301fd2a
Change-Id: I723f1106cbcea2186fc6452305942a0f8301fd2a
2020-05-11 11:29:59 +09:00
Chen Zhu
8950624662 Merge "Add test config for adbd_test and apply MainlineTestModuleController to it" into rvc-dev 2020-05-09 02:48:48 +00:00
Chen Zhu
5daea5a6a2 Add test config for adbd_test and apply MainlineTestModuleController to it
to only run the tests when com.google.android.adbd is

installed on device.

Bug: 154845935
Test: m mts && mts-tradefed run mts-adbd
Change-Id: I2f203d25288580a07391703e2b28df54479a69f0
2020-05-08 16:47:07 -07:00
Christopher Ferris
de38b1a356 Change call to mmap64.
The code was using an off64_t but calling mmap. This caused the code
to abort on 32 bit.

Add a unit test that would abort on the previous version.

Bug: 155662887

Test: New unit test passes.
Change-Id: I7a6efbc0d4227403c3d08a08deea56f239382157
Merged-In: I7a6efbc0d4227403c3d08a08deea56f239382157
(cherry picked from commit 7b9f35c9de)
2020-05-07 17:45:30 -07:00
TreeHugger Robot
1cf1238d4a Merge "first_stage_init: add support to skip module load failures" into rvc-dev 2020-05-07 21:48:05 +00:00
Will McVicker
f3483ec6a0 first_stage_init: add support to skip module load failures
Extend androidboot.first_stage_console cmdline property to enable
skipping module load failures without stopping at a serial console. This
is useful for GKI development.

Set androidboot.first_stage_console=2 for this behavior.

Bug: 155296582
Test: verify behavior for values 0, 1, and 2
Merged-In: I068c631a22c848e45a421b297b1acae1b3deb3c1
Change-Id: I068c631a22c848e45a421b297b1acae1b3deb3c1
(cherry picked from commit 6c5f82642b)
2020-05-07 21:47:17 +00:00
David Anderson
7d50e96978 Merge "libfiemap: Remove brittle tests." into rvc-dev 2020-05-07 19:34:04 +00:00