Commit Graph

207154 Commits

Author SHA1 Message Date
Narayan Kamath
e9295560cf Merge "Backport changes to whitelist sockets opened by the zygote." into lmp-mr1-ub-dev am: 00e808b06b am: e59073096e am: 24ffc9ab47
am: bd6a29cddc

Change-Id: I78f74e5d3f0e0b82afe4d5f48f2541a881189aa1
2016-09-09 10:39:29 +00:00
Narayan Kamath
eb972e5d9d Backport changes to whitelist sockets opened by the zygote. am: 82c6e6267e -s ours am: 646ee94421 am: 8f0cc3dd13
am: 8cb6b9335c

Change-Id: If2f8fbef801cd61834ac50a7e1a254ed21b95cc2
2016-09-09 10:33:43 +00:00
Narayan Kamath
bd6a29cddc Merge "Backport changes to whitelist sockets opened by the zygote." into lmp-mr1-ub-dev am: 00e808b06b am: e59073096e
am: 24ffc9ab47

Change-Id: I78adbdbbf8ffddfee3cd8b1407415cdf3a4d1b1f
2016-09-09 10:33:40 +00:00
Narayan Kamath
24ffc9ab47 Merge "Backport changes to whitelist sockets opened by the zygote." into lmp-mr1-ub-dev am: 00e808b06b
am: e59073096e

Change-Id: Ifb7972c30d70a0fbc4ffdae100aac2d77ca445ca
2016-09-09 10:28:52 +00:00
Narayan Kamath
8cb6b9335c Backport changes to whitelist sockets opened by the zygote. am: 82c6e6267e -s ours am: 646ee94421
am: 8f0cc3dd13

Change-Id: Ida08d48da51f9f49dc70a916fa379cf89a4d33c0
2016-09-09 10:28:46 +00:00
Narayan Kamath
8f0cc3dd13 Backport changes to whitelist sockets opened by the zygote. am: 82c6e6267e -s ours
am: 646ee94421

Change-Id: I62f6556e630707274daa4ee0a4a57c77f5329bbc
2016-09-09 10:21:48 +00:00
Narayan Kamath
e59073096e Merge "Backport changes to whitelist sockets opened by the zygote." into lmp-mr1-ub-dev
am: 00e808b06b

Change-Id: I14939b5bf04ba47229e663b2ffc50543c5c6bc9a
2016-09-09 10:18:19 +00:00
Narayan Kamath
646ee94421 Backport changes to whitelist sockets opened by the zygote.
am: 82c6e6267e  -s ours

Change-Id: Ib35b2567f19aff39d285794951cf9b8cb8d74ef1
2016-09-09 10:15:11 +00:00
Narayan Kamath
00e808b06b Merge "Backport changes to whitelist sockets opened by the zygote." into lmp-mr1-ub-dev 2016-09-09 10:05:46 +00:00
Narayan Kamath
177ee386b9 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dev am: 014016cf32 am: 447d3798f1
am: 71e6a6f12a

Change-Id: Ib162897a1428ab8c025a414eb0a3872327274f7a
2016-09-08 08:45:47 +00:00
Narayan Kamath
71e6a6f12a Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dev am: 014016cf32
am: 447d3798f1

Change-Id: I323c669ed44e10f9e3a91271f47800754da5d389
2016-09-08 08:40:03 +00:00
Narayan Kamath
4474da7b7c Backport changes to whitelist sockets opened by the zygote. am: 0f6a0e1560 -s ours am: 6fa8339792
am: c6ced086d1

Change-Id: Ie3699efd33fe53acfd0dff64cbb18e4792a65bf3
2016-09-08 08:39:07 +00:00
Narayan Kamath
7a0c7ab520 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dr-dev am: 459810b9b7
am: 47b88a15f6

Change-Id: Id267e22508824d569f54068291304584b3343b9a
2016-09-08 08:35:04 +00:00
Narayan Kamath
67c4adb5c1 Backport changes to whitelist sockets opened by the zygote. am: 41ca1bce01
am: 49d992fdb0

