Commit graph

26837 commits

Author SHA1 Message Date
Jerry Zhang
55205a565b adb: Pre allocate kernel memory
This allows reliable use of larger buffer sizes.
Max r/w size is set only when that preallocation
is successful so that memory is guaranteed to be
available.

Bug: 31722483
Test: adb push with multi GB files
Change-Id: Ia0459ca051988abb144645871792e8f840dd3ff7
2017-02-13 14:20:47 -08:00
Treehugger Robot
e499403bf4 Merge "init.rc: create /data/misc/reboot for storing reboot reason" 2017-02-10 21:33:36 +00:00
Treehugger Robot
936738b8f7 Merge "bootstat.rc: record post_decrypt_time_elapsed only for FDE device" 2017-02-10 21:32:30 +00:00
Todd Poynor
44ee2b0ef8 init.rc: create /data/misc/reboot for storing reboot reason
Create /data/misc/reboot if not already.

Bug: 30994946
Test: manual: reboot command; modified thermal-engine.conf
Change-Id: I66418beba539f76759b44742af7700f26a2c1f87
2017-02-10 19:26:13 +00:00
Neil Fuller
cee583bc53 Merge "Documentation improvements" 2017-02-10 15:16:43 +00:00
Neil Fuller
0ef5727905 Merge "Rename "Bundle" to "Distro"" 2017-02-10 14:55:44 +00:00
Neil Fuller
3cf4b8664a Merge "Add bundle format minor version check logic" 2017-02-10 13:02:35 +00:00
Treehugger Robot
f803afaa65 Merge "fs_mgr: removing the dependency of requiring /vbmeta in fstab for AVB" 2017-02-10 06:21:14 +00:00
Treehugger Robot
f2e615c7b8 Merge "cutils: Add clang FORTIFY support" 2017-02-10 02:07:28 +00:00
Treehugger Robot
c33ba01a71 Merge "Add permission bits to open() with O_CREAT." 2017-02-10 02:07:28 +00:00
Treehugger Robot
d7b5c7b2da Merge "Add a sample service for testing init." 2017-02-10 01:40:12 +00:00
Treehugger Robot
9fcabf739b Merge "Check against LOG_ID_MAX instead of LOG_ID_KERNEL" 2017-02-10 01:14:23 +00:00
Treehugger Robot
bab6ec555c Merge "Only allow system to write to existing input nodes." 2017-02-10 00:15:24 +00:00
Connor O'Brien
6e0dd6285e Merge "Fastboot: use flash erase & logical block size for building userdata" 2017-02-10 00:01:41 +00:00
Jorge Lucangeli Obes
28e980b59c Add a sample service for testing init.
I find myself using something like this every time I add functionality
to init. I cannot possibly be the only one doing this. On the other
hand, if this hasn't been added for so long, maybe there's a reason
for that.

The advantage of using a test service versus modifying an existing
service is that the test service doesn't *require* any permissions or
privileges, so you can add and/or remove whatever you need to test
without breaking the service.

I found it useful to have the service check its own /proc/<pid>/status
from command-line arguments, so that's what the service does.

This CL also adds a .clang-format file for init.

Bug: None
Test: Service runs and exits successfully.

Change-Id: I3e7841a7283158e10c0bf55e0103c03902afb1f0
2017-02-09 18:23:09 -05:00
Michael Wright
344e929e6d Only allow system to write to existing input nodes.
This prevents the shell user from injecting input as if it were coming
from an existing input device, which in turn makes it easier for malware
/ abuse analysis to detect when someone is injecting input via the
command line vs a real user using a device.

(cherrypick of 95637eb2a332b9a09914b1bf32c10fccfba4a175.)

Bug: 30861057
Test: ran getevent, saw correct output, played with device
Change-Id: Ib53eea1b7767f25510b5d36fe6109101a9fad8e0
2017-02-09 14:45:25 -08:00
Treehugger Robot
d54d4c275e Merge "ueventd: source ueventd configs from vendor and odm" 2017-02-09 21:25:44 +00:00
George Burgess IV
67959bceb2
cutils: Add clang FORTIFY support
Bug: 32073964
Test: Builds on angler, bullhead, marlin, sailfish. Bionic CTS tests
pass on Angler and Bullhead.

