Commit Graph

45100 Commits

Author SHA1 Message Date
Tom Cherry 3016f2527c Merge "Do not create /sbin" 2019-04-17 23:26:13 +00:00
Josh Gao f05fbe6957 Merge "adbd: reduce the USB buffer sizes to 16k." 2019-04-17 21:43:37 +00:00
Tao Bao 55d407ec4a adb: Recognize rescue mode.
This CL adds client support to recognize the rescue mode (which will be
served by recovery image). It also allows waiting for a device to enter
rescue mode. The support for the actual rescue commands will be added in
follow-up CLs.

Bug: 128415917
Test: `adb devices` recognizes devices under rescue mode.
Test: `adb wait-for-rescue` waits for device to be in rescue mode.
Change-Id: I367d7339fe68006aba09a1e3db6370d472296676
2019-04-17 13:47:02 -07:00
Tom Cherry 990483d409 init: do not fork before doing (u)mount_all()
A fork() was historically added in case of fs_mgr crashing or leaking
memory, but this should not be the case with fs_mgr, and a fork() only
hides any such problem, instead of allowing us to address it
directly.

Test: boot
Change-Id: If7ee4807757048258a6ea9a79a24cebbacc530cc
2019-04-17 12:55:50 -07:00
Mark Salyzyn 4560714d10 fs_mgr: overlayfs: suppress mkfs output
After this change, all the noise from mkfs is suppressed:

$ adb remount
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/by-name/system_b
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=ext4)=-1: Invalid argument
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=f2fs)=0: Success
Using overlayfs for /system
Using overlayfs for /vendor
Using overlayfs for /product
[libfs_mgr]__mount(source=overlay,target=/system,type=overlay,upperdir=/mnt/scratch/overlay/system/upper)=0
[libfs_mgr]__mount(source=overlay,target=/vendor,type=overlay,upperdir=/mnt/scratch/overlay/vendor/upper)=0
[libfs_mgr]__mount(source=overlay,target=/product,type=overlay,upperdir=/mnt/scratch/overlay/product/upper)=0
remount succeeded

Test: manual as above
Bug: 130739326
Change-Id: I7ed8842e42b74b6a487ce6324b28baf78f1f63bf
2019-04-17 12:47:31 -07:00
Sandeep Patil a42207e2e3 procrank: do not keep process maps around
procrank's usage in its output shows 20x increase from
last year. This is because it is keeping the process
maps around until termination. Fix that by getting rid
of ProcMemInfo objects when done parsing /proc/<pid>/maps,pagemap.

Note that the total allocations do not change and have not necessarily
regressed from Pie.

Bug: 130672819
Test: adb shell procrank | grep 'procrank\|cmdline'

Change-Id: Ib7bf960ed1d053347fcfc0c8aee9019607a1eb01
Signed-off-by: Sandeep Patil <sspatil@google.com>
2019-04-17 12:11:50 -07:00
Dongwon Kang 4b2b76e101 Remove libandroid.so from media namespace.
Test: adb shell dumpsys media.extractor
Bug: 130637522
Change-Id: I6bcdac60a740d19a97bbac19e6339e0552b0d572
Merged-In: Ia6366834613d1e12498fa90377e79f62a2149776
2019-04-17 18:05:51 +00:00
Treehugger Robot 5c421695f0 Merge "Let blkio cgroup follow cpuset cgroup only" 2019-04-17 01:51:33 +00:00
Treehugger Robot 371180bb72 Merge "debuggerd: call setsid in our children." 2019-04-16 23:29:04 +00:00
Treehugger Robot 6e28863442 Merge "Handle failed usb/reads and writes correctly" 2019-04-16 23:03:17 +00:00
Yifan Hong e438843ead Merge "init: add umount_all builtin." 2019-04-16 22:46:52 +00:00
Tom Cherry 3ec821fcfb Do not create /sbin
/sbin was traditionally used for static binaries on the ramdisk for
Android, but now everything is a shared binary, so this directory is
empty and we do not want to encourage creation of new libraries in
this directory.

