Commit graph

149 commits

Author SHA1 Message Date
Jeffrey Vander Stoep
7a29402717 Merge changes from topic \'fc_sort-2\' am: 87a73f199a
am: af77ab6b13

* commit 'af77ab6b136b0c4d44e912bbd2b98f958f7ceb45':
  fc_sort: initial commit
  checkfc: do not die on 0 length fc's
2016-01-15 19:41:30 +00:00
William Roberts
49693f1b4d fc_sort: initial commit
Ordering matters in fc files; the last match wins. In builds where
many BOARD_SEPOLICY_DIRS are set, the order of that list becomes
increasingly important in order to maintain a cohesive built
file_contexts.

To correct this, we sort the device specific file_contexts entries
with the upstream fc_sort tool.

Change-Id: I3775eae11bfa5905cad0d02a0bf26c76ac03437c
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-01-14 17:39:07 -08:00
Jeffrey Vander Stoep
b9053767ab Merge "Revert "fc_sort: initial commit"" am: 5de7574a59
am: 62871e5874

* commit '62871e5874e6b1663c732c7f2a2b2d6b36604534':
  Revert "fc_sort: initial commit"
2016-01-15 01:12:54 +00:00
Jeffrey Vander Stoep
b1fb7e4037 Revert "fc_sort: initial commit"
Breaks builds with no device specific policy.

Bug: 26568553
This reverts commit 29d146887e.

Change-Id: If9254d4ad3f104a96325beedebc05dd22664084a
2016-01-14 23:28:51 +00:00
Jeffrey Vander Stoep
a654d9f3aa Merge "fc_sort: initial commit" am: 2dea4525f3
am: faddabe6f5

* commit 'faddabe6f58f30f81938b928597ee7a792c34984':
  fc_sort: initial commit
2016-01-14 20:19:47 +00:00
William Roberts
29d146887e fc_sort: initial commit
Ordering matters in fc files; the last match wins. In builds where
many BOARD_SEPOLICY_DIRS are set, the order of that list becomes
increasingly important in order to maintain a cohesive built
file_contexts.

To correct this, we sort the device specific file_contexts entries
with the upstream fc_sort tool.

Change-Id: Id79cc6f434c41179d5c0d0d739c4718918b0b1dc
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-01-07 10:11:52 -08:00
Jeffrey Vander Stoep
9aa378ec31 Merge "Reduce socket ioctl perms" 2016-01-04 22:06:54 +00:00
Jeff Vander Stoep
cbaa2b7d37 Reduce socket ioctl perms
Reduce the socket ioctl commands available to untrusted/isolated apps.
Neverallow accessing sensitive information or setting of network parameters.
Neverallow access to device private ioctls i.e. device specific
customizations as these are a common source of driver bugs.

Define common ioctl commands in ioctl_defines.

Bug: 26267358
Change-Id: Ic5c0af066e26d4cb2867568f53a3e65c5e3b5a5d
2016-01-04 12:15:19 -08:00
Daniel Cashman
efeac86de4 Merge changes from topic \'sepolicy-makefile-cleanup\' am: 1e5b7a1962
am: 26f06d172d

* commit '26f06d172dc2b55c42b1543c7ef02563241efce1':
  Android.mk: cleanse all set but not unset variables
  Android.mk: clean dependencies and clear variables
2015-12-29 17:39:18 +00:00
William Roberts
50a478ef72 Android.mk: cleanse all set but not unset variables
Discovered by diffing the set of "set variables" with
the set of "cleared variables".

Script:

mydir=$(mktemp -d)

grep -E '(^[a-z].)[a-z0-9_\.]*\s*:?=.' Android.mk  | cut -d' ' -f 1-1 | sort | uniq > $mydir/set_vars
grep -E '(^[a-z].)[a-z0-9_\.]*\s*:?=$' Android.mk | cut -d' ' -f1-1 | sort | uniq > $mydir/unset_vars
diff $mydir/set_vars $mydir/unset_vars
rm -rf $mydir

Change-Id: Ib50abac6b417a1bcc1894d9a7bafdbdca371006a
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-12-28 16:19:54 -08:00
William Roberts
46749752e5 Android.mk: clean dependencies and clear variables
Dependencies being built with newline files in between
were also including the list of files without the newlines,
thus make would have to process 3n-1 files instead of 2n-1
where n is the number of files to process.

Additionally the *_with_nl variables were not being cleared
out and polluting Make's global name-space.

Change-Id: I76ea1a3dfae994b32991730aea7e4308da52a583
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-12-28 16:17:24 -08:00
William Roberts
4b412232c1 sectxfile_nl: fix superfluous dependencies am: cb1ab9858e
am: aeb403f233