Change-Id: I3d7f8ff73f92b1deb1e07f08282098e71e2d03a9
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
2017-02-09 20:18:19 +01:00
bowgotsai
72ffff70fc fs_mgr: removing the dependency of requiring /vbmeta in fstab for AVB
Remove polling_vbmeta_blk_device() as it tries to get /vbmeta entry
from fstab. Also move the polling of a partition inside read_from_partition()
in fs_mgr_avb_ops.cpp as it's where the reads happen.

Bug: 31264231
Test: Device can boot with AVB

Change-Id: Id717e160b085eca42eb9bc5eb2fa7e658bea3ad6
2017-02-10 02:20:22 +08:00
Wei Wang
bd6ab49555 bootstat.rc: record post_decrypt_time_elapsed only for FDE device
Bug: 35110957
Test: on marlin
Change-Id: Id32f65ad4d693dcf52f1581bf55b3fe671c985cc
2017-02-09 10:09:22 -08:00
Treehugger Robot
ce07b6fa4f Merge "fix warning: Null pointer argument in call to memory comparison function" 2017-02-09 17:20:14 +00:00
Mark Salyzyn
71c0993126 Merge changes Ia23b932a,I33e8a0ca,I0a5e7939,I13db1f45,I2a9dba81, ...
* changes:
  liblog: add local_logger
  liblog: add __android_log_config_*_close()
  liblog: add android_log_logger_list management
  liblog: add logprint to host build
  liblog: benchmark: Use local LOGGER_NULL frontend
  liblog: Add android_set_log_frontend
2017-02-09 15:30:47 +00:00
Neil Fuller
c65c61b4d5 Documentation improvements
Tweaks for documentation. Mostly to point out that the constants
are duplicated in Java code.

Bug: 31008728
Test: mmm tzdatacheck
Change-Id: I068c09cfc6109a7567ad7e08edcecad40be831b3
2017-02-09 13:47:03 +00:00
Neil Fuller
16e6487575 Rename "Bundle" to "Distro"
Renaming "Bundle" to "Distro" because bundle is confusing
given android.os.Bundle.

Bug: 31008728
Test: mmm tzdatacheck
Change-Id: I70408678d67eed9f9e0424c0791e856c909837be
2017-02-09 13:31:57 +00:00
Neil Fuller
f54cadb83d Add bundle format minor version check logic
The code now checks the minor version for completeness.

Bug: 31008728
Test: Manual testing
Change-Id: I28840065f794bd28de6282e81dc55336f77ab2d1
2017-02-09 11:53:07 +00:00
George Burgess IV
d6f2e69624 Add permission bits to open() with O_CREAT.
It's an error to pass open O_CREAT without giving it mode bits:
https://linux.die.net/man/3/open

Bug: 32073964
Test: Compiles with clang FORTIFY.
Change-Id: I6b2a3694f85565afdeb782585c6af36e8c4d1557
2017-02-08 23:44:29 -08:00
Connor O'Brien
ce16a8a940 Fastboot: use flash erase & logical block size for building userdata
If the bootloader provides erase-block-size and logical-block-size
getvar variables, then pass these to libext4_utils when building a new
userdata image. This info is used to tune stride and stripe-width.

Bug: 33243520
Test: Modify fb_getvar to return values for "erase-block-size" and
"logical-block-size" and check that fastboot -w sets userdata
parameters correctly.
Signed-off-by: Connor O'Brien <connoro@google.com>

Change-Id: Id48b7a3ebb9074983a4422a79a64dcb437c0f888
2017-02-08 18:30:40 -08:00
Yunlian Jiang
33f671782a fix warning: Null pointer argument in call to memory comparison function
This fixes  warning: Null pointer argument in call to
memory comparison function [clang-analyzer-cplusplus.NewDeleteLeaks]