Bug: 73660730
Test: build
Change-Id: I0d0aa052e1eaf529d18921c45169473df0ee51ff
2019-04-16 15:22:33 -07:00
Rick Yiu e8678cf883 Let blkio cgroup follow cpuset cgroup only
Some app may have different cgroup settings in cpuset and schedtune for its
threads, so let blkio follow cpuset only, which represents the app's current
state more accurately. Otherwise, if that thread is doing IO, then its
performance will be affected because its blkio group is in lower priority
group as schedtune.

ex: an app is now in top-app, but some thread of it set schedtune group to
background, and blkio follows schedtune because it is called later.

Main thread:
6:schedtune:/top-app
5:memory:/
4:cpuset:/top-app
3:cpuacct:/uid_1000/pid_8766
2:cpu:/
1:blkio:/
0::/

Some thread:
6:schedtune:/background
5:memory:/
4:cpuset:/top-app
3:cpuacct:/uid_1000/pid_8766
2:cpu:/
1:blkio:/background
0::/

Bug: 124727032
Test: blkio has same settings with cpuset
Change-Id: I9a140c7d9d93e1dd43c34c8cf066f4a62e2bf604
2019-04-16 22:20:58 +00:00
Josh Gao 770a6a4d46 adbd: reduce the USB buffer sizes to 16k.
Some USB controllers only support 16k writes, so drop down to that.

Bug: http://b/130622010
Test: treehugger
Change-Id: I836d5b2d0d6fcae05f290af11a6a19c6e8d7c1ba
2019-04-16 15:14:24 -07:00
Treehugger Robot 220241f266 Merge "mini-keyctl: fix key id parsing by "0x" prefix" 2019-04-16 20:51:53 +00:00
Josh Gao 18cb681247 debuggerd: call setsid in our children.
There appears to be a kernel bug that causes SIGHUP and SIGCONT to be
sent to the parent process group we spawn from if the process group
contains stopped jobs (e.g. the parent itself, because of wait_for_gdb).

Call setsid in all of our children to prevent this from happening.

Bug: http://b/31124563
Test: adb shell 'setprop debug.debuggerd.wait_for_gdb 1; killall -ABRT surfaceflinger'
Change-Id: I1a48d70886880a5bfbe2deb80d48deece55faf09
2019-04-16 13:17:08 -07:00
Treehugger Robot e1d4648f46 Merge "crasher: add execute-only memory ("xom")." 2019-04-16 12:28:25 +00:00
Treehugger Robot 6aa0d7eaf8 Merge "init: fix loglevel docs." 2019-04-16 07:32:47 +00:00
Victor Hsieh 17aaee2f05 mini-keyctl: fix key id parsing by "0x" prefix
Otherwise, ParseInt treats the input as decimal and fails.

Test: add key works
Bug: None
Change-Id: I144ab0bba519c7630e702562bfb54118a389908e
2019-04-15 15:19:08 -07:00
Yifan Hong 402633d605 init: add umount_all builtin.
umount_all is the cleanup step for mount_all.

In particular, the mount_all builtin creates a verity device,
'postinstall-verity', for the following line:

system /postinstall ... ... slotselect_other,logical,avb_keys=...

cppreopt umounts /postinstall but doesn't destroy the postinstall-verity
device, causing OTA to fail (because it cannot destroy the
system_[other] device). umount_all also destroy the verity device.

Note that mount_all does not map system_[other]; it is mapped by
first stage init. Hence, umount_all doesn't destroy it either. The OTA
client is reponsible for unmapping the device itself.

Bug: 129988285
Test: flash, boot, then check `dmctl list devices`, then OTA