* commit 'aeb403f233ada241a099777ccd0ef3b007e935e2':
  sectxfile_nl: fix superfluous dependencies
2015-12-16 23:44:41 +00:00
William Roberts
cb1ab9858e sectxfile_nl: fix superfluous dependencies
The target sectxfile_nl, which is an auto-generated newline file,
has dependencies on itself and the other files. The dependencies
should be on the other files and this newline file, not the other
way around. Ideally, the *_contexts recipes should have the
dependency recorded for their "contexts" files and the newline
file.

Additionally, recipe dependencies for building the *_contexts files
depended on the list of all the contexts files with the newline file
in that list, however an additional explicit addition of the newline
file was also added in. Remove this, since its in the full list of
files.

Change-Id: Iac658923f23a8d9263d392c44003b6bda4064646
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-12-16 14:01:58 -08:00
Jeffrey Vander Stoep
e927937f2d Merge "checkfc: add attribute test" am: d48773ab3e
am: c435b7590b

* commit 'c435b7590bd7d7f0594d48976fe931d1f6c07f32':
  checkfc: add attribute test
2015-12-16 16:35:36 +00:00
William Roberts
ad3cb39e54 checkfc: add attribute test
Enable checkfc to check *_contexts against a set of valid attributes
which must be associated with all types in the contexts file that
is being checked.

Since it's imperative that checkfc knows which file its checking to
choose the proper attribute set, the -s option is introduced to
indicate the service_contexts file. The property_contexts file continues
to use the existing -p and file_contexts requires no specification, aka
it's the default.

Failure examples:
file_contexts:
Error: type "init" is not of set: "fs_type, dev_type, file_type"

service_contexts:
Error: type "init_exec" is not of set: "service_manager_type"

property_contexts:
Error: type "bluetooth_service" is not of set: "property_type"

Change-Id: I62077e4d0760858a9459e753e14dfd209868080f
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-12-14 23:37:10 +00:00
Nick Kralevich
edb41d8744 Merge "Ensure newlines are added between context config files" am: d6765a99f3
am: 5cfd34957e

* commit '5cfd34957e48cd79e53fbfb8aa4acf1d53f8f638':
  Ensure newlines are added between context config files
2015-12-13 14:45:40 -08:00
Richard Haines
c8801fec63 Ensure newlines are added between context config files
When multiple file_contexts, service_contexts and property_contexts
are processed by the m4(1) macro processor, they will fail if one
or more of the intermediate files final line is not terminated by
a newline. This patch adds an intervening file only containing a
newline.

Change-Id: Ie66b32fe477d08c69e6d6eb1725f658adc384ce4
Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
2015-12-13 12:01:53 +00:00
Jeff Vander Stoep
3a0ce49b86 Migrate to upstream policy version 30
Grant untrusted_app and isolated_app unpriv_sock_perms, neverallow
priv_sock_perms to disallow access to MAC address and ESSID.

Change-Id: Idac3b657a153e7d7fdc647ff34b876a325d759b3
2015-12-11 18:07:17 +00:00
Jeffrey Vander Stoep
4f9107df8f Revert "Migrate to upstream policy version 30"
This reverts commit 2ea23a6e1a.

Change-Id: I5e9efa56d74ab22030611cab515e050e0bb77aca
2015-12-08 12:14:50 -08:00
Jeffrey Vander Stoep
5ca5696e8b Revert "Migrate to upstream policy version 30"
This reverts commit 2ea23a6e1a.

Change-Id: I5e9efa56d74ab22030611cab515e050e0bb77aca
2015-12-08 18:19:04 +00:00
Jeff Vander Stoep
2ea23a6e1a Migrate to upstream policy version 30
Grant untrusted_app and isolated_app unpriv_sock_perms, neverallow
priv_sock_perms to disallow access to MAC address and ESSID.

Change-Id: Idac3b657a153e7d7fdc647ff34b876a325d759b3
2015-12-08 07:18:41 -08:00
Jeff Vander Stoep
0fc831c3b0 Temporarily downgrade to policy version number
Temporarily move from policy version 30 to 29 until device kernels
and prebuilts are all upgraded to the accepted upstream version of
the selinux ioctl command whitelisting code.

(cherry picked from commit 89765083f7)

Bug: 22846070

Change-Id: I31d1e80aaee164cf41a2f01c6ca846a000898ef4
2015-10-23 10:16:00 -07:00
William Roberts
f88e31ea90 am 7fc865a4: service_contexts: don\'t delete intermediate on failure
* commit '7fc865a4caec1a2ced41918449e34596f50f8c43':
  service_contexts: don't delete intermediate on failure
