Commit graph

20261 commits

Author SHA1 Message Date
Mihai Serban
51cdf140db Merge "ueventd: relabel block devices nodes when processing subsequent add events"
am: 94b0f37

* commit '94b0f3763f6dd4cfe2aaef9a4ce2ac7f029774c8':
  ueventd: relabel block devices nodes when processing subsequent add events

Change-Id: I9cfab12e0844991bd875d049e3e6ed3c50a27084
2016-04-28 12:06:41 +00:00
Treehugger Robot
94b0f3763f Merge "ueventd: relabel block devices nodes when processing subsequent add events" 2016-04-28 12:04:24 +00:00
Mihai Serban
24a3cbfa73 ueventd: relabel block devices nodes when processing subsequent add events
There is a race in ueventd's coldboot procedure that permits creation
of device block nodes before platform devices are registered. This happens
when the kernel sends events for adding block devices during ueventd's
coldboot /sys walk.
In this case the device node links used to compute the SELinux context
are not known and the node is created under the generic context:
u:object_r:block_device:s0.
A second add event for block device nodes is triggered after the platform
devices are handled by ueventd and the SELinux context is correctly computed
but the mknod call fails because the node already exists. This patch handles
this error case and updates the node's security context.

The race is introduced by the uevent sent from the sdcard device probe
function. The issue appears when this uevent is triggered during ueventd's
coldboot procedure but before the /sys/devices recursive walk reached the
corresponding sdcard platform device path.
The backtrace looks something like:
1. ueventd_main()
2. device_init()
3. coldboot("/sys/devices");
4. do_coldboot()
5. handle_device_fd()
6. handle_device_event()
6.1 handle_block_device_event()
6.2 handle_platform_device_event()

Because handle_device_fd() reads all events from the netlink socket it may
handle the add events for the sdcard partition nodes send occasionally by the
kernel during coldboot /sys walk procedure.
If handle_device_event() continues with handle_block_device_event()
before handle_platform_device_event() registers the sdcard platform device then
handle_block_device_event() will create device nodes without knowing all block
device symlinks (get_block_device_symlinks()):
1. handle_device(path=/dev/block/mmcblk0p3, links = NULL)
2. make_device(path=/dev/block/mmcblk0p3, links = NULL)
3. selabel_lookup_best_match(path=/dev/block/mmcblk0p3, links = NULL)
  returns the default context (u:object_r:block_device:s0) for
  /dev/block/mmcblk0p3 instead of more specific context like:
  u:object_r:boot_block_device:s0
4. setfscreatecon(u:object_r:block_device:s0)
5. mknod(/dev/block/mmcblk0p3)

So the node is create with the wrong context. Afterwards the coldboot /sys walk
continues and make_device() will be called with correct path and links.
But even if the secontext is computed correctly this time it will not be
applied to the device node because mknod() fails.
I see this issue randomly appearing (one time in 10 reboots) on a Minnoboard
Turbot with external sdcard as the boot device.

BUG=28388946

Change-Id: I96e239af29d82b753e5d349b3ecefaad09edee87
Signed-off-by: Mihai Serban <mihai.serban@intel.com>
2016-04-28 10:45:03 +00:00
Alex Vakulenko
499cfed160 Merge "Change remaining Android logging macros to use C99 varidaic syntax"
am: 3abd032

* commit '3abd03232efd53bb3a73d1e76f6f72754457e18d':
  Change remaining Android logging macros to use C99 varidaic syntax

Change-Id: Icc7457e9b883650d7ec15c0463405eb0565e31b3
2016-04-27 22:46:25 +00:00
Treehugger Robot
3abd03232e Merge "Change remaining Android logging macros to use C99 varidaic syntax" 2016-04-27 22:39:20 +00:00
Alex Vakulenko
3b0d65ad10 Change remaining Android logging macros to use C99 varidaic syntax
Most of the system/core/include/log/log.h file uses the C99 syntax of
variadic macros (that is, '...' in parameter list and __VA_ARGS__
in arguments). Except for andoid_printLog and android_printAssert
which still uses GCC custom extension syntax.

Switched the remaining macros to use C99 syntax. GCC extension syntax
makes my editor's code parser puke.

BUG: None
Change-Id: Ia6ebc0f2044b64182c425b179da0229c7046be4a
2016-04-27 14:44:40 -07:00
Dimitry Ivanov
e40d65fa8e Merge "native_loader: Use ANDROID_ROOT environment variable"
am: 6d28ae7

* commit '6d28ae7b0dfb486b3d7840185cdcbde5aec76a04':
  native_loader: Use ANDROID_ROOT environment variable

Change-Id: I1cda059bc87629f52077a33d18b2f8cdc4707dd2
2016-04-27 18:41:57 +00:00
Dimitry Ivanov
ced603d5da Merge "Enable namespaces for all target sdk versions"
am: 581beeb

* commit '581beebc98e9f420db30e7ff031302fea8ce4af2':
  Enable namespaces for all target sdk versions

Change-Id: I7b0c37717942d0d743e9f877bfba0a29ac0d9c7c
2016-04-27 18:41:57 +00:00
Dimitry Ivanov
6d28ae7b0d Merge "native_loader: Use ANDROID_ROOT environment variable" 2016-04-27 18:24:33 +00:00
Dimitry Ivanov
581beebc98 Merge "Enable namespaces for all target sdk versions" 2016-04-27 18:24:04 +00:00
Chih-Hung Hsieh
96dbbbb7b4 Merge "Fix google-explicit-constructor warnings."
am: bf1767f

* commit 'bf1767fbed903c2dee46fda8aac4f4023177ee4c':
  Fix google-explicit-constructor warnings.

Change-Id: I668e4ff4466b1ff5dd5a21ff9d1d430072216ca8
2016-04-27 15:50:51 +00:00
Treehugger Robot
bf1767fbed Merge "Fix google-explicit-constructor warnings." 2016-04-27 15:44:07 +00:00
Josh Gao
dbb3e3ba92 Merge "adb: decrease the number of fds used in fd_count test."
am: c296440

* commit 'c2964402b6ff91126bbbf7dd453adca40a13bd64':
  adb: decrease the number of fds used in fd_count test.

Change-Id: Id078e3b319bdd8591b78898e543a636f9eac6bf0
2016-04-27 00:07:46 +00:00
Treehugger Robot
c2964402b6 Merge "adb: decrease the number of fds used in fd_count test." 2016-04-26 23:55:11 +00:00
Josh Gao
858f133d41 adb: decrease the number of fds used in fd_count test.
Default limit is 1024 fds, which means 512 socketpairs will hit the
limit.

Bug: http://b/28386497
Change-Id: Ib36404c050e4be3db51378e250f300f7ec5aab13
2016-04-26 15:45:23 -07:00
David Pursell
8a77b300be Merge "adb: fix test_device.py shell protocol checks."
am: 52eb602

* commit '52eb6025edad892b7e346ad87dd52101a0ef1a6a':
  adb: fix test_device.py shell protocol checks.

Change-Id: Ie3dfde1bfda3172125df7f1487755e720f43133f
2016-04-26 21:44:23 +00:00
Treehugger Robot
52eb6025ed Merge "adb: fix test_device.py shell protocol checks." 2016-04-26 21:35:55 +00:00
Dan Albert
50db67ef97 Merge "Don\'t hardcode gtest paths."
am: 6b617c7

* commit '6b617c7c304f5e3b358e293237b3076b61285ee2':
  Don't hardcode gtest paths.

Change-Id: I5b7ba9dfe793d26eb4dc0415fd654ceba7a031ee
2016-04-26 21:30:08 +00:00
Treehugger Robot
6b617c7c30 Merge "Don't hardcode gtest paths." 2016-04-26 21:19:51 +00:00
David Pursell
cf46741b4f adb: fix test_device.py shell protocol checks.
https://android-review.googlesource.com/#/c/210646/ added a
has_shell_protocol() function but the test_device.py tests were still
trying to use the now-missing SHELL_PROTOCOL_FEATURE constant.

This CL just switches test_device.py to correctly use the
has_shell_protocol() method.

