summaryrefslogtreecommitdiffstats
path: root/init/log.cpp
Commit message (Collapse)AuthorAgeFilesLines
* init: fix signal handling and LOG(FATAL) in child processesTom Cherry2017-08-251-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | Child processes inherit the signal handlers and the 'Aborter' for logging from their parent process. In the case of init, fork()'ed processes, will attempt to reboot the system if they receive a fatal signal or if they call LOG(FATAL). This is not the correct behavior; these processes should terminate due to the provided signal like other processes on the system. This is particularly important as there are multiple LOG(FATAL) calls in service.cpp for failures after fork() but before execv() when a service is started. Note, that pthread_atfork() is not a viable solution since clone() is used in some cases instead of fork() and atfork handlers are not called with clone(). Test: LOG(FATAL) from a child process of init and see that it terminates due to a signal correctly Test: LOG(FATAL) from init proper and see that it reboots to the bootloader Change-Id: I875ebd7a5f6b3f5e3e2c028af3306917c4409db3
* init: replace panic() with LOG(FATAL)Tom Cherry2017-08-171-2/+20
| | | | | | | | | | | Test: boot bullhead Test: Introduce LOG(FATAL) at various points of init and ensure that it reboots to the bootloader successfully Test: Introduce LOG(FATAL) during DoReboot() and ensure that it reboots instead of recursing infinitely Test: Ensure that fatal signals reboot to bootloader Change-Id: I409005b6fab379df2d635e3e33d2df48a1a97df3
* init: create android::init:: namespaceTom Cherry2017-06-231-0/+6
| | | | | | | | With some small fixups along the way Test: Boot bullhead Test: init unit tests Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
* Revert "Send property_service AVC messages to the kernel audit system"Elliott Hughes2017-04-141-28/+2
| | | | | | This reverts commit 8adb4d9d12d077ee87d1ce97742c6a5ba9aaaf9f. Change-Id: I0db29617f323ef31ca5a270d02b7668092e9c9e1
* init: more header cleanupTom Cherry2017-04-061-1/+2
| | | | | | | | | | Remove includes of "log.h" that really want <android-base/logging.h> Fix header include order Remove headers included in .cpp files that their associated .h already includes Remove some unused headers Test: boot bullhead Change-Id: I2b415adfe86a5c8bbe4fb1ebc53c7b0ee2253824
* Send property_service AVC messages to the kernel audit systemNick Kralevich2017-01-031-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | The property service uses an SELinux userspace check to determine if a process is allowed to set a property. If the security check fails, a userspace SELinux denial is generated. Currently, these denials are only sent to dmesg. Instead of sending these denials to dmesg, send it to the kernel audit system. This will cause these userspace denials to be treated similarly to kernel generated denials (eg, logd will pick them up and process them). This will ensure that denials generated by the property service will show up in logcat / dmesg / event log. After this patch, running "setprop asdf asdf" from the unprivileged adb shell user will result in the following audit message: type=1107 audit(39582851.013:48): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=u:r:init:s0 msg='avc: denied { set } for property=asdf pid=5537 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service' Test: manual Bug: 27878170 Change-Id: I0b8994888653501f2f315eaa63d9e2ba32d851ef
* Move init's kernel logging into libbase.Elliott Hughes2016-08-041-40/+3
| | | | | | | This will let other stuff (such as adbd and recovery) use it too. Bug: http://b/28467098 Change-Id: Idab51f438ed3edd6fe65a56c4b396eaff5f3833e
* Fix early init logging.Elliott Hughes2016-07-261-3/+7
| | | | | | | | | | | Remove the /dev/__kmsg__ workarounds (which can then be removed from sepolicy), and fix confusion in the translation between android-base logging and kernel logging priorities (in particular, where 'notice' comes in the hierarchy). Bug: http://b/30317429 Change-Id: I6eaf9919904b6b55bc402c20bf1a4ae269014bc7 Test: adb shell dmesg | grep init
* Make klog_fd thread-safe and make klog_init a no-op.Elliott Hughes2016-06-291-2/+16
| | | | | | | I'll come back and remove klog_init when I've removed other calls to it. Change-Id: Iad7fd26d853b4ddc54e9abd44516b6f138cbbfcb Test: booted N9, looked at "adb shell dmesg" output.
* Move init to libbase logging.Elliott Hughes2016-06-271-20/+25
| | | | Change-Id: Ibfbefeff587a69e948978a037c555fd12a5ade6a
* logging: avoid unnecessary printfsNick Kralevich2016-01-161-0/+2
| | | | | | | Don't spend CPU cycles formatting a bunch of strings if we're just going to throw them away later. Maybe make booting faster. Change-Id: I4d8eb99fb3fa873ca91cf776933d0ad01988abf5
* Track rename of base/ to android-base/.Elliott Hughes2015-12-041-1/+1
| | | | Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
* Clean up init /proc/cmdline handling.Elliott Hughes2015-05-071-12/+17
| | | | | | | | Helped debug a problem where the N9 bootloader incorrectly concatenated the various command lines. Bug: http://b/20906691 Change-Id: I0580b06f4185129c7eedf0bdf74b5ce17f88bf9c
* Log more timing information from init.Elliott Hughes2015-03-281-0/+62
Also make important events in init's life NOTICE rather than INFO, and ensure that NOTICE events actually make it to the kernel log. Also fix the logging so that if you have a printf format string error, the compiler now catches it. Also give messages from init, ueventd, and watchdogd distinct tags. (Previously they'd all call themselves "init", and dmesg doesn't include pids, so you couldn't untangle them.) Also include the tag in SELinux messages. Bug: 19544788 Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe