Commit graph

47978 commits

Author SHA1 Message Date
Mark Salyzyn
d7931f1149 init: powerctl support and propagate longer canonical reboot reasons.
init: Received sys.powerctl='reboot,userrequested,recovery,ui' ... (/system/bin/recovery)
init: powerctl: unrecognized command 'reboot,userrequested,recovery,ui'

Test: manual & boot_reason_test.sh
Bug: 63736262
Bug: 135078366
Bug: 133326470
Change-Id: I931daf8dc4b74db5ee114c59ee215b1ba54bc31d
2019-07-10 13:06:57 -07:00
Elliott Hughes
d543c8ca11 Merge "grep is now toybox grep." 2019-07-10 15:19:58 +00:00
Florian Mayer
3f407fcc37 Merge "Fix missing load bias." 2019-07-09 21:30:47 +00:00
Tom Cherry
e05c799c47 Merge "Remove an ancient spam-busting hack from logd." 2019-07-09 20:37:56 +00:00
Elliott Hughes
3d5dd3187f grep is now toybox grep.
Test: N/A
Change-Id: I8e5070ff3d8f709c53047680c0a0b1123d81cd63
2019-07-09 13:28:10 -07:00
Tom Cherry
a93e09f834 Merge "Don't implement our own remove_cvref_t." 2019-07-09 20:10:22 +00:00
Josh Gao
88d23135d2 Merge changes from topic "fdevent_refactor"
* changes:
  adb: fdevent: extract Add/Del/SetTimeout.
  adb: fdevent: extract Create/Destroy from fdevent_context_poll.
  adb: fdevent: move TerminateLoop to fdevent_context.
  adb: fdevent: move CheckMainThread logic to fdevent_context.
  adb: fdevent: delete FDE_CREATED.
  adb: fdevent: move run queue to fdevent_context.
  adb: implement fdevent_reset by constructing a new context.
  adb: move fdevent implementation out to a separate file.
  adb: de-globalize fdevent context.
  adb: move fdevent to its own folder.
  adb: add superfluous include.
2019-07-09 20:02:29 +00:00
Florian Mayer
249c90ff17 Fix missing load bias.
There are binaries that have non-executable LOAD with p_offset=0.

E.g.,

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000400040 0x0000000000400040 0x0002a0 0x0002a0 R   0x8
  INTERP         0x0002e0 0x00000000004002e0 0x00000000004002e0 0x00001c 0x00001c R   0x1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x0059e0 0x0059e0 R   0x1000
  LOAD           0x006000 0x0000000000406000 0x0000000000406000 0x10f2b05 0x10f2b05 R E 0x1000
  LOAD           0x10f9000 0x00000000014f9000 0x00000000014f9000 0x70f634 0x70f634 R   0x1000
  LOAD           0x1808f18 0x0000000001c09f18 0x0000000001c09f18 0x089fc8 0x0a7ab8 RW  0x1000
  DYNAMIC        0x1864ce0 0x0000000001c65ce0 0x0000000001c65ce0 0x000240 0x000240 RW  0x8
  NOTE           0x0002fc 0x00000000004002fc 0x00000000004002fc 0x000020 0x000020 R   0x4
  TLS            0x1808f18 0x0000000001c09f18 0x0000000001c09f18 0x000010 0x000010 R   0x8
  GNU_EH_FRAME   0x11abde8 0x00000000015abde8 0x00000000015abde8 0x14484c 0x14484c R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10
  GNU_RELRO      0x1808f18 0x0000000001c09f18 0x0000000001c09f18 0x05c0e8 0x05c0e8 R   0x1

Test: host libunwindstack_test passes.
Test: Modified unit tests and new offline test.

Change-Id: I3992f712be238c7d4109556580b5dcc71175fe19
2019-07-09 10:22:36 -07:00
Tom Cherry
343ce615cf Merge "Fix a few clang-tidy issues and add NOLINT for others" 2019-07-09 17:04:22 +00:00
Tom Cherry
a2928b52ff Don't implement our own remove_cvref_t.
clang-tidy flagged the anonymous namespace in the header as a warning,
but in any case, it'll be cleaner to implement this in terms of the
existing type traits.

Test: build
Change-Id: I189986d2a855c028e28dd9d62ab9da012feddc9b
2019-07-09 09:55:47 -07:00
Tom Cherry
247ffbf314 Fix a few clang-tidy issues and add NOLINT for others
android-base:
* Add NOLINT for expanding namespace std for std::string* ostream
  overload

libdm:
* Fix missing parentesis around macro parameters

init:
* Fix missing CLOEXEC usage and add NOLINT for the intended
  usages.
* Fix missing parentesis around macro parameters
* Fix erase() / remove_if() idiom
* Correctly specific unsigned char when intended
* 'namespace flags' should be signed, since 'flags' it signed for
  clone()
