Commit graph

40229 commits

Author SHA1 Message Date
Steven Moreland
dc99a094dd Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8 am: d05ecb8d9d
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: I816b8858c69e6481299f942401a16b5b39cd8b69
2020-08-04 22:21:36 +00:00
Steven Moreland
d05ecb8d9d Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542 am: d8801aaad8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: Ifa0692e4966e78f4e180a2efc53db991177b6006
2020-08-04 22:03:55 +00:00
Steven Moreland
d8801aaad8 Merge "libutils: check vsnprintf error" into oc-dev am: a03d37d542
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/12254459

Change-Id: Id247c7079c146da8eaf52f098027d5daa25ce8d8
2020-08-04 21:37:54 +00:00
Steven Moreland
a03d37d542 Merge "libutils: check vsnprintf error" into oc-dev 2020-08-04 21:20:36 +00:00
TreeHugger Robot
cf6c14c850 Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f am: cf91151364 am: 84dcff4c6b
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: Ie7b7a57f55ead23f8d382ac98eb5087a2c614b1b
2020-07-31 20:24:42 +00:00
TreeHugger Robot
84dcff4c6b Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f am: cf91151364
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: Idb480f2a4dc1aa0d929e17e7e568a9c1b05c8489
2020-07-31 20:03:44 +00:00
TreeHugger Robot
cf91151364 Merge "Fail explicitly on length overflow." into oc-dev am: ea8d38e77f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619803

Change-Id: I9a6def9ff590fdadb457e9a011df3532829d23f4
2020-07-31 19:45:35 +00:00
TreeHugger Robot
ea8d38e77f Merge "Fail explicitly on length overflow." into oc-dev 2020-07-31 19:24:50 +00:00
Steven Moreland
ee22384c54 libutils: check vsnprintf error
For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-07-30 17:29:34 +00:00
Steven Moreland
64fb5012b8 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61 am: 9be245c3f0
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I3ab9771d898eea0158acfd07fbe5a2f4b7dad883
2020-07-14 16:12:53 +00:00
Steven Moreland
9be245c3f0 String16::remove - avoid overflow am: 4048e49956 am: 107f18cb61
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I22f6b8299b4b77be31859a10b14efe01b297d531
2020-07-14 15:51:29 +00:00
Steven Moreland
107f18cb61 String16::remove - avoid overflow am: 4048e49956
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/11619802

Change-Id: I4dedf81e3471473e589a858e14d7a9ae5f91b3d9
2020-07-14 15:37:25 +00:00
Christopher Ferris
4d14303653 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
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29)
2020-06-04 11:05:18 -07:00
Steven Moreland
4048e49956 String16::remove - avoid overflow
Bug: 156999009
Test: libutils_test (cases added)
Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
Merged-In: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
(cherry picked from commit f251c1c581)
(cherry picked from commit 9a9c8910e9296c9dc8d79c37f589895f5a2a836c)
2020-05-28 20:45:55 +00:00
Steven Moreland
f7724dfcfb FlattenableUtils::align memsets am: e62a9d7669 am: 59e7d4e8ea
am: 3f273f49f1

Change-Id: I91a8ef78619709fcdcb48cdad8e0e7a6b699b631
2019-11-06 16:13:06 -08:00
Steven Moreland
3f273f49f1 FlattenableUtils::align memsets am: e62a9d7669
am: 59e7d4e8ea

Change-Id: I1105027b52c3621e2031bdb747de61ce54d3ec74
2019-11-06 16:06:57 -08:00
Steven Moreland
59e7d4e8ea FlattenableUtils::align memsets
am: e62a9d7669