Bug: None
Test: The warning is gone.
Change-Id: I957365184966cc1435d7e37d64f2cc6a32846ebd
2017-02-08 16:47:20 -08:00
James Hawkins
23f4e6b0a5 Merge "Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."" 2017-02-09 00:12:54 +00:00
Mark Salyzyn
7100288532 liblog: add local_logger
- Create the local-only logger module
- Add LOGGER_LOCAL flag to android_set_log_frontend to enable
- Permit log reader for host compilation

android_set_log_frontend(LOGGER_LOCAL) will result in logs going
into application local memory.  logcat can not retrieve the data,
the user must utilize the log reading interface directly to
acquire their own logs.  Some local logger tests dropped as they
represent testing other liblog facilities.  Other local logger
tests dropped because we make the conscious decision to not
support LOG_ID_SECURITY logging.

ToDo: Some local logger tests dropped because of missing
      functionality associated with blocking reader.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests, liblog-benchmarks and CtsLiblogTestCases_list
Bug: 27405083
Change-Id: Ia23b932af9e05756eaa60bab9139876b14faf72d
2017-02-08 15:07:06 -08:00
James Hawkins
0e3167e203 Revert "bootstat: Remove custom uptime parser in favor of elapsedRealtime."
This reverts commit 26f40c04c3.

This change broke the Darwin SDK target.

Test: none
Change-Id: Ia54fe2c31da8d8fa2825e023b035fb8321dcd457
2017-02-08 14:16:51 -08:00
Sandeep Patil
bf298e6d0c ueventd: source ueventd configs from vendor and odm
While keeping the old /ueventd.$ro.hardware.rc configuration for devices
without early mount or vendor,odm split

b/34967636

Test: Boot angler and sailfish without regressions

Change-Id: I8d671911fd23fb1c0b5624ae209bad86137c88b7
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-08 13:51:02 -08:00
Mark Salyzyn
96432fc665 liblog: add __android_log_config_*_close()
Add __android_log_config_read_close() and
__android_log_config_write_close().  Fortify the list macros
to detect for list corruption, looking for entries pointing
to themselves, deleted entries in list.

Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I33e8a0cae7e202f1989ddd7c2a96752b44c8e746
2017-02-08 13:37:44 -08:00
Mark Salyzyn
cf983bcbae liblog: add android_log_logger_list management
Add list of android_log_logger_list entities as a way of
accessing the list of transport contexts from within
one of the transports.  This will enable us to iterate back
to an internal transport context which may house a last index
or signalling semaphore to propagate a wakeup on a blocking
read.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests
Bug: 27405083
Change-Id: I0a5e793946c020d97ffe10192369998e4ed92a83
2017-02-08 13:37:44 -08:00
Mark Salyzyn
62d0d2d683 liblog: add logprint to host build
- cleanup of some style issues
- resolve a few minor bugs
- add -lrt for host so that clock_gettime can be issued
- enable write-only logging, logprint and event list
  handling tests for host consumption.

NB: CtsLiblogTestCases_list is only outlet for host testing of
    the interfaces, but it is not part of any automated testing

Test: gTest liblog-unit-tests, liblog-benchmarks and
      CtsLiblogTestCases_list && build mmma system/core/liblog
Bug: 27405083
Change-Id: I13db1f45f67569407587a5a909248de33809b8cf
2017-02-08 13:37:44 -08:00
Mark Salyzyn
8f2492f582 liblog: benchmark: Use local LOGGER_NULL frontend
Additional benchmarks to check the effects and performance of the
frontend changes.

Test: manual liblog-benchmarks
Bug: 27405083
Change-Id: I2a9dba81b70e9d71cdb8de1b35e8dff099ad6038
2017-02-08 13:37:44 -08:00
Mark Salyzyn
850d06e1c9 liblog: Add android_set_log_frontend
android_set_log_frontend allows one to select LOGGER_DEFAULT,
LOGGER_LOGD or LOGGER_NULL, the latter allows a runtime mechanism to
turn logging on or off.  LOGGER_DEFAULT is LOGGER_LOGD.

Test: gTest liblog-unit-tests notably liblog.android_set_log_frontend
      and liblog-benchmarks before and after.
Bug: 27405083
Change-Id: I365dbee9f7d83112da0ef8d1cace748d247773c8
2017-02-08 13:37:41 -08:00
Josh Gao
ec5d6cb8fd Merge changes I1a28c21c,I02faec3b,I16a2050b
* changes:
  crash_dump: collect open files before dropping caps.
  debuggerd_test: improve error when crasher fails to exec.
  debuggerd_test: fix crasher path.
2017-02-08 19:31:57 +00:00
Treehugger Robot
914955ae9e Merge "bootstat: Remove custom uptime parser in favor of elapsedRealtime." 2017-02-08 17:28:12 +00:00
Treehugger Robot
a3b6d30ba7 Merge "liblog: fix an undefined-behavor in __write_to_log_daemon()" 2017-02-08 17:21:58 +00:00
Treehugger Robot
a8629e8e15 Merge "liblog: fix a memory leak in __android_log_pmsg_file_write()" 2017-02-08 16:50:09 +00:00
Ting-Yuan Huang
6efb877973 liblog: fix an undefined-behavor in __write_to_log_daemon()
The behavior of passing NULL to c-string functions is undefined.

Test: passed clang-tidy checks
Bug: none

Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
2017-02-07 16:42:53 -08:00
Ting-Yuan Huang
106c3e6189 liblog: fix a memory leak in __android_log_pmsg_file_write()
Free the strdup()-ed filename before returning error.

Test: passed clang-tidy checks
Bug: none
Change-Id: I555492cb4e50400db758f7c721647a8747874a01
2017-02-07 15:53:32 -08:00
James Hawkins
26f40c04c3 bootstat: Remove custom uptime parser in favor of elapsedRealtime.
Refactored init/utils/boot_clock into base/chrono_utils.

Bug: 34352037
Test: none
Change-Id: Ied0c00867336b85922369d7ff37520e3d28fc61e
2017-02-07 15:43:32 -08:00
Mark Salyzyn
8eb237ad57 Merge "liblog: logger.h fortify comments" 2017-02-07 23:36:55 +00:00
Mark Salyzyn
7048f0b1cb liblog: logger.h fortify comments
Test: none
Bug: 27405083
Change-Id: I88ae9f33daa457454edfc5e95cb9e9e74e8cd5f0
2017-02-07 14:16:09 -08:00
Josh Gao
c24cc8a9e5 crash_dump: collect open files before dropping caps.
/proc/<pid>/fd is also limited by ptrace_may_access.

Test: manual inspection of "debuggerd -b `pidof zygote`"
Change-Id: I1a28c21c0438fe8729bd8e041c6b418d6a84c586
2017-02-07 13:36:08 -08:00
Josh Gao
7a0ee64f9d debuggerd_test: improve error when crasher fails to exec.
Bug: http://b/35100742
Test: rm /system/bin/crasher && /data/nativetest/debugerd_test/debuggerd_test32
Change-Id: I02faec3b7f7ef62bb8a2ac2af730506e3d28e03e
2017-02-07 13:36:08 -08:00
Josh Gao
a7d7eb6d2a debuggerd_test: fix crasher path.
https://android-review.googlesource.com/#/c/331200 moved crasher to
using soong, which changed its location from /system/xbin/crasher to
/system/bin/crasher.

Bug: http://b/35100742
Test: /data/nativetest/debuggerd_test/debuggerd_test32
Test: /data/nativetest64/debuggerd_test/debuggerd_test64
Change-Id: I16a2050b257277023773cc0c960b5ab36e0c7cd4
2017-02-07 13:13:48 -08:00
Elliott Hughes
887b6b9a4b Merge "Don't print 168^W143 lines of help when someone makes a typo." 2017-02-07 20:51:41 +00:00