Change-Id: Id3ab65b3860b6ea6cfec310ab13652009c81f415
Merged-In: Id3ab65b3860b6ea6cfec310ab13652009c81f415
2019-04-15 15:11:28 -07:00
Christopher Ferris a853a2f8ec Merge "Fix pc/function name for signal handler frame." 2019-04-15 20:29:40 +00:00
Elliott Hughes dd04c658c3 crasher: add execute-only memory ("xom").
Test: `crasher thread-xom`
Change-Id: Ia121848df966040968370e1e9cb840034d780e4f
2019-04-15 13:03:48 -07:00
Elliott Hughes 8457f52ba9 init: fix loglevel docs.
Bug: http://b/129989984
Test: N/A
Change-Id: Ie7b320fd47dec839ad79d677eb90050cfbcf50c3
2019-04-15 12:17:22 -07:00
David Anderson 2c561d18d8 Merge "liblp: Use ro.boot.slot_suffix rather than ro.build.ab_update." 2019-04-15 18:55:51 +00:00
David Anderson fcb8b96145 Merge "Handle empty strings in GetPartitionAbsolutePath." 2019-04-15 18:49:56 +00:00
Hridya Valsaraju 8efadf70e1 Handle failed usb/reads and writes correctly
Currently if the device is unplugged from host,
there is a lot of log spamming since fastbootd
does not not recognize that the device has been
disconnected and keeps trying to read/write to the
device.

2856 printk messages dropped ** [  169.941904] c7    579 fastbootd: aio: got error event on
read total bufs 1: No such devie
** 2960 printk messages dropped ** [  169.953328] c7    579 fastbootd: Fastboot command:
** 2074 printk messages dropped ** [  169.961355] c7    579 fastbootd: aio: got error event
on read total bufs 1: No such devie

Bug: 121333158
Test: unplug device and check for log spam multiple times

Change-Id: I1d4c6f48f34e313c5ebce23d62a4fe6a6373f94f
2019-04-15 10:36:42 -07:00
Christopher Ferris d11ed86d65 Fix pc/function name for signal handler frame.
This refactors the step function slightly to split it up into
distinct pieces since the code needs to handle a signal handler
versus normal step slightly differently.

Add a new error for an invalid elf.

Modify libbacktrace code to handle new error code.

Bug: 130302288

Test: libbacktrace/libunwindstack unit tests.
Change-Id: I3fb9b00c02d2cf2cc5911541bba0346c6f39b8e6
2019-04-12 17:23:18 -07:00
David Anderson 82dee3ea69 liblp: Use ro.boot.slot_suffix rather than ro.build.ab_update.
Bug: 130433329
Test: liblp_test gtests
Change-Id: I229f582dc829884e4e90187981902cd4d45637c6
2019-04-12 16:59:31 -07:00
David Anderson 243887b1e1 Handle empty strings in GetPartitionAbsolutePath.
Bug: N/A
Test: liblp_test gtests
Change-Id: I2440da17aa842d996a37d27b4bfba89ce71321d8
2019-04-12 16:59:30 -07:00
Martin Stjernholm 8a9a1c5056 Merge "Describe the reason for the allow_all_shared_libs from the runtime namespace better." 2019-04-12 15:42:11 +00:00
Treehugger Robot 3569a8817d Merge "fs_mgr: overlay check shared blocks for / if /system is not" 2019-04-12 05:38:03 +00:00
Treehugger Robot 543fdbefe6 Merge "avb_ops: support reading from a logical partition" 2019-04-12 00:04:49 +00:00
Mark Salyzyn d6ef9d2411 fs_mgr: overlay check shared blocks for / if /system is not
For bringup devices that do not have right-sized partition, and if
/system is now root, check / to be sure.

Consider unshare blocks for ext4 as dead code, provide a strong
message to caller to provide all the dependencies to overlayfs.

