Commit graph

24486 commits

Author SHA1 Message Date
Mark Salyzyn
7545b471a2 logcat: allow comma-separate list of buffers
(cherry pick from commit 4517773296)

- Add parsing to support comma+ separated list of buffers.
- Move get_size test into a standalone get_groups function
- add some additional tests for this feature, leveraging
  get_groups to confirm buffer selection.

Bug: 28120456
Bug: 28788401
Bug: 28813587
Change-Id: I0b42736c08cf4b2a435cb74cda540dc163a26bd1
2016-07-19 11:13:14 -07:00
Mark Salyzyn
c869959d62 logcat: clear when specifying file output
(cherry pick from commit b7d059bb2f)

If -c and -f are both specified, clear the files rather
than notifying the logger to clear its data. The -f then
acts like a switch between clearing the in-memory log
data, or the on-disk logrotate data.

Bug: 28788401
Bug: 28813587
Bug: 28936216
Change-Id: Ib1d1fb46ea09f81a2fd9bebb6c8f0f9f2355f6e8
2016-07-19 11:13:14 -07:00
Mark Salyzyn
3f6777a3dd logcat: Adjust help to make it more meaningful
(cherry pick from commit 378f4745a2)

It is not clear about the long option aliases, list
them comma separate first for clarity. Squash lines
of help content if possible. Lock to 3 indents, one
for options, another for text on same line as options
and another for next line or continuation.

Bug: 28120456
Bug: 28788401
Bug: 28813587
Change-Id: I5331acde3ac0fd3b87f6699ba108f6cef46a1563
2016-07-19 11:13:10 -07:00
Jorge Lucangeli Obes
2bbdbe8541 logd: Use Minijail for privilege dropping.
Makes code smaller, removes duplication. Using Minijail also allows
adding further sandboxing down the road.

Bug: 30156807
Change-Id: I8fa242fba545049ee82f6655fe6ecc14c53fcab7
2016-07-19 11:15:06 -04:00
Jorge Lucangeli Obes
a377ff0d4a run-as: Use Minijail for privilege dropping.
Arguably, we don't need a ScopedMinijail for a program that only execs,
but I'd rather keep the code consistent and have all uses of Minijail
be good examples.

Bug: 30156807

Change-Id: I08a968835e0f3e2afcd5e7736626edbed658cde2
2016-07-19 11:03:52 -04:00
Christopher Ferris
84421d8475 Add ioprio values directly.
The ioprio.h header is not a uapi header, so remove it's use and
add the two values that this code needs to use.

Bug: 30072483
Change-Id: I5c8b6f40bd60a43f50ac26792f96d2fa3f6db020
2016-07-18 17:01:05 -07:00
Josh Gao
1014da24fd adb: use asocket\\\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402 am: 29aa08f8cc -s ours am: 2ca04650df
am: ddf5451df0

Change-Id: Iad9456e8d7ee2a2c446e74a605903a7e525bd646
2016-07-18 20:26:03 +00:00
Josh Gao
74f8597ec9 adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e am: 163802c244 -s ours am: 46468f8cef
am: d4d4edf81b

Change-Id: If4c367868a98a8fc3684edb89f5f43b4be64beb6
2016-07-18 20:26:02 +00:00
Josh Gao
58c4e0dd82 adb: use asocket\\\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402 am: 29aa08f8cc -s ours am: 2ca04650df
am: 46fedbc4b2

Change-Id: I1a8085be20b06af3ceda7c0187e9623d55566851
2016-07-18 20:24:30 +00:00
Josh Gao
7223637667 adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e am: 163802c244 -s ours am: 46468f8cef
am: 44a8dfc152

Change-Id: Ie2254d28c7dc74480e240af1f364255d90c8373f
2016-07-18 20:24:29 +00:00
Josh Gao
ddf5451df0 adb: use asocket\\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402 am: 29aa08f8cc -s ours
am: 2ca04650df

Change-Id: Idf98d144e2416c98e8d585b98a9175ea71417a51
2016-07-18 20:24:17 +00:00
Josh Gao
a50e8ffa7d DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
Fix two races in debuggerd's PTRACE_ATTACH logic:
  1. The target thread in a crash dump request could exit between the
     /proc/<pid>/task/<tid> check and the PTRACE_ATTACH.
  2. Sibling threads could exit between listing /proc/<pid>/task and the
     PTRACE_ATTACH.

Backport of NYC change I4dfe1ea30e2c211d2389321bd66e3684dd757591
Bug: http://b/29555636
Change-Id: I6c6efcf82a49bca140d761b2d1de04215ba4d252
2016-07-18 13:23:29 -07:00
Josh Gao
46fedbc4b2 adb: use asocket\\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402 am: 29aa08f8cc -s ours
am: 2ca04650df

Change-Id: Ib2c5c1761c1e02a90683e97bc82234d6f086c6f6
2016-07-18 20:20:51 +00:00
Josh Gao
44a8dfc152 adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e am: 163802c244 -s ours
am: 46468f8cef

Change-Id: I3e6fee1ccc1f56f2341505e51e7508f23834afb8
2016-07-18 20:20:51 +00:00
Josh Gao
2ca04650df adb: use asocket\\\\'s close function when closing. am: f71c01493a am: d179556680 am: e2a5846402
am: 29aa08f8cc  -s ours

Change-Id: I0dc701f0946e066ecab854f99867057629b1ccc9
2016-07-18 20:20:29 +00:00
Josh Gao
d4d4edf81b adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e am: 163802c244 -s ours
am: 46468f8cef

Change-Id: Ic01011008edb3481c0a4191aaf2f178e76c3458c
2016-07-18 20:17:18 +00:00
Josh Gao
46468f8cef adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e am: 1f8c6c8c8e
am: 163802c244  -s ours

Change-Id: I778721bfdf8bace675ca86fb2b49a1d0ecd052b2
2016-07-18 20:12:58 +00:00
Jorge Lucangeli Obes
dae8d54073 Merge \\\"Use arraysize() for supplementary groups.\\\" am: ddbcecec3a am: 3ab30ecf4c
am: c2999fb33b

Change-Id: I604790f5634628df7168985d14f6e8f03aefac61
2016-07-18 20:12:46 +00:00
Jorge Lucangeli Obes
c2999fb33b Merge \\"Use arraysize() for supplementary groups.\\" am: ddbcecec3a
am: 3ab30ecf4c

Change-Id: I93824fda0811422b11f1c9b5c01bc07a660a42c1
2016-07-18 20:10:15 +00:00
Jorge Lucangeli Obes
3ab30ecf4c Merge \"Use arraysize() for supplementary groups.\"
am: ddbcecec3a

Change-Id: Ia8405d8bc181b1cdbf1f0812c0dbe8f7701747ef
2016-07-18 20:06:19 +00:00
Treehugger Robot
ddbcecec3a Merge "Use arraysize() for supplementary groups." 2016-07-18 20:00:28 +00:00
Josh Gao
29aa08f8cc adb: use asocket\\\'s close function when closing. am: f71c01493a am: d179556680
am: e2a5846402

Change-Id: I089c7390c4e5f325b3c6e8ff54012430a436c05d
2016-07-18 19:54:17 +00:00
Josh Gao
163802c244 adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5 am: a6b92d1f2e
am: 1f8c6c8c8e

Change-Id: I035c2436afc99078996fb655aa4b9554e7cc812e
2016-07-18 19:54:17 +00:00
Josh Gao
e2a5846402 adb: use asocket\\'s close function when closing. am: f71c01493a
am: d179556680

Change-Id: I484051c028f89e292567485db49e2e20d26030be
2016-07-18 19:50:46 +00:00
Josh Gao
1f8c6c8c8e adb: switch the socket list mutex to a recursive_mutex. am: 6f641adea5
am: a6b92d1f2e