Change-Id: I51a5528d8544f374ff3ceb632e75a1d3ae97d963
2019-11-06 15:55:08 -08:00
Steven Moreland
e62a9d7669 FlattenableUtils::align memsets
Bug: 141890807
Test: boot, check data is zero'd
Change-Id: I45aaeac369f4c5cf3eb44f61c233e00f870a5c79
(cherry picked from commit bf824f8fa5)
2019-10-15 19:26:22 +00:00
Janis Danisevskis
14d1d6add8 [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02 am: 4ae4ad8e5b am: b25983460c am: 20e73e23c4
am: ca662c7118

Change-Id: I07e889d6ed94901f2bf70f90c995873cc58d3bf4
2019-06-21 13:48:16 -07:00
Janis Danisevskis
ca662c7118 [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02 am: 4ae4ad8e5b am: b25983460c
am: 20e73e23c4

Change-Id: I026aa5ddb79cd10146924fd6625816782645f660
2019-06-21 13:38:10 -07:00
Janis Danisevskis
20e73e23c4 [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02 am: 4ae4ad8e5b
am: b25983460c

Change-Id: Ie7a02bb3c7b283f3497a469e0cd3b2b69792d2f6
2019-06-21 13:33:05 -07:00
Android Build Merger (Role)
b25983460c [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02 am: 4ae4ad8e5b
Change-Id: I3fb4fc631eccd68a8f4468363d841855f94187f9
2019-06-20 22:31:20 +00:00
Android Build Merger (Role)
4ae4ad8e5b [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701 am: e126026c02
Change-Id: I98df60cfed36c714dae1fa4218d3c5ef23c4035c
2019-06-20 22:31:18 +00:00
Android Build Merger (Role)
e126026c02 [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d am: 7535975701
Change-Id: I25e3d526bb3f09c826d204909ea1763af4eb951d
2019-06-20 22:31:15 +00:00
Android Build Merger (Role)
7535975701 [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968 am: bdc924f31d
Change-Id: I2e9d6b1a5badb501adc641b17ce337c911d09610
2019-06-20 22:31:13 +00:00
Android Build Merger (Role)
bdc924f31d [automerger] Fix a memory leak in gatekeeper. am: 6a9c4e7968
Change-Id: Ie5dd32eec9a24b329ff4c5fd18c8f535f43c9bc7
2019-06-20 22:31:11 +00:00
Janis Danisevskis
6a9c4e7968 Fix a memory leak in gatekeeper.
In violation to the documentation of GateKeeper::GetAuthTokenKey and
GateKeeper::GetPasswordKey, the implementations in SoftGateKeeper
allocate and return buffers and relinquish ownership causing a memory
leak, because the caller expects the implementation to retain ownership.

Bug: 129768470
Bug: 134557251
Test: gatekeeper-unit-tests
Change-Id: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
Merged-In: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
2019-06-20 22:31:06 +00:00
Tao Bao
79cfc7d5a8 DO NOT MERGE Start update_verifier early in late-fs.
We used to start update_verifier after mounting userdata (post-fs-data),
as part of zygote-start. This leads to issues in practice for security
updates, where an A/B device falls back into the old slot (for any
reason, which unrelates to this change) but failing to boot due to
upgraded key blob. It essentially breaks the fallback capability offered
by A/B OTA.

This CL mitigates the issue by starting update_verifier early, before
mounting userdata. This avoids the device from falling back to the old
slot with an already-upgraded key blob. update_verifier loses the
opportunity of verifying _all_ the updated blocks based on the info
that's stored in userdata.  Instead it will only trigger the minimal
read to finish the work of marking a successful boot. This is a
trade-off in P to avoid putting the device in a bad state after
fallback, which will be improved in Q by better handling the fallback
path in vold.

Bug: 131176531
Test: Flash and boot crosshatch. Check the start of update_verifier and
      it marks a successful boot.
Change-Id: I3f4c4333ff38772a9a93c9d027d497db11de1d63
2019-05-07 12:50:58 -07:00
Wei Wang
6f2198b33c lmkd: bump process priority and set to FOREGROUND group before kill
This should help speed up reclaim memory.

Bug: 118468011
Bug: 121439388
Test: run mem-pressure with lmkd
Change-Id: Iae7aa35483eb0e8bbeccaa425559c6021c845ee1
Merged-In: Iae7aa35483eb0e8bbeccaa425559c6021c845ee1
2019-01-23 05:20:36 +00:00
Branden Archer
66d9e9231e Run BoringSSL self test during startup
NIAP certification requires that all cryptographic functions
undergo a self-test during startup to demonstrate correct
operation. This change adds such a check.

If the check fails, it will prevent the device from booting
by rebooting into the bootloader.

Bug: 119826244
Test: Built for walleye. After device booted examined dmesg and
      observed logs from init showing that the new task did
      start. Further, when BoringSSL is built to fail its self
      check the device did stop during a normal boot and enter
      the bootloader, and did so before the boot animation stopped.
Change-Id: I4df375cfcdbadcae7f67b01441fef6e729312807
Merged-In: I07a5dc73a314502c87de566bb26f4d73499d2675
2019-01-11 15:17:24 -08:00
Martijn Coenen
f11c98bc40 [automerger skipped] Export maximum number of fds/ints in a native_handle. am: c1cea05b5f -s ours am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history am: 479b8544c6 -s ours am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history
am: c9455b4740 -s ours
am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history

Change-Id: I685d84c532ebd165914abb016e8c9d1601208680
2019-01-07 04:33:12 -08:00
Martijn Coenen
c9455b4740 [automerger skipped] Export maximum number of fds/ints in a native_handle. am: c1cea05b5f -s ours am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history
am: 479b8544c6 -s ours
am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history

Change-Id: If4f1b92e9ed89bfd50fc0621ded802255165b2de
2019-01-07 04:29:02 -08:00
Martijn Coenen
479b8544c6 [automerger skipped] Export maximum number of fds/ints in a native_handle.
am: c1cea05b5f -s ours
am skip reason: change_id I0eafff70d3a7e4d732fe600a0052efb90108208d with SHA1 02debfa2df is in history

Change-Id: I64ce50c8c687a849a2e2acdcacda42c98d3a4115
2019-01-07 04:23:56 -08:00
Martijn Coenen
08ba9b1412 Export maximum number of fds/ints in a native_handle. am: 02debfa2df
am: 5fa5708025

Change-Id: I7812acbfd43811e332513b9945432d23fba94187
2019-01-04 10:53:26 -08:00
Martijn Coenen
5fa5708025 Export maximum number of fds/ints in a native_handle.
am: 02debfa2df

Change-Id: I36da3de7dcad006ee647163a62b0d5c8819b994e
2019-01-04 10:46:21 -08:00
Martijn Coenen
c1cea05b5f Export maximum number of fds/ints in a native_handle.
So we can deserialize it consisently and safely.

Bug: 120084106
Test: builds
Change-Id: I0eafff70d3a7e4d732fe600a0052efb90108208d
Merged-In: I0eafff70d3a7e4d732fe600a0052efb90108208d
2018-12-11 11:07:49 +00:00
Martijn Coenen
02debfa2df Export maximum number of fds/ints in a native_handle.
So we can deserialize it consisently and safely.

Bug: 120084106
Test: builds
Change-Id: I0eafff70d3a7e4d732fe600a0052efb90108208d
2018-12-11 11:38:41 +01:00
Badhri Jagan Sridharan
883a07d720 Merge "usbd: Do not join the thread pool" into pi-dev 2018-12-06 18:49:10 +00:00
TreeHugger Robot
b94cc00943 Merge "init: increase thermal shutdown timeout to 3s" into pi-dev 2018-11-07 00:01:24 +00:00
Tim Murray
afb3a15f39 DO NOT MERGE: lmkd: retune rate at which processes are killed
Kill a single process at a time and try to wait up to 100ms for
that process to reclaim memory before triggering another kill.

Test: boots, works
bug: 116877958
Change-Id: I6775d0534b3e3728c04389d3eae1a00e3cbf9f27
2018-10-26 13:21:17 -07:00
Wei Wang
98a6ae31e5 init: increase thermal shutdown timeout to 3s
1) increase thermal shutdown timeout to 3s for process to save work
2) respect property "ro.build.shutdown_timeout" in thermal shutdown if
   it is set less than default time - "3s"

Bug: 112432890
Test: Build
Change-Id: Idc2b24dd44c1fab8f9b047fd2468de2ee45ff783
Merged-In: Idc2b24dd44c1fab8f9b047fd2468de2ee45ff783
(cherry picked from commit b5de088262)
2018-10-26 20:08:57 +00:00
Badhri Jagan Sridharan
f123d45ce1 usbd: Do not join the thread pool
Work around for the following crash:
02-08 05:34:20.968  root   990   990 F DEBUG   :     #00 pc 000000000001447c  /system/lib64/libhwbinder.so (android::hardware::IPCThreadState::joinThreadPool(bool)+28)
02-08 05:34:20.968  root   990   990 F DEBUG   :     #01 pc 000000000001c174  /system/lib64/libhwbinder.so (android::hardware::PoolThread::threadLoop()+24)
02-08 05:34:20.968  root   990   990 F DEBUG   :     #02 pc 000000000000f934  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
02-08 05:34:20.968  root   990   990 F DEBUG   :     #03 pc 00000000000821e0  /system/lib64/libc.so (__pthread_start(void*)+36)
02-08 05:34:20.968  root   990   990 F DEBUG   :     #04 pc 0000000000023178  /system/lib64/libc.so (__start_thread+68)

Bug: 117470462
Change-Id: I1e8f28a7d0f3041d9be8138a3dc9ed9c74419f91
2018-10-24 01:43:06 +00:00
TreeHugger Robot
e77572d76d Merge "Read memory stats from /proc/pid/stat file." into pi-dev 2018-10-15 19:24:44 +00:00
Rajeev Kumar
244ace6b7b Read memory stats from /proc/pid/stat file.
(cherry pick from commit 0301683e49)
Bug: 117333340
Test: Manual testing using alloc-stress tool
Change-Id: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
Merged-In: Ie555933aafa6a6b7aa1dbf5518ebe804376e0afd
2018-10-12 21:28:50 +00:00
Suren Baghdasaryan
c89be17730 lmkd: Implement pid purge command to clear old pids when zygote restarts
lmkd keeps a list of pids registered by ActivityManager, however on rare
occasions when framework restarts and lmkd survives that list has to be
purged. Implement a command that can be used to clear the pid list.

Bug: 116801366
Test: locally by killing zygote process
Change-Id: I71d6012f86bb83a73edd5b687e05a0848e0569b1
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-10-10 22:11:23 +00:00
Suren Baghdasaryan
d6cbf3f41d lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Merged-In: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-07 18:27:17 -07:00
Greg Kaiser
270e90f033 Revert "Support Speck encryption."
This reverts commit 49c27c5cb2.

Remove the Speck encryption support. It was eventually
decided not to allow Speck in Android P, so this code
is no longer needed and wasn't used outside of testing.

Bug: 112009351
Test: Confirmed AES continues to work with FBE.
Change-Id: Ia5458143be5687fff8d541d8fa2c8ee24a369da4
2018-08-07 10:15:19 -07:00
Thierry Strudel
ae2e19dd96 metricslogger: fix ACTION_BATTERY_CAUSED_SHUTDOWN not matching proto
Bug: 111664962
Test: "pixelstats_client -s" uses the right ATOM value
Change-Id: I2944c6d9f79298ce88812fad218552b92afee97a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2018-07-19 19:14:58 -07:00
Doheon Lee
93d837f3a9 Determine product partition path on build time
Path of product partitoin can be set as /product or /system/product
whether generate extra product partition or not.
Substitute %PRODUCT% to relevant path to know linker which path should
search and permit.

Bug: 110286945
Test: m -j # Check /system/etc/ld.config.$(PLATFORM_VNDK_VERSION).txt
Change-Id: I6ca177d0c9c5af00ad821879fece40848331fc8d
Merged-In: I6ca177d0c9c5af00ad821879fece40848331fc8d
(cherry picked from commit cccad0bf84)
2018-06-20 00:53:55 +00:00
Inseob Kim
c4cf62f4b4 Add /system/product/* paths to permitted paths
As linker doesn't resolve paths in permitted paths, /system/product
variants should be added to support devices having product partition
under /system.

Bug: 110286945
Test: m -j succeeds on taimen and libraries under /system can dlopen
libraries under /system/product/apps

Change-Id: Icd102d44511702e4ec66c07a367b59c3d9700a44
Merged-In: Icd102d44511702e4ec66c07a367b59c3d9700a44
(cherry picked from commit 3918936b9e)
2018-06-20 00:53:17 +00:00