* Add clear to property restore vector<string> to empty after move
* Explicit comparison against 0 for strcmp

Test: build
Change-Id: I8c31dafda2c43ebc5aa50124cbbd6e23ed2c4101
2019-07-09 16:17:36 +00:00
Elliott Hughes
0e04ce98ef Merge "toolbox: drop NetBSD grep for toybox grep." 2019-07-09 15:38:48 +00:00
Treehugger Robot
5ffffb4f30 Merge "Rename product_services to system_ext" 2019-07-09 08:58:04 +00:00
Justin Yun
5d0ac62995 Rename product_services to system_ext
Update adb, fastboot and mount point

Bug: 134359158
Test: build and check if system_ext.img can be flashed
Change-Id: I6219f72242c5fe42a508008c0b1fd218d74da5b6
2019-07-09 08:56:53 +00:00
Treehugger Robot
c7fe1552d5 Merge "logcat: add 'kernel' to defaults" 2019-07-09 02:09:31 +00:00
Treehugger Robot
747aa9a49b Merge "Fix unsigned type sub overflow issue when isntall DSU" 2019-07-09 01:54:43 +00:00
Josh Gao
35b29360a2 adb: fdevent: extract Add/Del/SetTimeout.
Test: adb_test
Change-Id: Ibed301f8de73289837153fdfed370a681c24ac55
2019-07-08 18:32:24 -07:00
Josh Gao
33944a2742 adb: fdevent: extract Create/Destroy from fdevent_context_poll.
Test: adb_test
Change-Id: Ida308e8e281cbb2954277196a51945f124ce5823
2019-07-08 18:32:24 -07:00
Josh Gao
ebaa348d32 adb: fdevent: move TerminateLoop to fdevent_context.
Test: adb_test
Change-Id: Ib1f20aefdb36603e2ceac4197c02551f557056ee
2019-07-08 18:32:24 -07:00
Josh Gao
2c95bf73a5 adb: fdevent: move CheckMainThread logic to fdevent_context.
Test: adb_test
Change-Id: I10b93293af22d54ec739dc0f95c95df3ab082fb6
2019-07-08 18:32:24 -07:00
Josh Gao
e546f6816e adb: fdevent: delete FDE_CREATED.
All fdevents must be created by fdevent_create/fdevent_context::Create
now, so this flag is meaningless.

Test: none
Change-Id: I8489afad07bdb267ddfdb0dbb25d40d3a62f55f6
2019-07-08 18:05:55 -07:00
Josh Gao
95eef6b097 adb: fdevent: move run queue to fdevent_context.
Make the run queue logic reusable between implementations of fdevent by
moving it to the abstract base class.

Test: adb_test
Change-Id: If2f72e3ddc8007304bca63aa75446fa117267b25
2019-07-08 18:05:47 -07:00
Treehugger Robot
3d3f24bc22 Merge "init: fix to avoid loading apex *.rc files twice" 2019-07-09 00:37:31 +00:00
Josh Gao
7adca93fe9 adb: implement fdevent_reset by constructing a new context.
Test: adb_test
Change-Id: Ie67afafe2b73fb2a8fc08568560adac6f456eb9a
2019-07-08 17:32:14 -07:00
Josh Gao
95068bbd9a adb: move fdevent implementation out to a separate file.
Test: mma
Change-Id: I8af945b9ae0accac75fa93c538e44cbab357bb5d
2019-07-08 16:03:27 -07:00
Steven Moreland
fe535f5e68 logcat: add 'kernel' to defaults
I'm asked at least once a week or more why a new service isn't starting.
Usually, the reason is that "File ... has incorrect label or no domain
transition from ... to another SELinux domain defined. ..." from init.
Even in permissive mode, this is required.

Bug: 63014404
Test: boot, check logcat
Change-Id: I7244a56fc46f84e9592e1eccf2d23461691965b3
2019-07-08 15:59:25 -07:00
Treehugger Robot
463773b733 Merge "Refactorings to match adb_abb to adb_shell code." 2019-07-08 22:17:42 +00:00
Treehugger Robot
ee148dd9c1 Merge "first_stage_init: add console" 2019-07-08 22:14:52 +00:00
Christopher Ferris
b0c5cd27a1 Merge "Fix error printing code." 2019-07-08 21:46:44 +00:00
Josh Gao
c2cf121174 adb: de-globalize fdevent context.
Test: adb_test
Test: adbd_test
Change-Id: If711257d831b9090b38412821466c1d358d53d2d
2019-07-08 14:37:27 -07:00
Josh Gao
57e09b16ca adb: move fdevent to its own folder.
Preparatory refactoring for platform-specific implementations.

Test: mma
Change-Id: I0f600122ac89241788c5f3300f362fd9ef02ddcd
2019-07-08 14:37:27 -07:00
Josh Gao
2d03ad42ed adb: add superfluous include.
Resolve a merge conflict between internal and aosp by making aosp look
like internal.

Test: none
Change-Id: I7bea6ab61ad45ff20a3d07abf3f73903a7c05585
Merged-In: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-07-08 14:37:27 -07:00
Elliott Hughes
63b07755c7 toolbox: drop NetBSD grep for toybox grep.
Test: toybox grep tests
Change-Id: Ifb99980cc4d0a4d843a82671b2e2eaad67829e5c
2019-07-08 14:29:12 -07:00
Alex Buynytskyy
cc2f124070 Refactorings to match adb_abb to adb_shell code.
Test: Build, flash and boot, use `adb abb` to verify

Change-Id: I30eb6e8a4fd43b1548a9398376c72e2cb31223a4
2019-07-08 18:30:26 +00:00
Elliott Hughes
de3ad1d718 Remove an ancient spam-busting hack from logd.
We have real spam detection and suppression now anyway.

Bug: 20143912
Test: build
Change-Id: I7bd4bb189373569fd1e5a7b3f2b90ce816abe864
2019-07-08 11:10:11 -07:00
Steven Moreland
4e6275ddaf Merge "Remove utf32 functions." 2019-07-08 17:02:10 +00:00
Steve Muckle
d75f30a4f0 first_stage_init: add console
Start and wait on a console if androidboot.first_stage_console=1 is
present on the kernel command line. This only works on eng and
userdebug builds.

Change-Id: I978e9390a89509431b399ea58b284736b27eeb1b
2019-07-08 09:33:24 -07:00
Jooyung Han
9c4fa66706 init: fix to avoid loading apex *.rc files twice
Test: adb shell dmesg | grep "init: Parsing file /apex"
 shows a single entry for each APEX'es *rc file

Change-Id: I9006cc3d0cb7bdfe7532279f29d8095b7d16a807
2019-07-05 11:22:18 +09:00
liyong
089941c800 Fix unsigned type sub overflow issue when isntall DSU
writer->size() is block size aligned and could be bigger than remaining_bytes
If remaining_bytes is bigger, set remaining_bytes to 0 to avoid sub overflow error.

Bug: 136727859
Test: Successfully install a DSU
Change-Id: If493b0f206561239caec2ee234f7cfd70bf927a7
2019-07-04 11:29:19 +00:00
Steven Moreland
0e19f3b4cc Remove utf32 functions.
These don't appear to be used by anything.

Bug: N/A
Test: binary inspection + code inspection
Change-Id: I6c12db26c320a66bcf6e28618c6e9f61b40d985e
2019-07-02 18:15:03 -07:00
Tom Cherry
c538656d7d Merge "Add android::base::GetPids() function to return all pids" 2019-07-02 17:04:08 +00:00
David Anderson
e5815ca19a Merge "fastboot: add a wipe-super command." 2019-07-02 00:54:17 +00:00
Tom Cherry
ab80b02493 Merge "Revert "Modularize logd."" 2019-07-01 23:28:29 +00:00
Daniel Norman
e33e1a8242 Merge "Checks each interface in an init_rc file is a known hidl_interface." 2019-07-01 21:15:38 +00:00
Tom Cherry
13b1f34279 Add android::base::GetPids() function to return all pids
We loop over /proc to iterate through pids in a lot of code, so let's
consolidate this into a single function in libbase.

Test: new unit test
Change-Id: I908fab90b603546d0e3e8b8acdc8dadfc3552d62
2019-07-01 13:55:46 -07:00
Tom Cherry
c3c598134f Merge "Revert "logd: validate and fill in socket credentials"" 2019-07-01 17:30:28 +00:00
Sandeep Patil
581f45892c Merge "dmabuf_dump: Change the default view to per-process stats" 2019-07-01 15:36:02 +00:00
Christopher Ferris
d943301990 Fix error printing code.
Test: Induced error and verified the errors print properly in logcat.
Change-Id: Ie0e6e71671a8a3e26b4632f93bb2af089a20e2e0
2019-06-28 18:11:12 -07:00
Tom Cherry
3096818c8e Revert "Modularize logd."
logd isn't meant to be modularized.  The previous user was using a
small subset of LogListener.cpp, which is now copied into their
project.

Test: liblog, logd unit tests

This reverts commit fafea32468.

Change-Id: I05ec764db2d9395f2d5b69a1a610c9c55240ab3a
2019-06-28 14:16:13 -07:00
Tom Cherry
40da03b742 Revert "logd: validate and fill in socket credentials"
We don't want to fake socket credentials if they were not provided by
the kernel.  If there is a bug preventing us from reading the
credentials then it must be solved directly.

Test: logd, liblog unit tests
Test: boot and ensure overflow uid doesn't show up

This reverts commit c4e4823b00.

Change-Id: I683129a8a214637635f163ae25c39bb8a47cd50f
2019-06-28 14:16:00 -07:00