Change-Id: I064738710ab360cbfeb0b669d7e531f955f8b9cb
2016-07-18 19:50:46 +00:00
Josh Gao
d179556680 adb: use asocket\'s close function when closing.
am: f71c01493a

Change-Id: Id77dd7ff1931f03ea7f1e0339eca6610e02e9122
2016-07-18 19:47:45 +00:00
Josh Gao
a6b92d1f2e adb: switch the socket list mutex to a recursive_mutex.
am: 6f641adea5

Change-Id: I839bc3817e7d7bb24b2bf3c5059919802c9f5d33
2016-07-18 19:47:45 +00:00
Josh Gao
36dd144367 DO NOT MERGE: debuggerd: verify that traced threads belong to the right process.
Fix two races in debuggerd's PTRACE_ATTACH logic:
  1. The target thread in a crash dump request could exit between the
     /proc/<pid>/task/<tid> check and the PTRACE_ATTACH.
  2. Sibling threads could exit between listing /proc/<pid>/task and the
     PTRACE_ATTACH.

Backport of NYC change I4dfe1ea30e2c211d2389321bd66e3684dd757591
Bug: http://b/29555636
Change-Id: I320f47216b21018d3f613cfbbaaff40b3548ef36
2016-07-18 19:35:45 +00:00
Mark Salyzyn
4d205f8975 logd: auditd: suppress multiple identical avc: messages to kmsg
Sends first and last of a series of 3 or more indentical avc:
messages to kmsg and adds 'duplicate messages suppressed'
for the last one in the set. eg:

[67.141658] type=1400 audit(1468852100.171:70): avc: ... tcontext=u:object_r:proc:s0 tclass=file
[67.141678] type=1400 audit(1468852107.494:71): avc: ... tcontext=u:object_r:cache_file:s0 tclass=dir
[67.535202] type=1400 audit(1468852107.498:74): avc: ... tcontext=u:object_r:cache_file:s0 tclass=dir duplicate messages suppressed
[67.535227] type=1400 audit(1468852107.888:75): avc: ... tcontext=u:object_r:proc_net:s0 tclass=file

One can look at the sequence numbers in the above example to see that
four identical message were produced, two were dropped.

ToDo: Evaluate multiple streams of duplicate messages.

Bug: 30118730
Change-Id: I31dcda7c8c42edfc7a8f1bf4d9e46284c74b3d18
2016-07-18 12:30:04 -07:00
Jorge Lucangeli Obes
bae15b4f46 Use arraysize() for supplementary groups.
Also make adbd use ScopedMinijail.

Bug: 30191189
Change-Id: I5e259aa466817b51037912aba043ba75bd35f9e1
2016-07-18 13:46:42 -04:00
Jorge Lucangeli Obes
d1463e038f Merge \\\"Use Minijail for privilege dropping.\\\" am: 97f49e5cb3 am: fe4f764e75
am: c97786fb43

Change-Id: I1122c38bcd8032d84feba53dc67e1d041bd40ee2
2016-07-18 16:15:26 +00:00
Jorge Lucangeli Obes
c97786fb43 Merge \\"Use Minijail for privilege dropping.\\" am: 97f49e5cb3
am: fe4f764e75

Change-Id: I878d09de7ec1063121a2b3868c43d7fd5b026f9e
2016-07-18 16:09:29 +00:00
Jorge Lucangeli Obes
fe4f764e75 Merge \"Use Minijail for privilege dropping.\"
am: 97f49e5cb3

Change-Id: I032ea3fcdac1a16bf36d43731b8533214264fee2
2016-07-18 16:06:38 +00:00
Jeff Sharkey
91404d9481 Merge \"Only restorecon CE storage after unlocked.\" into nyc-mr1-dev
am: 96f387e8c0