Change-Id: Ie0a2f0dc07529843d25051a01e08fb677551a4e1
Test: `python -m unittest discover -v` on devices with and without
      the shell protocol.
2016-04-26 13:29:39 -07:00
Dan Albert
3df8c67d29 Don't hardcode gtest paths.
Bug: http://b/16574165
Change-Id: Icaf99a51c309db7eb5f8b051a5896b5f49e1b3bc
2016-04-26 13:28:23 -07:00
Daniel Micay
182b310b1d Merge "sdcard: avoid benign unsigned overflow"
am: 64461c2

* commit '64461c293c52289d79b0073307347fb479affb4b':
  sdcard: avoid benign unsigned overflow

Change-Id: Id67f806996c3bef6e7f449c1795e3030edf224b8
2016-04-26 17:16:44 +00:00
Treehugger Robot
64461c293c Merge "sdcard: avoid benign unsigned overflow" 2016-04-26 17:10:49 +00:00
Daniel Micay
df9c4a0166 sdcard: avoid benign unsigned overflow
Change-Id: Id9427b4e01602bba31f8958b8d491b092b31482b
2016-04-26 12:08:46 -04:00
Jorge Lucangeli Obes
4eaf24008f Merge "Fix \'ps.c\' formatting."
am: 58505e1

* commit '58505e17bb44832ec6d63f62649b666e17bb5ad0':
  Fix 'ps.c' formatting.

Change-Id: I35a75946af9bb6d3725372ed40fe8a909206d82e
2016-04-26 03:46:03 +00:00
Jorge Lucangeli Obes
58505e17bb Merge "Fix 'ps.c' formatting." 2016-04-26 03:39:53 +00:00
Yabin Cui
61f6d1df52 Merge "adb: fix socket tests."
am: e998abd

* commit 'e998abde89e59f3bc3a7d425332e7ab295259607':
  adb: fix socket tests.

Change-Id: Ieb4ecd90c49d4d99c24bd9658f2568176956ddc9
2016-04-26 03:05:09 +00:00
Yabin Cui
e998abde89 Merge "adb: fix socket tests." 2016-04-26 03:00:15 +00:00
Yabin Cui
2407d7c3d9 adb: fix socket tests.
Bug: 28386497

Change-Id: I9f37ecadf3cfc6bb4e5da502d40f49e1f3a16d8a
2016-04-25 19:51:58 -07:00
Chih-Hung Hsieh
e641a2fa61 Merge "Fix google-explicit-constructor warnings."
am: e1d5c25

* commit 'e1d5c2548b9794c39d943205daad3be971e8bcfa':
  Fix google-explicit-constructor warnings.

Change-Id: Ic44fbc1fd8e814861f2b4e314ab6552e59b87b0e
2016-04-26 00:46:45 +00:00
Chih-hung Hsieh
e1d5c2548b Merge "Fix google-explicit-constructor warnings." 2016-04-26 00:36:31 +00:00
Jorge Lucangeli Obes
5c1b3afbd4 Fix 'ps.c' formatting.
Insert a space between 'if'/'while' and their clause.
Also insert a space after ',' for arguments.

This was done with clang-format.

Bug: None

Change-Id: I5315eba3d5d8ac68996a373dc7c8e1bc45165824
2016-04-25 16:31:15 -07:00
Jorge Lucangeli Obes
29ea5654e3 Merge "Fix \'ps --ppid\'."
am: 47f808d

* commit '47f808d09f3f2ecfff62dfb6ff57090ff106469a':
  Fix 'ps --ppid'.

Change-Id: I13711e1883a65ccb0833644f34fa9921b50ee5ba
2016-04-25 23:27:00 +00:00
Jorge Lucangeli Obes
47f808d09f Merge "Fix 'ps --ppid'." 2016-04-25 23:21:56 +00:00
Jorge Lucangeli Obes
c5e7f73bc6 Fix 'ps --ppid'.
Currently, 'ps' will segfault when called with '--ppid' and no argument.
Make it return an error instead.

Bug: 28383024

Change-Id: I71f2d1ba9502996ae75b17605234eb99ebb589f2
2016-04-25 15:54:12 -07:00
Chih-Hung Hsieh
e5100e6677 Merge "Fix google-explicit-constructor warnings."
am: f966019

