Commit graph

596 commits

Author SHA1 Message Date
Siarhei Vishniakou
278e099f10 Merge "Use ro.logd.kernel for kernel logcat" am: d443dd327a am: 66d9c4aab8
am: 11273bc5b1

Change-Id: I9a829bc6c88503279ef8188c38bf5cebb9d0962e
2018-01-16 19:01:37 +00:00
Treehugger Robot
d443dd327a Merge "Use ro.logd.kernel for kernel logcat" 2018-01-16 18:24:08 +00:00
Jeff Vander Stoep
b589cb7acc Merge "LogAudit: remove dynamic rate limiter" am: 9e7cec22e0 am: cf7f19f4b9
am: 9de839aeb7

Change-Id: I9ed04073db90617e0bc8e11e54dc7e798138ae65
2018-01-04 17:40:10 +00:00
Jeff Vander Stoep
54c7a5f1e7 LogAudit: remove dynamic rate limiter
Select a low rate-limit to cut down on logspam and resulting
performance regressions.

Functionally reverts 247d682fe1
(logd: sepolicy dynamic rate limiting) and sets a static low
rate-limit. Before 247d682f, the limit was statically set to 20.
247d682f continued to support 20, but if sustained dropped the limit
to 5. This revert leaves us at 5 so as not to impact performance.

Test: /data/nativetest/logd-unit-tests/logd-unit-tests \
    --gtest_filter=logd.sepolicy_rate_limiter
    [  PASSED  ] 1 test.
Bug: 71538411
Change-Id: I6c92f4ba825cc24beb8f1f1b79258fa8097c837b
2018-01-03 12:52:58 -08:00
Siarhei Vishniakou
e8ed36b6b3 Use ro.logd.kernel for kernel logcat
Prevent a possible DOS of the kernel logs because the runtime result
could differ from the boottime result.

Test: adb bugreport, then examine kernel log
Change-Id: I140fd465f2e691c751d92af50dbdf95e23c121d8
2018-01-02 10:47:50 -08:00
Julien Desprez
78a3f888bc Merge "Add suite component to test modules" am: 20bc9eb60b am: 9db200e4dc
am: 5271473fa1

Change-Id: Iab43c67bd3308cd33515ab6a20a33417968c7026
2017-12-19 18:52:41 +00:00
Julien Desprez
5b585791db Add suite component to test modules
Test: build
Bug: 65303193
Change-Id: I620c7034b9bdfa056dbde97c28bc5abc3375cc42
2017-12-18 18:08:53 +00:00
TreeHugger Robot
db87e6d15f Merge "Revert "add aid check when writting into logd stats buffer. For now we require aid to be system."" 2017-12-11 23:34:17 +00:00
Yao Chen
6ce5146320 Revert "add aid check when writting into logd stats buffer. For now we require aid to be system."
This reverts commit ec0c886da6.

I will submit the new permission check through AOSP. Revert this CL to avoid merge conflict.

Change-Id: I5d29ad2cda3579b37dd7136037af0c85c3917f6b
2017-12-08 23:49:26 +00:00
Elliott Hughes
3e2b34136a Merge "Add OWNERS." am: 3289b9c928 am: 515c8fe572
am: aede8375fe

Change-Id: I28f7a8f3fa9c9837f4043768e70c0d985ed95abd
2017-12-08 01:29:20 +00:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Hao Wang
f7fa9078b3 Merge "logd: enhance multiple blocking readers performance" am: 6740b9697e am: da620dff5f
am: ee56d405de

Change-Id: I3f394e9825222824b72e117294268a022cc08a0c
2017-12-05 20:41:26 +00:00
Hao Wang
da620dff5f Merge "logd: enhance multiple blocking readers performance"
am: 6740b9697e

Change-Id: Iedd4096dd37d30a605fc8e92b89e5715fc0c4300
2017-12-05 19:54:23 +00:00
Hao Wang
f6e2296953 logd: enhance multiple blocking readers performance
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
2017-12-05 18:46:24 +08:00
Yao Chen
3e1f33f44f Merge "make log.tag.stats_log work for stats buffer." am: 1e2ed53ffc am: 9e28024b42
am: 693a0fae38

Change-Id: Ic0345e098e77ff1fed6370a79b779efa3436a061
2017-12-04 21:21:55 +00:00
Yao Chen
9e28024b42 Merge "make log.tag.stats_log work for stats buffer."
am: 1e2ed53ffc

Change-Id: I5b81edb2c221eb8a7c5ab64316d788879d727c58
2017-12-04 21:17:18 +00:00
Treehugger Robot
1e2ed53ffc Merge "make log.tag.stats_log work for stats buffer." 2017-12-04 21:02:26 +00:00
Yao Chen
025f05a225 make log.tag.stats_log work for stats buffer.
Test: adb shell setprop log.tag.stats_log S
      And saw the stats logs are silent.

