summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [logd] Modernize codebase by replacing NULL with nullptrYi Kong2018-07-131-4/+4
| | | | | | | | Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I15ccb9cfc9967dae4320d9690f5097bc2f7d5bfe
* Remove execute bit for source filesYi Kong2018-07-131-0/+0
| | | | | Test: ls -l Change-Id: Id09514a03f82c89e6350a5f9e34b9ef8bfe27b7e
* logd: enhance multiple blocking readers performanceHao Wang2017-12-051-6/+6
| | | | | | | | | | | | | | | | | | | | | | logd suffers performance degradation when multiple blocking readers connect to it. Each time when the writer thread log new entries, all of the readers are notified regardless of which log id they are watching. In this case, only give notification to the readers who are actually watching new entries' log id. This decreases logd CPU consumption by skipping unnecessary LogBuffer::flushTo loops. Test: liblog-unit-tests, logd-unit-tests & CtsLiblogTestCases logcat-unit-tests Test: manual: 1.'logcat –b all' at constant heavy logging load level 2.simultaneously 'logcat –b crash' in another session, a healthy crash buffer usually keep empty 3.logd CPU consumption doesn't increase after step 2 Change-Id: I4ffc045c9feb7a0998f7e47ae2173f8f6aa28e8a
* Buffer overrun in __android_log_is_loggable() fixPaul Elliott2017-11-071-3/+7
| | | | | | | | | | | | | | Fix for buffer overrun when a tag that is too big is sent to logd. Buffer supplied is precisely the right size for max message length however strlen will be run on the buffer, so need to ensure null terminator, otherwise any strlen will go off the end of the buffer. Also converted LogBuffer::Log() over to use the safer strnlen in the case where it is measuring the buffer (and converted over to using __android_log_is_loggable_len()) Signed-off-by: Paul Elliott <paul.elliott@arm.com> Test: liblog.android_log_buf_print__maxtag Change-Id: I3cb8b25af55943fb0f4658657560eb2300f52961
* logd: validate and fill in socket credentialsMark Salyzyn2017-05-111-1/+27
| | | | | | | | | | | | | | | | - android::pidToUid() additional checking. Make sure if we have to convert a PID to an UID that the parse of /proc/<pid>/status requires a trailing space after the number - android::tidToPid() added, in the same vein as android::pidToUid(). - stats.tidToPid() added - If no credentials, set PID to 0 and UID to DEFAULT_OVERFLOWUID - If credentialed PID is 0, use stats.tidToPid() - If credentialed UID is DEFAULT_OVERFLOWUID, use stats.pidToUid() Test: remove +passcred from logd.rc for daemon and confirm very few UID=65534 or PID=0 cases actually show up Bug: 37985222 Change-Id: I7d20506e70e67beb3043d1537cf9450ab58dc278
* logd: add "+passcred" for logdw socketMark Salyzyn2017-05-081-5/+5
| | | | | | | | Tell init to set SO_PASSCRED on the socket before bind() and handoff. Test: gtest logd-unit-test --gtest_filter=logd.statistics right after boot Bug: 37985222 Change-Id: I318969ee3241834e5326233aabd97e52ef505969
* Modularize logd.Chenjie Luo2017-04-281-6/+9
| | | | | | | | | | | Separates logd body into a static library liblogd and virtualize LogBuffer::log to be in a new interface class LogBufferInterface. User could have different implementation. Bug: 37756450 Test: liblog-unit-tests, logd-unit-tests and logcat-unit-tests with (b/37791296). Change-Id: I1504ff0e992744001b5a2e9abd45692d1318a152
* logd: specify clang formatMark Salyzyn2017-03-131-30/+24
| | | | | | | | | Switch _all_ file's coding style to match to ease all future changes. SideEffects: None Test: compile Bug: 35373582 Change-Id: I470cb17f64fa48f14aafc02f574e296bffe3a3f3
* system/core: preparation to pull back interfaces from android/log.hMark Salyzyn2016-10-201-1/+0
| | | | | | | | | | | | | | | | Point to log/log.h where necessary, define LOG_TAG where necessary. Accept that private/android_logger.h is suitable replacement for log/logger.h and android/log.h. Correct liblog/README Effectively a cleanup and controlled select revert of 'system/core: drop or replace log/logger.h' and 'system/core: Replace log/log.h with android/log.h'. Test: compile Bug: 30465923 Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
* Use alignas for alignment.Elliott Hughes2016-06-061-1/+1
| | | | Change-Id: I427c407a188682a360c74b2bd5a44dd62551ea66
* logd: Allow (some) headers to be individually importableMark Salyzyn2016-02-241-0/+1
| | | | | | | | | | | | LogReader.h needs to be individually importable. Fix a few others, drop includes of local includes, let them be included in source instead and allow headers to be included alphabetically. Was not a complete audit since goal was to separate LogReader.h out from the pack. Bug: 27242723 Change-Id: Ic7759ef90995e5bd285810706af33550c73cf5b5
* Revert "logd: security buffer only AID_SYSTEM reader"Mark Salyzyn2016-01-261-13/+1
| | | | | | This reverts commit 756332e88b98018d82f225c54734be3d76102bfc. Change-Id: Ib8607ac758b7e88a9db716ec4274ec0e4e3dc596
* logd: security buffer only AID_SYSTEM readerMark Salyzyn2016-01-261-1/+13
| | | | | Bug: 26029733 Change-Id: I140e5eb8bb39271fa674744651127e3fc545cbe8
* logd: unaligned access on security bufferMark Salyzyn2016-01-121-1/+2
| | | | | Bug: 26485626 Change-Id: I990447ca59982bb2de15decda575fd0e2838b5ed
* logd: simpleperf inspired optimizationsMark Salyzyn2015-12-151-1/+3
| | | | | | | | memset is hot on log writes with too much overhead, not required. Bug: 24444530 Bug: 23685592 Change-Id: Ibe3c83abca6774fc79a3be461f2f1585f4a9b1ff
* logd: liblog: logcat: Add LOG_ID_SECURITYMark Salyzyn2015-12-081-0/+7
| | | | | | | | | | | | | | - Largish commit, buffer and access controls done together - Add LOG_ID_SECURITY binary content log - Add "default" meta buffer - allow LOG_ID_SECURITY only from AID_SYSTEM and AID_ROOT UID & GID - Use __android_log_security() to gate logging - Add __android_log_security_bwrite() native access to security logging. - Add liblog.__security_buffer end-to-end gTest Bug: 26029733 Change-Id: Ibcf5b4660c17c1aa6902c0d93f8ffd29c93d9a93
* logd: CleanupMark Salyzyn2015-05-121-5/+5
| | | | | | | - Android Coding Standard for Constructors - Side effects NONE Change-Id: I2cda9dd73f3ac3ab58f394015cb810820093d47b
* logd: Add klogdMark Salyzyn2015-05-121-1/+1
| | | | | | | | | | | | | | | | - Add a klogd to collect the kernel logs and place them into a new kernel log buffer - Parse priority, tag and message from the kernel log messages. - Turn off pruning for worst UID for the kernel log buffer - Sniff for 'PM: suspend exit', 'PM: suspend enter' and 'Suspended for' messages and correct the internal definition time correction against monotonic dynamically. - Discern if we have monotonic or real time (delineation 1980) in audit messages. - perform appropriate math to correct the timestamp to be real time - filter out any external sources of kernel logging Change-Id: I8d4c7c5ac19f1f3218079ee3a05a50e2ca55f60d
* logd: propagate ::log statusMark Salyzyn2015-04-151-4/+5
| | | | | | | | | | | | | Add a return value for the ::log() methods, this allows us to optimize the wakeup for the readers to only occur when the log message is actually placed. This is for a future where we may dedupe identical log messages, filter out log messages, and certainly if we filter the messages out with an internal logd check of __android_log_is_loggable(). Change-Id: I763b2a7c29502ab7fa0a5d5022c7b60244fcfde4
* logd: syscall optimizationMark Salyzyn2015-04-011-2/+7
| | | | | | | - prset(PR_SET_NAME) call once - No need to call getuid(), should be AID_LOGD Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
* logd: create private/android_logger.hMark Salyzyn2015-01-231-16/+8
| | | | | | | | | - create a structure to depict the private header expected at logd end of socket. - utilize this new structure instead of unscalable byte stream technique used to unpack in logd. Change-Id: I2d0e5c3531c279f2dc1fbd74807210ff8d804de0
* logd: build breakage in git_master-nova @ 1151709Mark Salyzyn2014-05-021-1/+1
| | | | Change-Id: Ic7920d1b0930155c20a896720a79af62f8acacc1
* logd: add logd.auditd propertyMark Salyzyn2014-04-291-5/+5
| | | | | | | | - permit us a mechanism to disable auditd - standardize property boolean Bug: 14275676 Change-Id: I76f245c6aee511ed44274159e0ea55915b484dda
* logd: add thread setnameMark Salyzyn2014-04-281-0/+3
| | | | | | | - permits easier determination of logd thread at fault in a stack trace from debuggerd. Bug: 14275676 Change-Id: Iac2c523147e2bcce34ab7ddcecd02582c5fa7cc0
* logd: liblog: ALOG silently drops excessively long messagesMark Salyzyn2014-04-241-1/+1
| | | | | Bug: 14280914 Change-Id: Idddd29784625094e54144953c29f64692a88eee9
* logd: libsysutils: logd startup outside init environmentMark Salyzyn2014-04-171-1/+9
| | | | Change-Id: I3426b6c3eebdd0c8258e966dcaaaa2825d7a23d1
* Merge "logd: compile warning message"Mark Salyzyn2014-03-241-1/+1
|\
| * logd: compile warning messageMark Salyzyn2014-03-211-1/+1
| | | | | | | | Change-Id: I7ddd010031299395cad96f1743d7a7e6a6866b4c
* | logcat: white and blacklist failureMark Salyzyn2014-03-211-1/+3
|/ | | | | | | | - logcat improperly squashes out count - logcat test enhanced to catch failure - logd places entries in ascending sorted order Change-Id: If39d8e2c40852b520c98e7840034ab63c2538e5d
* logd: liblog: Thread IDs missing from logcat -v threadMark Salyzyn2014-03-211-3/+8
| | | | | | | - stuff caller's thread id into the packet. Bug: 13568206 Change-Id: I02d0cdf9b1d9e839ff8969f591db42dfe6e4cc95
* logd: Logging is truncatedMark Salyzyn2014-03-181-1/+2
| | | | | | | - stack buffer undersized Bug: 13514601 Change-Id: I3e5dda2daa7531ddcacece33dfdecaa28dcca765
* logd: initial checkin.Mark Salyzyn2014-02-261-0/+108
* Create a new userspace log daemon for handling logging messages. Original-Change-Id: I75267df16359684490121e6c31cca48614d79856 Signed-off-by: Nick Kralevich <nnk@google.com> * Merge conflicts * rename new syslog daemon to logd to prevent confusion with bionic syslog * replace racy getGroups call with KISS call to client->getGid() * Timestamps are filed at logging source * insert entries into list in timestamp order * Added LogTimeEntry tail filtration handling * Added region locking around LogWriter list * separate threads for each writer * /dev/socket/logd* permissions Signed-off-by: Mark Salyzyn <salyzyn@google.com> (cherry picked from commit 3e76e0a49760c4970b7cda6153e51026af98e4f3) Author: Nick Kralevich <nnk@google.com> Change-Id: Ice88b1412d8f9daa7f9119b2b5aaf684a5e28098