Change-Id: I0560d831235bd7ba3ea764b23e64b4e08110d7e5
2016-09-08 08:34:58 +00:00
Narayan Kamath
c6ced086d1 Backport changes to whitelist sockets opened by the zygote. am: 0f6a0e1560 -s ours
am: 6fa8339792

Change-Id: Id7ad55a251a26782815005218dc186b53e74cfca
2016-09-08 08:33:40 +00:00
Narayan Kamath
447d3798f1 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dev
am: 014016cf32

Change-Id: Ic0cf8b5cc2accaad552b82eaadce359e21e5e624
2016-09-08 08:30:41 +00:00
Narayan Kamath
47b88a15f6 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dr-dev
am: 459810b9b7

Change-Id: I867a7c97c8363ede1b04e4ea8a75045d36d9d58d
2016-09-08 08:24:54 +00:00
Narayan Kamath
49d992fdb0 Backport changes to whitelist sockets opened by the zygote.
am: 41ca1bce01

Change-Id: Id08676457fa3fa022d607e5de754f49b9c396261
2016-09-08 08:24:47 +00:00
Narayan Kamath
6fa8339792 Backport changes to whitelist sockets opened by the zygote.
am: 0f6a0e1560  -s ours

Change-Id: I2cdd131b750b4d04672149dcf7a90d2d566dd621
2016-09-08 08:23:49 +00:00
Narayan Kamath
459810b9b7 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dr-dev 2016-09-08 08:20:58 +00:00
Narayan Kamath
014016cf32 Merge "Backport changes to whitelist sockets opened by the zygote." into mnc-dev 2016-09-08 08:12:20 +00:00
Narayan Kamath
ebcc7aeda9 Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54 am: f7b9f84f87 am: 9a409265fc -s ours am: 9802fcfa2b am: 2acf9f7e3c am: 36b90a1934
am: 5febcdd210

Change-Id: Ib7e40acc4682e4198dcaab78c57de02acfe89c94
2016-09-07 20:23:28 +00:00
Narayan Kamath
82c6e6267e Backport changes to whitelist sockets opened by the zygote.
This is the backport of the following commits :

Commit c5f27a7cb2:
-----------------------------------------------

Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
  first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
  has changed. We are currently tolerant of changes, but in the
  longer term, it should be a fatal error if the set of open file
  descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
  them if necessary.

bug: 30963384

Commit 3764a260f0:
-----------------------------------------------

Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384

Commit 0b76d6a28e:
-----------------------------------------------
fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
  will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
  structural changes to it is broken. Switch to a while loop and treat
  cases where elements are erased differently from cases where they
  aren't.

bug: 31092930
bug: 30963384

Plus additional changes:
-----------------------------------------------
- change std::unordered_map to std::tr1::unordered_map.
- add /dev/alarm and /dev/__properties__ to the whitelist.
- map.erase(iterator) returns void prior to C++11, so need the kludge
  of calling erase(it++).

(cherry picked from commit 7ec85f9d54)

Change-Id: If44dc64275d753553233b78a05d41df9d5bfdc36
2016-09-07 21:22:59 +01:00
Narayan Kamath
5febcdd210 Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54 am: f7b9f84f87 am: 9a409265fc -s ours am: 9802fcfa2b am: 2acf9f7e3c
am: 36b90a1934

Change-Id: Iec55904ecb004d3bf89bf3a065e5811afae798d6
2016-09-07 20:17:02 +00:00
Narayan Kamath
36b90a1934 Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54 am: f7b9f84f87 am: 9a409265fc -s ours am: 9802fcfa2b
am: 2acf9f7e3c

Change-Id: Ideae7875e299ec0292054aad85fe8aa92b6aba9b
2016-09-07 20:12:43 +00:00
Narayan Kamath
2acf9f7e3c Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54 am: f7b9f84f87 am: 9a409265fc -s ours
am: 9802fcfa2b