Change-Id: I7a9313f5f12029f9b8a8f070de1e1db659675525
2017-12-04 10:07:12 -08:00
Joel Galenson
26b7f2fce2 Merge "Remove unnecessary restorecon." am: f896d274bc am: a55ca79ba6
am: 09ce0bd399

Change-Id: I2a07046e169bf12c5480034bc1caff8894a5d494
2017-12-01 17:01:31 +00:00
Elliott Hughes
9b083809b7 Merge "std::string_view is no longer experimental." am: c8022a3efc am: 152d7e0f6c
am: 90fa16bf96

Change-Id: Iceb885677a03ae29b8d26b44916cdd6df2086a10
2017-12-01 17:00:38 +00:00
Joel Galenson
a55ca79ba6 Merge "Remove unnecessary restorecon."
am: f896d274bc

Change-Id: If23392b7c0ba23cce9a9f65b55aa4e48713d977e
2017-12-01 16:52:00 +00:00
Elliott Hughes
152d7e0f6c Merge "std::string_view is no longer experimental."
am: c8022a3efc

Change-Id: I75fa251cb6a959e7dfd32524b8d0ffcf839c3dc4
2017-12-01 16:51:24 +00:00
Treehugger Robot
f896d274bc Merge "Remove unnecessary restorecon." 2017-12-01 16:47:10 +00:00
Elliott Hughes
e805883a2b std::string_view is no longer experimental.
Bug: N/A
Test: builds
Change-Id: I8f022fdc3ebaebd8aa250414569485a752f98da7
2017-11-30 16:32:15 -08:00
Joel Galenson
fef8644f8d Remove unnecessary restorecon.
Now that creating a symlink in init automatically sets its
context, we do not need to call restorecon manually.

Bug: 69965807
Test: Booted device and tested wifi and camera.
Change-Id: I0863198f2c2bfce79566b5320c7ef035698f3afb
2017-11-30 15:39:43 -08:00
Xin Li
23e27db576 Merge commit 'a63ccea6abc7ea02e2d98e41c80793ca97237bd3' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: Ia33311cd1fd26dfaea59a69317b306fb91203c40
Merged-In: I03d06b10807e8a313c9654c2e1db36bfb59e3f99
2017-11-14 13:19:45 -08:00
Mark Salyzyn
aed16a5275 Merge "Buffer overrun in __android_log_is_loggable() fix" am: 35fc00124b am: ec193f26eb
am: 9b45da952c

Change-Id: I848ac7e4ee783845d96c2dbf057f759cebf2dae2
2017-11-08 16:15:58 +00:00
Mark Salyzyn
9b45da952c Merge "Buffer overrun in __android_log_is_loggable() fix" am: 35fc00124b
am: ec193f26eb

Change-Id: I7d46ddee38b267cf6523a7fca57f6705d89c9b5c
2017-11-08 16:13:51 +00:00
Paul Elliott
c6ed8f39d3 Buffer overrun in __android_log_is_loggable() fix
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
2017-11-07 09:57:26 -08:00
Nick Kralevich
c42f59711e Merge "Don't use TEMP_FAILURE_RETRY on close()" am: 0f2097c0f0 am: 72d7cbe78f
am: 4163af47dc

Change-Id: Icf9d3238780d3b808ab37644a8c6599f893e642f
2017-10-24 20:52:43 +00:00
Nick Kralevich
4163af47dc Merge "Don't use TEMP_FAILURE_RETRY on close()" am: 0f2097c0f0
am: 72d7cbe78f

Change-Id: I889fb09b36b07567154c4ba5c2c7c85bd3b302f9
2017-10-24 20:43:03 +00:00
Treehugger Robot
0f2097c0f0 Merge "Don't use TEMP_FAILURE_RETRY on close()" 2017-10-24 19:47:20 +00:00
Nick Kralevich
3d118e72dd Don't use TEMP_FAILURE_RETRY on close()
See https://lkml.org/lkml/2005/9/10/129 for details.

Bug: 20501816
Test: code compiles and boots with no obvious problems.
Change-Id: I5a9c470156d498852cfd81fbd59ddcf267309e73
2017-10-24 10:46:34 -07:00
Mark Salyzyn
5012c8beed Merge "CtsLogdTestCases#sepolicy_rate_limiter failure" am: 99691dfc74 am: 806f050f6d am: 9e3f4b057f
am: edb33628db

Change-Id: Ief247c51f153449a50bffdb7e8e3fdf06b156a00
2017-10-02 21:06:33 +00:00
Mark Salyzyn
edb33628db Merge "CtsLogdTestCases#sepolicy_rate_limiter failure" am: 99691dfc74 am: 806f050f6d
am: 9e3f4b057f

