Commit graph

620 commits

Author SHA1 Message Date
Yi Kong
6259c5f204 Merge "[logd] Modernize codebase by replacing NULL with nullptr"
am: 2a989cf525

Change-Id: Ic608288e6a055e7d7236be22b7c564a565a86987
2018-07-13 21:40:27 -07:00
Yi Kong
86f7a3c1c1 Merge "Remove execute bit for source files"
am: dc8483cc04

Change-Id: Ie60e02dedca7f002e33a47eb786ac8bca18b6c0f
2018-07-13 21:39:48 -07:00
Yi Kong
c8d09ddceb [logd] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I15ccb9cfc9967dae4320d9690f5097bc2f7d5bfe
2018-07-13 17:50:55 -07:00
Yi Kong
760a35a91c Remove execute bit for source files
Test: ls -l
Change-Id: Id09514a03f82c89e6350a5f9e34b9ef8bfe27b7e
2018-07-13 17:45:39 -07:00
Elliott Hughes
e2e423fd2c Merge "logd: make behavior more consistent across builds."
am: b7761b2673

Change-Id: I51582e316f4d0ff611ca773eafef536cda1743a6
2018-06-13 12:51:17 -07:00
Elliott Hughes
cef62b4014 logd: make behavior more consistent across builds.
Bug: 110127913
Test: boots
Change-Id: I0c1efacfb5ac0407e896ddde0bcc63927edc0525
2018-06-13 10:34:43 -07:00
Luis Hector Chavez
16d0c4617a Merge "logd: Stop calling prctl(PR_SET_KEEPCAPS, 1)"
am: 7222199281

Change-Id: I6c2565f9d1efd11d378bd7e1b865aa0a7e46b9de
2018-06-13 09:51:07 -07:00
Luis Hector Chavez
499f3a2aed logd: Stop calling prctl(PR_SET_KEEPCAPS, 1)
This change removes the call to prctl(PR_SET_KEEPCAPS, 1), because now
that logd is being run with ambient capabilities, init will set the
KEEP_CAPS / KEEP_CAPS_LOCKED securebits.

Bug: 110127913
Test: liblog-unit-tests, logd-unit-tests, logcat-unit-tests
      (on an aosp_sailfish-userdebug)

Change-Id: I72b6a49c5cd1552085f9ad44cb19a7333a13eeea
2018-06-13 07:36:23 -07:00
Luis Hector Chavez
3276b57542 Merge "logd: Move the capabilities from file based to ambient"
am: 28cd2a02b1

Change-Id: Iaef160d039cf995f8dae104f122208660cc27985
2018-06-12 14:59:57 -07:00
Luis Hector Chavez
d32c36c961 logd: Move the capabilities from file based to ambient
This change moves logd's capabilities from being file based to being set
by init through ambient capabilities.

Bug: 62845925
Test: sailfish:/ # grep Cap /proc/`pidof logd`/status
      CapInh: 0000000000000000
      CapPrm: 0000000440000000
      CapEff: 0000000440000000
      CapBnd: 0000000440000040
      CapAmb: 0000000000000000
      $ capsh --decode=0x440000040
      0x440000040=cap_setgid,cap_audit_control,cap_syslog
Test: liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Change-Id: I28c7c4ad37ad5eafd399aef78c303ce31298a9ef
2018-06-11 10:04:11 -07:00
android-build-prod (mdb)
a2e98bdf92 Merge "Remove more bogus <stdbool.h> #includes from C++." am: e7020dc8e4
am: c104e3abaf

Change-Id: I483f576fe82057fc66d7bbc8e4fdde4c4e206127
2018-05-08 14:42:57 -07:00
Elliott Hughes
23b98f492b Remove more bogus <stdbool.h> #includes from C++.
Bug: N/A
Test: builds
Change-Id: I794cd28667c6c65b38940d8f443315ad116b7ac3
2018-05-08 13:00:06 -07:00
Jeffrey Vander Stoep
209f4281df Merge "Logd: include app package name in selinux metadata" am: 24e87383f1
am: 5e5640f5ab

Change-Id: I70c806ce3a93fa36b2e050783e2daf27cab1e4e5
2018-05-04 14:20:45 -07:00
Jeff Vander Stoep
d885890e78 Logd: include app package name in selinux metadata
Note: denial metadata is currently only included on debug builds.