Change-Id: Iabeefa7d07d78002c124ce62dc210111b83a99b7
2016-09-07 20:07:58 +00:00
Narayan Kamath
9802fcfa2b Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54 am: f7b9f84f87
am: 9a409265fc  -s ours

Change-Id: Idf4dcc5ab7e8b0510848cbd2f220fe7a8e4b3e04
2016-09-07 20:01:56 +00:00
Narayan Kamath
9a409265fc Backport changes to whitelist sockets opened by the zygote. am: 7ec85f9d54
am: f7b9f84f87

Change-Id: I317cecff389f30c5d47e4adee1afafbde8d9d23d
2016-09-07 18:58:41 +00:00
Narayan Kamath
f7b9f84f87 Backport changes to whitelist sockets opened by the zygote.
am: 7ec85f9d54

Change-Id: I6db56b5b06636201382f6d908297644183253c0b
2016-09-07 18:53:40 +00:00
Narayan Kamath
41ca1bce01 Backport changes to whitelist sockets opened by the zygote.
This is the backport of the following commits :

Commit c5f27a7cb2:
-----------------------------------------------

Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
  first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
  has changed. We are currently tolerant of changes, but in the
  longer term, it should be a fatal error if the set of open file
  descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
  them if necessary.

bug: 30963384

Commit 3764a260f0:
-----------------------------------------------

Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384

Commit 0b76d6a28e:
-----------------------------------------------

fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
  will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
  structural changes to it is broken. Switch to a while loop and treat
  cases where elements are erased differently from cases where they
  aren't.

bug: 31092930
bug: 30963384

Plus additional changes:
-----------------------------------------------
- add /dev/__properties__ to the whitelist.

Change-Id: I709a7f4913e807a8fec8a58c81e98fe5b5222820
2016-09-07 19:06:04 +01:00
Narayan Kamath
0f6a0e1560 Backport changes to whitelist sockets opened by the zygote.
This is the backport of the following commits :

Commit c5f27a7cb2:
-----------------------------------------------

Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
  first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
  has changed. We are currently tolerant of changes, but in the
  longer term, it should be a fatal error if the set of open file
  descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
  them if necessary.

bug: 30963384

Commit 3764a260f0:
-----------------------------------------------

Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384

Commit 0b76d6a28e:
-----------------------------------------------

fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
  will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
  structural changes to it is broken. Switch to a while loop and treat
  cases where elements are erased differently from cases where they
  aren't.

bug: 31092930
bug: 30963384

Plus additional changes:
-----------------------------------------------
- add /dev/__properties__ to the whitelist.

Change-Id: Ic512be6362c3c5d84767e933884872b7e995dfea
2016-09-07 18:52:50 +01:00
Narayan Kamath
7ec85f9d54 Backport changes to whitelist sockets opened by the zygote.
This is the backport of the following commits :

Commit c5f27a7cb2:
-----------------------------------------------

Reopen whitelisted zygote file descriptors after a fork.

We don't want these descriptors to be shared post-fork, so we'll
have to close and reopen them when the zygote forks. The set of
open descriptors is checked against a whitelist and it is a fatal
error if a non whitelisted FD is opened. It is also a fatal error
if anything other than a regular file / character device or socket
is opened at the time of forking.

This work is done in two stages :
- An initial list of FDs is constructed and cached prior to the
  first zygote fork.

- On each subsequent fork, we check whether the list of open FDs
  has changed. We are currently tolerant of changes, but in the
  longer term, it should be a fatal error if the set of open file
  descriptors in the zygote changes.

- Post fork, we traverse the list of open descriptors and reopen
  them if necessary.

bug: 30963384

Commit 3764a260f0:
-----------------------------------------------

Add a whitelist of sockets on fork.

Maintain a whitelist of AF_UNIX sockets that are permitted
to exist at the time of forking. If an open socket does not belong
to the whitelist (or is not AF_UNIX), the process will abort. If an
open socket is whitelisted, it will be redirected to /dev/null after
a sucessful fork. This allows us to unify our handling of the special
zygote sockets (/dev/socket/zygote[_secondary]) with the existing
whitelist of non socket file descriptors.

This change also removes non-fatal ALOGW messages since they have the
side effect of reopening the logging socket.

bug: 30963384

Commit 0b76d6a28e:
-----------------------------------------------
fd_utils: Fix broken usage of iterators.

There were two separate issues here :
- RestatInternal was using an iterator after a call to erase(). This
  will not work because it will be invalidated.
- The "standard" for loop idiom for iterating over a map while making
  structural changes to it is broken. Switch to a while loop and treat
  cases where elements are erased differently from cases where they
  aren't.

bug: 31092930
bug: 30963384

Plus additional changes:
-----------------------------------------------
- change std::unordered_map to std::tr1::unordered_map.
- add /dev/alarm and /dev/__properties__ to the whitelist.
- map.erase(iterator) returns void prior to C++11, so need the kludge
  of calling erase(it++).

Change-Id: I694ff66d5f227239b0190ffc2287882b16e336fa
2016-09-07 18:48:48 +01:00
Adam Seaton
b57e6560d0 Revert "Bump up the uncrypt timeout to 30 min."
Creates Null Build to test OTA failure fix.
This reverts commit 8abcfed8a4.

Change-Id: I64474dad467ce8d8e379e0e2c47814d76ac0ee0d
2016-08-30 22:14:47 +00:00
Tao Bao
8abcfed8a4 Bump up the uncrypt timeout to 30 min.
Bug: 30490464
Change-Id: I9b65afb10134d79b2f5b5275a6d81065a04e91b9
2016-08-26 20:52:41 -07:00
Sudheer Shanka
7a46fac0cd resolve merge conflicts of 270947f to klp-modular-dev am: 76c4b2a7b6 -s ours am: bbbb514bc9 am: 6a50270944 am: a0994c6d58 am: cdf70ba0a3 am: c2a760e68c am: 77dec89bb3
am: 203d1bee25

Change-Id: Ib8939aceb6c23ce3273eef396a9d8fa09aa4aeb8
2016-08-25 23:30:05 +00:00
Sudheer Shanka
71933abbdc Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-dev am: 96052ea905 -s ours am: f368bdee06 am: f21534a288 am: dfc2d0a4bc -s ours am: 603a69ffb4 am: 97194798ab
am: c35a9fed39

Change-Id: Icf80dd720b371aa3ee488f074b5c038607691b80
2016-08-25 23:30:03 +00:00
Amith Yamasani
7586e03e06 DO NOT MERGE: Clean up when recycling a pid with a pending launch am: a92810a189 -s ours am: 9be12f8986 am: 03b0f5c3ec am: 7b8140652b -s ours am: 9080d4462e am: 75c7391a41
am: f6361752ca

Change-Id: I09846a866cdfec673fd99d5c7574d31734335d85
2016-08-25 23:29:59 +00:00
Sudheer Shanka
bc5775c18b Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-mr1-dev am: 5e55214ab7 am: c8aedeeaf6 am: 26bb7bf86c -s ours am: 86ac88ccdb am: 2490679d7e
am: 2f664374fa

Change-Id: I08ec5c73b827a58274aaa3422bd5ca57eb67e402
2016-08-25 23:29:56 +00:00
Amith Yamasani
a106b52180 DO NOT MERGE: Clean up when recycling a pid with a pending launch am: b02862c2cf am: dd0be992c0 am: 117a383099 -s ours am: 368ae62e9d am: 1d513c845a
am: 5eed3c9c38

Change-Id: I4470a56b330eb087ecd2f2662ad99fccbca917cf
2016-08-25 23:29:52 +00:00
Sudheer Shanka
203d1bee25 resolve merge conflicts of 270947f to klp-modular-dev am: 76c4b2a7b6 -s ours am: bbbb514bc9 am: 6a50270944 am: a0994c6d58 am: cdf70ba0a3 am: c2a760e68c
am: 77dec89bb3