2015-10-01 22:24:59 +00:00
William Roberts
630fd5d80c am dcffd2b4: property_contexts: don\'t delete intermediate on failure
* commit 'dcffd2b482a625a99233d82019d7b96919c41600':
  property_contexts: don't delete intermediate on failure
2015-10-01 22:11:37 +00:00
Colin Cross
0f1b1f353b am 9eb6c874: Revert "property_contexts: don\'t delete intermediate on failure"
* commit '9eb6c87439da2b00699f644a8b8c335bf8cd9680':
  Revert "property_contexts: don't delete intermediate on failure"
2015-10-01 22:11:33 +00:00
Colin Cross
2a41cb70a7 am efcaecab: Revert "service_contexts: don\'t delete intermediate on failure"
* commit 'efcaecab4eb075fdc69942e6915999458fb5f88b':
  Revert "service_contexts: don't delete intermediate on failure"
2015-10-01 22:11:32 +00:00
Jeffrey Vander Stoep
4f821319f7 am 23c42c38: Merge "service_contexts: don\'t delete intermediate on failure"
* commit '23c42c389b07f6ebda69ca8e834c27b27460879a':
  service_contexts: don't delete intermediate on failure
2015-10-01 22:11:25 +00:00
Jeffrey Vander Stoep
89c1fd2582 am e6e94762: Merge "property_contexts: don\'t delete intermediate on failure"
* commit 'e6e947622514bdf0b80bf093c0df1a7d9ae12c37':
  property_contexts: don't delete intermediate on failure
2015-10-01 22:11:24 +00:00
William Roberts
7fc865a4ca service_contexts: don't delete intermediate on failure
When service_contexts fails to build, the file is deleted
leaving only the error message for debugging. Build
service_contexts and general variant as a temporary
intermediate before running checkfc.

Change-Id: Ib9dcbf21d0a28700d500cf0ea4e412b009758d5d
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-10-01 22:01:50 +00:00
William Roberts
dcffd2b482 property_contexts: don't delete intermediate on failure
When property_contexts fails to build, the file is deleted
leaving only the error message for debugging. Build
property_contexts and general variant as a temporary
intermediate before running checkfc.

Change-Id: Ia86eb0480c9493ceab36fed779b2fe6ab85d2b3d
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-10-01 14:56:19 -07:00
Colin Cross
9eb6c87439 Revert "property_contexts: don't delete intermediate on failure"
This reverts commit 7f81b337bc.

Change-Id: I79834d0ef3adbf2eed53b07d17160876e2a999c6
2015-10-01 21:25:55 +00:00
Colin Cross
efcaecab4e Revert "service_contexts: don't delete intermediate on failure"
This reverts commit f6ee7a5219.

Change-Id: I4f1396e6e4aeecd1109f9c24494c6e82645c0663
2015-10-01 21:25:25 +00:00
William Roberts
f6ee7a5219 service_contexts: don't delete intermediate on failure
When service_contexts fails to build, the file is deleted
leaving only the error message for debugging. Build
service_contexts and general variant as a temporary
intermediate before running checkfc.

Change-Id: Ib9c9247d36e6a6406b4df84d10e982921c07d492
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-09-29 14:25:01 -07:00
William Roberts
7f81b337bc property_contexts: don't delete intermediate on failure
When property_contexts fails to build, the file is deleted
leaving only the error message for debugging. Build
property_contexts and general variant as a temporary
intermediate before running checkfc.

Change-Id: I431d6f4494fa119c1873eab0e77f0eed3fb5754e
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-09-29 14:25:01 -07:00
William Roberts
92461b6169 am 3746a0ae: file_contexts: don\'t delete intermediate on failure
* commit '3746a0ae63a56a6b18fabd3e89bfe4760a1691e3':
  file_contexts: don't delete intermediate on failure
2015-09-28 18:23:43 +00:00
William Roberts
3746a0ae63 file_contexts: don't delete intermediate on failure
Currently, if an error is detected in a file_contexts
file, the intermediate file_context.tmp file is removed,
thus making debugging of build issues problematic.

Instead, employ checkfc tool during the compilation recipe
so the m4 concatenated intermediate is preserved on
failure.

Change-Id: Ic827385d3bc3434b6c2a9bba5313cd42b5f15599
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-09-28 10:36:49 -07:00
Ivan Krasin
b49f5cf83f am 9aa41303: asan: update condition to work with multiple SANITIZE_TARGET values.
* commit '9aa413036bde2c80c25b381bd685ab05f8390127':
  asan: update condition to work with multiple SANITIZE_TARGET values.