avc: denied { read } for comm="getprop" name="u:object_r:net_dns_prop:s0"
dev="tmpfs" ino=19605 scontext=u:r:untrusted_app:s0:c164,c256,c512,c768
tcontext=u:object_r:net_dns_prop:s0 tclass=file permissive=0 b/12345678
app=android.selinuxtargetsdkcurrent.cts

Bug: 9496886
Bug: 68016944
Test: cts-tradefed run cts -m CtsSelinuxTargetSdkCurrentTestCases
Change-Id: I1700722a45b75d22f17ba4edc7b95cbaf99fdda8
2018-05-03 22:40:18 -07:00
Max Bires
b8716687f1 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
(cherry picked from commit 3a5acdaa8d)
2018-05-03 15:25:02 -07:00
Tom Cherry
f2244c4976 Merge "logd: notify kernel log readers of new messages" am: 6a2686b0f3
am: 587297953e

Change-Id: Ic20fc2717b3e64111a664ae76b5837d8d45deda5
2018-04-25 09:54:24 -07:00
Tom Cherry
cbfebdbadb logd: notify kernel log readers of new messages
LogBuffer::log() returns either a negative number on error or a
positive number indicating the length of the message written.
Therefore, the check to notify kernel log readers of a new message
should be that this function's return value is > 0.

Bug: 78209416
Test: `adb logcat -b kernel` updates when new log messages are present
Change-Id: Icc18c0c22e62340994e5c26aedb72282d61c1541
2018-04-24 14:19:32 -07:00
Joe Onorato
4bba698245 Make logd more aggressive when scanning for the position from which to resume logging.
Events in the LogBuffer are supposed to be sorted by timestamp, but for a variety
of reasons that doesn't always happen.  When a LogReader is reading from LogBuffer,
LogBuffer starts at the newest event, and scans backward through the list, looking
for the last event.  Previously it would accept a couple that were a little bit out
of order, but if it found one that was ancient, it would just bail. This change
removes that check for the ancient messages.  They are probably indicative of
something else upstream, but since there is no invariant of the list being sorted,
this change simplifies the search algorithm, and makes it look only at the previous
300 events.

Bug: 77222120
Test: while true ; do frameworks/base/cmds/statsd/run_tests.sh 2h ; done
Change-Id: I0824ee7590d34056ce27233a87cd7802c28f50e4
2018-04-04 14:46:45 -07:00
Mark Salyzyn
fec2e2c783 logd: identical check access message data out of range
(cherry pick from commit 22712428b8)

Discovered while running AddressSanitizer, binary events were fed
into logd that were smaller than the binary event string header.
Fix is to check the buffer sizes before performing the memcmp
operation.

Test: compile
Bug: 74574189
Change-Id: Ic01ef6fb0725258d9f39bbdca582ed648a1adc5d
2018-03-14 07:26:20 -07:00
Mark Salyzyn
22712428b8 logd: identical check access message data out of range
While running AddressSanitizer, binary events were fed into logd
that were smaller than the binary event string header. Fix is to
check the buffer sizes before performing the memcmp operation.

Test: compile
Bug: 74574189
Change-Id: Ic01ef6fb0725258d9f39bbdca582ed648a1adc5d
2018-03-13 12:16:39 -07:00
Yi Kong
42d12f82bc Merge "Remove unreachable condition" am: a281389bf4 am: 061759246c
am: 7a4070ca95

Change-Id: I9431f46a90cd1b08569a2413ab5ecc0699a0f880
2018-03-02 01:06:14 +00:00
Yi Kong
141cceee58 Remove unreachable condition
Comparison of unsigned enum expression < 0 is always false. Fixes
tautological-unsigned-enum-zero-compare warning.

Bug: 72331526
Test: m
Change-Id: I17eb218b256015f5f406fd24324a49b05a0e8866
2018-03-01 22:54:08 +00:00
Elliott Hughes
4c33b88c4b Merge "bpfmt." am: 0609e8d231 am: b57755c429
am: a91867a788

Change-Id: Ieb0985434e2464e47b3adb93fb27fe5042e91657
2018-02-20 02:24:45 +00:00
Elliott Hughes
dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
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