Change-Id: I1d755ef86b80f723c3fde59476e0018167fbf8b7
2016-08-25 23:22:19 +00:00
Sudheer Shanka
c35a9fed39 Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-dev am: 96052ea905 -s ours am: f368bdee06 am: f21534a288 am: dfc2d0a4bc -s ours am: 603a69ffb4
am: 97194798ab

Change-Id: If4a1716de3d54d6a08025665cdff51edc1b2f6da
2016-08-25 23:22:14 +00:00
Amith Yamasani
f6361752ca DO NOT MERGE: Clean up when recycling a pid with a pending launch am: a92810a189 -s ours am: 9be12f8986 am: 03b0f5c3ec am: 7b8140652b -s ours am: 9080d4462e
am: 75c7391a41

Change-Id: I2646c10763640e6079e09e6fd53b9958b3aba2ea
2016-08-25 23:22:10 +00:00
Sudheer Shanka
2f664374fa Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-mr1-dev am: 5e55214ab7 am: c8aedeeaf6 am: 26bb7bf86c -s ours am: 86ac88ccdb
am: 2490679d7e

Change-Id: I59f3ace3a9c72a6d2fe1e1bd4cadec102a8c6254
2016-08-25 23:22:04 +00:00
Amith Yamasani
5eed3c9c38 DO NOT MERGE: Clean up when recycling a pid with a pending launch am: b02862c2cf am: dd0be992c0 am: 117a383099 -s ours am: 368ae62e9d
am: 1d513c845a

Change-Id: If920208b052d41a80d3a0bf70af831313c9b9c06
2016-08-25 23:22:00 +00:00
Narayan Kamath
b0429bbad5 resolve merge conflicts of 5191225 to mnc-dev am: 1fbc4b8624 am: 8f4f9e4d5e
am: a21569cd76

Change-Id: I502200a2a204e576944033a58ccd4be272603d5e
2016-08-25 23:21:09 +00:00
Sudheer Shanka
77dec89bb3 resolve merge conflicts of 270947f to klp-modular-dev am: 76c4b2a7b6 -s ours am: bbbb514bc9 am: 6a50270944 am: a0994c6d58 am: cdf70ba0a3
am: c2a760e68c

Change-Id: I2e5a3bb037921013e78b4270d843cebe239ac520
2016-08-25 23:14:09 +00:00
Sudheer Shanka
97194798ab Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-dev am: 96052ea905 -s ours am: f368bdee06 am: f21534a288 am: dfc2d0a4bc -s ours
am: 603a69ffb4

Change-Id: Ie94c3c24a3b07c26c8b363358f4df1d7366d95a2
2016-08-25 23:14:06 +00:00
Amith Yamasani
75c7391a41 DO NOT MERGE: Clean up when recycling a pid with a pending launch am: a92810a189 -s ours am: 9be12f8986 am: 03b0f5c3ec am: 7b8140652b -s ours
am: 9080d4462e

Change-Id: Idd437ad418ac2deaf08a9c0ac89cb518c216d8f1
2016-08-25 23:14:04 +00:00
Sudheer Shanka
2490679d7e Merge "DO NOT MERGE: Clean up when recycling a pid with a pending launch" into lmp-mr1-dev am: 5e55214ab7 am: c8aedeeaf6 am: 26bb7bf86c -s ours
am: 86ac88ccdb

Change-Id: Ia473e706d7b50376fffb122e03e48bd947f47562
2016-08-25 23:14:01 +00:00
Amith Yamasani
1d513c845a DO NOT MERGE: Clean up when recycling a pid with a pending launch am: b02862c2cf am: dd0be992c0 am: 117a383099 -s ours
am: 368ae62e9d

Change-Id: Icfafc6e9d56a97777db1c3d0e0feae3305f6707f
2016-08-25 23:13:58 +00:00