2015-09-19 19:52:05 +00:00
Ivan Krasin
9aa413036b asan: update condition to work with multiple SANITIZE_TARGET values.
The goal is to enable SANITIZE_TARGET='address coverage', which
will be used by LLVMFuzzer.

Bug: 22850550
Change-Id: I953649186a7fae9b2495159237521f264d1de3b6
2015-09-18 12:05:51 -07:00
William Roberts
4d526d8675 am 031e5ce9: Android.mk: Cleanup GENERAL_*_CONTEXTS variables
* commit '031e5ce9c5cd3334cd2a09645cb03306fb552494':
  Android.mk: Cleanup GENERAL_*_CONTEXTS variables
2015-08-13 18:00:43 +00:00
William Roberts
dc858fe64d am 6aabc1c7: Android.mk: drop polluting variables
* commit '6aabc1c77b98d0ce8e13871047504afb90108733':
  Android.mk: drop polluting variables
2015-08-13 17:26:59 +00:00
William Roberts
031e5ce9c5 Android.mk: Cleanup GENERAL_*_CONTEXTS variables
Change-Id: Ic70a1208b67fe3961871cdeb39369c2ed3e0ce28
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-08-13 10:11:31 -07:00
William Roberts
6aabc1c77b Android.mk: drop polluting variables
Some of the ALL_*_FILES variables remained that were used
in a way that could not be cleared. Move them to lower
case variants and use a build recipe PRIVATE_*_FILES variable.
This avoids polluting the global namespace.

Change-Id: I83748dab48141af7d3f10ad27fc9319eaf90b970
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-08-13 10:09:23 -07:00
Richard Haines
32bbafc194 am c2d01914: Update Android.mk to support file_contexts.bin
* commit 'c2d01914d12b1c153b5ef32293079764a4342169':
  Update Android.mk to support file_contexts.bin
2015-08-13 00:40:32 +00:00
Richard Haines
c2d01914d1 Update Android.mk to support file_contexts.bin
This change supports external/libselinux changes to implement
PCRE formatted binary file_contexts and general_file_contexts.bin
files.

The $(intermediates) directory will contain the original text file
(that is no longer used on the device) with a .tmp extension as well
as the .bin file to aid analysis.

A CleanSpec.mk file is added to remove the old file_contexts file.

Change-Id: I75a781100082c23536f70ce3603f7de42408b5ba
Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
2015-08-12 08:45:44 -07:00
Dan Willemsen
10c1e872cc am bc2a49f2: Don\'t assume ordering of
* commit 'bc2a49f24726faec8699ad2eefa73ccbdc7ff3d5':
  Don't assume ordering of $(wildcard ...)
2015-08-11 20:23:15 +00:00
Dan Willemsen
bc2a49f247 Don't assume ordering of $(wildcard ...)
There are no guarantees on the order of the results from a call to the
wildcard function. In fact, the order usually changes between make 3.81
and make 4.0 (and kati).

Instead, sort the results of wildcard in each sepolicy directory, so
that directory order is preserved, but content ordering is reliable.

Change-Id: I1620f89bbdd2b2902f2e0c40526e893ccf5f7775
2015-08-11 12:27:08 -07:00
William Roberts
deb2f8b5f7 am d2185582: Android.mk: Add support for BOARD_SEPOLICY_M4DEFS
* commit 'd21855824d178abea9ac93376757c7aed765cd83':
  Android.mk: Add support for BOARD_SEPOLICY_M4DEFS
2015-07-27 18:02:27 +00:00
William Roberts
d21855824d Android.mk: Add support for BOARD_SEPOLICY_M4DEFS
Allow device builders to pass arbitrary m4 definitions
during the build via make variable BOARD_SEPOLICY_M4DEFS.
This enables OEMs to define their own static policy build
conditionals.

Change-Id: Ibea1dbb7b8615576c5668e47f16ed0eedfa0b73c
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-07-24 23:20:53 +00:00
Colin Cross
07039d386a am 29a463d5: Use build fingerprint from file
* commit '29a463d5d594a1b83288eff2da1f8829a69d3d46':
  Use build fingerprint from file
2015-07-23 19:01:40 +00:00
Colin Cross
29a463d5d5 Use build fingerprint from file
Improve incremental ninja builds by keeping the command line the same
across builds.

Change-Id: Iedbaa40c9f816f91afc8f073a9ed7f9ffd5d9a53
2015-07-17 13:40:42 -07:00