Change-Id: I7f8138337e77202a216c419b0ad7838bfc72e0c6
2017-10-02 20:58:13 +00:00
Mark Salyzyn
806f050f6d Merge "CtsLogdTestCases#sepolicy_rate_limiter failure"
am: 99691dfc74

Change-Id: Idbf8480ef783d70e42cc0175ca649fd56f133a5f
2017-10-02 20:41:06 +00:00
Mark Salyzyn
b825faeed7 CtsLogdTestCases#sepolicy_rate_limiter failure
Cts tests can run in appdomain, which have access to /data/backup/
which leads to zero injection of sepolicy signal to check the logd
and kernel rate limiter.  Switch to /data/drm/ as a better choice
to inject a sepolicy denial either due to dac_override or
dac_read_search because owned by the drm uid and gid, or due to
create sepolicy denial to u:object_r:drm_data_file:s0 to all but
select services.

Test: gTest
Bug: 65843095
Change-Id: I2d72b1407a930c270636a206066d2d15fdec2f77
2017-10-02 10:38:35 -07:00
Max Bires
3a5acdaa8d Fixing a bug introduced due to refactoring var names
SELinux messages weren't properly filtering into the events buffer
because message_len was being used to determine length of event data
instead of str_len

Bug: 65597269
Test: SELinux denials show up in the events buffer
Change-Id: I857e10211f71dd0db33a272241c7051c5d0c59ca
2017-09-14 13:01:28 -07:00
Chenjie Yu
ec0c886da6 add aid check when writting into logd stats buffer. For now we require
aid to be system.

Change-Id: I9e701a3146c3269d7e3f315c1182391de5e8cc63
Test: will add tests later
2017-09-07 12:52:25 -07:00
Max Bires
afdea51e0e Merge "Add a feature to show which bugs are tracking which se denials" am: 06e0c704d7 am: 08e66e7796
am: c564cb0bec

Change-Id: I1b565ffe6416456ccf49ef649497257cba6d1cf6
2017-08-25 17:10:10 +00:00
Max Bires
08e66e7796 Merge "Add a feature to show which bugs are tracking which se denials"
am: 06e0c704d7

Change-Id: I67dab1bfe2e400189669dfe48e8683ec15591c34
2017-08-25 17:01:14 +00:00
Max Bires
06e0c704d7 Merge "Add a feature to show which bugs are tracking which se denials" 2017-08-25 16:54:19 +00:00
Alan Stokes
e751059975 Merge "Small liblog test fixes & readability improvements." am: 332370d14d am: 511cc67633
am: 32636f0f4c

Change-Id: I5dd5e1b7267ff3f96aa264eede616dfb30b68884
2017-08-25 16:50:50 +00:00
Alan Stokes
511cc67633 Merge "Small liblog test fixes & readability improvements."
am: 332370d14d

Change-Id: Id3ba8e43ac60fdfe33b40e0f78629ae3312afb50
2017-08-25 16:42:37 +00:00
Alan Stokes
81e63d0515 Small liblog test fixes & readability improvements.
liblog concurrent printf tests now check every write succeeds.
logd timeout_negative tests exits as soon as one run succeeds.

Test: CTS tests till pass.
Change-Id: I9a166a0abcb8b9aa5c055c35c5dccf30616a4e24
2017-08-25 14:53:21 +01:00
Max Bires
4214d132b3 Add a feature to show which bugs are tracking which se denials
The feature references a new file created by the selinux make system
that is stored on device under /system/etc/selinux/ which contains a
scontext, tcontext, tclass, and the bug they map to. logd will
reference this map every time an selinux denial comes through to see if
it's a known denial with a bug attached and then add the bug number to
the denial that's logged.

go/selinux-bug-metadata

Bug: 34997782
Test: any denial -> bug map listed in the referenced file is correcty
displayed in the selinux denials that are logged

Change-Id: I75bab59917591ed700471a0b4922b5f02f86bee9
2017-08-23 15:05:36 -07:00
Christopher Ferris
9e87cb031d Merge "Decrease size of LogBufferElements to 32 bytes." am: 44ad937411 am: e23b30a6da am: 90c25cbdd3
am: 784d6626fb

Change-Id: I39013185503abfc5872c4746f0d6e0461e5d8b7b
2017-08-15 17:15:02 +00:00
Christopher Ferris
784d6626fb Merge "Decrease size of LogBufferElements to 32 bytes." am: 44ad937411 am: e23b30a6da
am: 90c25cbdd3

Change-Id: Iaadb84c017b37edfaf54505c9aa845f1d9e4e67b
2017-08-15 17:09:59 +00:00
Christopher Ferris
e23b30a6da Merge "Decrease size of LogBufferElements to 32 bytes."
am: 44ad937411

Change-Id: Ibfcc70ed00e8d76a3ff77e0e00cdf922bc65b55f
2017-08-15 17:00:02 +00:00