* commit 'f9660191f03a7e2ee83064c5240e97a82a482769':
  Fix google-explicit-constructor warnings.

Change-Id: I9fb5f687858dba101fd6f3f5e728cce2d4d815e9
2016-04-25 22:38:37 +00:00
Chih-Hung Hsieh
75935ef67e Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I0ce541f79feef5c08eac64edc686be3edf9c2aa4
2016-04-25 15:28:36 -07:00
Chih-hung Hsieh
f9660191f0 Merge "Fix google-explicit-constructor warnings." 2016-04-25 22:22:06 +00:00
Chih-Hung Hsieh
3a114e0a81 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I5d1988efc1563efbdb25c867713c54f41439a82a
2016-04-25 14:57:11 -07:00
Raja M
3b4af9a44d Merge "GCC compiler warning fix for sprintf into snprintf"
am: d2afbe4

* commit 'd2afbe45e1ff50e38e907b0ca2fff3dbec3ba529':
  GCC compiler warning fix for sprintf into snprintf

Change-Id: I18e23cb3df033869144f9c5f3e7563d53f5e5333
2016-04-25 21:14:29 +00:00
Elliott Hughes
d2afbe45e1 Merge "GCC compiler warning fix for sprintf into snprintf" 2016-04-25 20:58:04 +00:00
Chih-Hung Hsieh
1cc82ce95c Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I2cf746fd07addc6e6c22e98e2a5bb8a8ce47c885
2016-04-25 13:49:46 -07:00
Yabin Cui
ec4db8f14f Merge "adb: fix adb usb operations on device."
am: ad2021a

* commit 'ad2021a1b1144f8b307c11ff0a8b47fd85c3cc7a':
  adb: fix adb usb operations on device.

Change-Id: I2907aa60f4b69cb09ef9d5d1d30797e84af21c7d
2016-04-25 17:36:20 +00:00
Yabin Cui
ad2021a1b1 Merge "adb: fix adb usb operations on device." 2016-04-25 17:19:03 +00:00
Raja M
79bf64dc66 GCC compiler warning fix for sprintf into snprintf
To fix GCC WARNINGS while building.
or
To support error free -D_FORTIFY_SOURCE=2 strict mode compilation.
2016-04-24 09:44:04 +05:30
Zach Riggle
a0690543da Merge "Fix NULL deref on exec-in with insufficient arguments"
am: 245e4dbfd4

* commit '245e4dbfd459f63bad100b09bd58e3931924e16f':
  Fix NULL deref on exec-in with insufficient arguments

Change-Id: I386257b6c30c4f02e161e2b0a827e73eca9d229e
2016-04-22 15:51:38 +00:00
Treehugger Robot
245e4dbfd4 Merge "Fix NULL deref on exec-in with insufficient arguments" 2016-04-22 15:40:58 +00:00
Zach Riggle
ccafc79de7 Fix NULL deref on exec-in with insufficient arguments
(cherry-pick of 566a28169b84836fddd5ae96db9b147237ea054f.)

Bug: 28152091
Change-Id: Ib59e3bf7f26974aa09d2e6a0e1d9281d7ce25511
2016-04-22 08:08:01 -07:00
Dimitry Ivanov
7e8cee8fb2 native_loader: Use ANDROID_ROOT environment variable
Replace "/system" with ANDROID_ROOT environment variable.

Bug: http://b/28320913
Bug: http://b/28082914
Change-Id: Ib039722cb059bae1635b45f6af20ef0180e83ba9
2016-04-21 16:42:48 -07:00
Dimitry Ivanov
213676b880 Enable namespaces for all target sdk versions
We previously relied on the fact that target sdk version 0
implies system_server, which is not true, target sdk version
may be set to 0 for other apps and it means 1 - the earliest
version of android. This change enables namespaces for
apps targeting all sdk version and for system_server.

Bug: http://b/27702070
Change-Id: I16fbdeb6868c7035aec71132c80c150c08ea2cc3
2016-04-21 11:35:57 -07:00