Test: adb-remount-test.sh
Bug: 130327601
Change-Id: Iffa7c5f24d8f409e71f89fe9ece274d8c476f6fc
2019-04-11 16:04:54 -07:00
Treehugger Robot 1a17b09174 Merge "Allow fuzzy_fastboot number to run for a specific device serial number" 2019-04-11 22:33:22 +00:00
Treehugger Robot 1af42f6473 Merge "fs_mgr: overlay: only use system_<other> if other slot suffix not blank" 2019-04-11 20:32:32 +00:00
Hridya Valsaraju b9051a3e65 Allow fuzzy_fastboot number to run for a specific device serial number
Test: ./fuzzy_fastboot --serial=826X003L --gtest_filter=*Logical*
Bug: 117181762
Change-Id: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
2019-04-11 09:52:09 -07:00
Mark Salyzyn 38af717a83 fs_mgr: overlay: only use system_<other> if other slot suffix not blank
Test: adb-remount-test.sh
Bug: 129988285
Change-Id: Ib929d242e7cc4953096eb6300bcf7888ce2259ab
2019-04-11 09:48:45 -07:00
Martin Stjernholm 609236f66c Describe the reason for the allow_all_shared_libs from the runtime namespace
better.

Test: N/A - comment change only
Bug: 119867084
Change-Id: I80743236f95cedc43b8f80ac32a09ac0094f779e
2019-04-11 13:54:44 +01:00
Bowgo Tsai 84d4933686 avb_ops: support reading from a logical partition
On some devices (e.g., emulator), init needs to read AVB footer from
a logical partition because:

   1) Dynamic/logical partition is enabled
   2) The partition is AVB chained, i.e., need to locate footer from the end
   3) Logical partition is not understandable by bootloader,
      but there is no bootloader in this case

Bug: 125540538
Bug: 128434470
Test: boot and force the fallback path, to check it can get logical path
Change-Id: Ie304bce234cbf0f938f386f7ce59235c851e0e2d
2019-04-11 10:58:30 +08:00
Yifan Hong 8bb464c2b4 Merge "charger: Allow to rw /sys/power/[state,wakeup_count]" 2019-04-10 18:34:18 +00:00
Maciej Żenczykowski c620463f77 Merge "Make the SocketListener control pipe O_CLOEXEC." 2019-04-10 17:49:38 +00:00
Treehugger Robot 54785507f0 Merge "first-stage mount: support using other avb_keys" 2019-04-10 15:29:21 +00:00
David Anderson ca66aac289 Merge "Fix ART build bustage." 2019-04-10 04:43:48 +00:00
Lorenzo Colitti dae0195380 Make the SocketListener control pipe O_CLOEXEC.
Children of processes that use SocketListener should not be able
to stop the SocketListener.

Test: builds, boots
Test: atest libsysutils_tests
Test: atest --test-mapping system/netd
Change-Id: I64898d9966f62004468b8e8a43b59be4a81a8cc4
2019-04-10 12:11:42 +09:00
Treehugger Robot 3458bb6ce1 Merge "introduce auditctl and use it to configure SELinux throttling" 2019-04-10 02:29:24 +00:00
Treehugger Robot 15074de25c Merge "fs_mgr: overlay: wait for logical partition to be created" 2019-04-10 02:04:37 +00:00
Treehugger Robot 8b39c113f9 Merge "libmeminfo/procrank: Ignore failures when process disappears." 2019-04-09 23:53:23 +00:00
David Anderson 569bff76fe Fix ART build bustage.
Bug: 130244092
Test: builds
Change-Id: I1e3f7e167716101809d788e5aa41c672046569e0
2019-04-09 23:50:11 +00:00
Mark Salyzyn 4c5d1f8245 fs_mgr: overlay: wait for logical partition to be created
Test: adb-remount-test.sh
Bug: 130238923
Change-Id: Iaff01565d6df5c4434e66f742ed0939f61f6005a
2019-04-09 14:13:48 -07:00
Yifan Hong 122e78248e charger: Allow to rw /sys/power/[state,wakeup_count]
charger needs to suspend the device when the power goes away
when it doesn't have root. These two files are marked with
group system, user system, mode 0600 in 'on boot', but
it is not executed in charger. Hence, move these actions
to 'on init'.

Test: no failure in libsuspend in charger

Bug: 129138950

Change-Id: I787b935b4ff6177601329aeedccdac361b119ca3
Merged-In: I787b935b4ff6177601329aeedccdac361b119ca3
2019-04-09 13:35:07 -07:00