Change-Id: I3a1c31334d32e7bdff8e05558356d2833fcfb831
2016-07-18 16:06:34 +00:00
Treehugger Robot
97f49e5cb3 Merge "Use Minijail for privilege dropping." 2016-07-18 15:58:46 +00:00
Jeff Sharkey
96f387e8c0 Merge "Only restorecon CE storage after unlocked." into nyc-mr1-dev 2016-07-18 15:58:42 +00:00
Daniel Rosenberg
2722208dd8 resolve merge conflicts of efa8604 to nyc-mr1-dev-plus-aosp
Change-Id: Ibacd9b1e0383887f02a009334aaa7b77b986790c
2016-07-15 19:46:41 -07:00
TreeHugger Robot
efa8604a1d Merge "Add skip-secondary flag" into nyc-mr1-dev 2016-07-16 01:21:21 +00:00
Mark Salyzyn
8797044632 Merge \\\"logd: Worst Tag filter enabled for events buffer\\\" am: c4be85fbba am: c067116ad5
am: 44fa37b1f8

Change-Id: I8d4b86ad31b57aa30db98fa35a7e7f26fa016b83
2016-07-16 00:45:12 +00:00
Mark Salyzyn
44fa37b1f8 Merge \\"logd: Worst Tag filter enabled for events buffer\\" am: c4be85fbba
am: c067116ad5

Change-Id: I31ab68fd09881e7d0cf29a5061bbbddaf39bf4d6
2016-07-16 00:37:01 +00:00
Mark Salyzyn
c067116ad5 Merge \"logd: Worst Tag filter enabled for events buffer\"
am: c4be85fbba

Change-Id: I9d33328dfb179a914f502c353b4388d79e376eda
2016-07-16 00:33:19 +00:00
Treehugger Robot
c4be85fbba Merge "logd: Worst Tag filter enabled for events buffer" 2016-07-16 00:23:40 +00:00
Josh Gao
f71c01493a adb: use asocket's close function when closing.
close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.

Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
(cherry picked from commit 53eb31d87c)
(cherry picked from commit 014b01706c)
2016-07-15 17:17:14 -07:00
Josh Gao
6f641adea5 adb: switch the socket list mutex to a recursive_mutex.
sockets.cpp was branching on whether a socket close function was
local_socket_close in order to avoid a potential deadlock if the socket
list lock was held while closing a peer socket.

Bug: http://b/28347842
Change-Id: I5e56f17fa54275284787f0f1dc150d1960256ab3
(functionally a cherrypick of 903b749f + 9b587dec, with windows disabled)
2016-07-15 17:17:14 -07:00
Daniel Rosenberg
e180929866 Add skip-secondary flag
The skip-secondary flag now replaces flash-primary. This flag will
skip over the secondary images for both flashall and update.

Change-Id: I9f380f3195006d325d6c45776bf79ecec17506ad
2016-07-15 16:57:53 -07:00
Mark Salyzyn
bdcea180c9 Merge \\\"logd: Replace logd with chatty log tag\\\" am: 596e65db60 am: 607f55de91
am: acec904b25

Change-Id: I7ee4aced5ba4afbb1d798eb7e5055bfafeee0fe5
2016-07-15 23:28:35 +00:00
Mark Salyzyn
acec904b25 Merge \\"logd: Replace logd with chatty log tag\\" am: 596e65db60
am: 607f55de91

Change-Id: Ic5e1f21c94f4cd40a9c601817b58e8a2636d4bba
2016-07-15 23:26:05 +00:00
Mark Salyzyn
607f55de91 Merge \"logd: Replace logd with chatty log tag\"
am: 596e65db60

Change-Id: I88057f1ffb21e6b0863dd0803a7a9be0ee72cb1c
2016-07-15 23:23:51 +00:00
Treehugger Robot
596e65db60 Merge "logd: Replace logd with chatty log tag" 2016-07-15 23:20:11 +00:00
Amit Pundir
114a00ea03 Merge \\\"init: select usb gadget controller at run time\\\" am: 916f5e873e am: 91272bd435
am: aff2347646

Change-Id: Idbb3ed146b147300d8f472958a5b888c07f5a684
2016-07-15 23:01:34 +00:00