Commit graph

12685 commits

Author SHA1 Message Date
Narayan Kamath
e97e66ea7c Use base::WriteFully in zip_archive.
We're already linking against libbase but we'll have to add
a libbase dependency to every target that includes libziparchive
as a STATIC_LIBRARY dependency, given that there's no way to
express that what we want (except by adding a LOCAL_WHOLE_STATIC_LIBRARY
dependency on libbase to libziparchive but that seems bad too)

Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
2015-04-29 14:31:45 +00:00
Jeff Brown
07e07aa475 Merge "Add float support to binary event log." 2015-04-29 01:42:47 +00:00
Jeff Brown
44193d9eae Add float support to binary event log.
Bug: 20664753
Change-Id: Ib4752bd785496dab5bb4d4979d5d80f662adbdfa
2015-04-28 18:20:48 -07:00
Nick Kralevich
f0d2473735 Merge "init: remove support for disabled SELinux" 2015-04-28 20:13:56 +00:00
Nick Kralevich
d34e407aeb init: remove support for disabled SELinux
Remove support for androidboot.selinux=disabled. Running with SELinux
disabled is not a supported configuration anymore. SELinux must be
in enforcing in shipping devices, but we also support permissive for
userdebug/eng builds.

Don't try security_setenforce() if we're already in enforcing mode.
A kernel compiled without CONFIG_SECURITY_SELINUX_DEVELOP does
not have a permissive mode, so the kernel will already be enforcing
once the policy is loaded.

Bug: 19702273
Change-Id: I07525a017ddb682020ec0d42e56a2702c053bdeb
2015-04-28 13:11:07 -07:00
Paul Lawrence
2b3a493946 Merge "Revert "Securely encrypt the master key"" 2015-04-28 19:15:40 +00:00
Paul Lawrence
7ac2807546 Revert "Securely encrypt the master key"
This reverts commit 4bf1887c78.

Change-Id: Ie6d1f39de530b99b50a27ddc45bcc900a24e04b5
2015-04-28 19:15:01 +00:00
Paul Lawrence
6e8c8f542d Merge "Revert "Only run vold command when file encryption enabled"" 2015-04-28 19:14:45 +00:00
Paul Lawrence
34276a1534 Revert "Only run vold command when file encryption enabled"
This reverts commit efe190e023.

Change-Id: Ib15af9a85b0b885a388bda28511a6fc39a777264
2015-04-28 19:12:35 +00:00
Elliott Hughes
4b81659ed2 Merge "Remove strtok from adb." 2015-04-28 17:54:36 +00:00
Paul Lawrence
a71ef0d5b5 Merge "Only run vold command when file encryption enabled" 2015-04-28 15:24:10 +00:00
Elliott Hughes
8d5fa6da44 Remove strtok from adb.
Also fix android::base::Split to behave like Java, Python, and google3.

Change-Id: Ifbffd4e92950a79e7aea5d153c95fe0980648417
2015-04-27 19:42:20 -07:00
Elliott Hughes
06d2128f87 Merge "Support the full length of USB serial numbers." 2015-04-28 00:18:29 +00:00
Elliott Hughes
9309ecbcec Support the full length of USB serial numbers.
Two bugs: we couldn't report the serial number correctly if it was long
enough, and it wasn't possible to connect to a device whose serial number
was long enough to overflow a different fixed-length buffer.

Bug: http://b/20317730
Change-Id: Ic9cf3c847066449ac78069bd1718184935098ac7
2015-04-27 14:52:17 -07:00
Paul Lawrence
9234b169e6 Merge "Securely encrypt the master key" 2015-04-27 20:08:53 +00:00
Elliott Hughes
96b6415c56 Merge "Use WriteFully in debuggerd to talk to ActivityManager." 2015-04-27 19:47:30 +00:00
Greg Hackmann
ba5f10a565 Merge "libziparchive: fix clang build" 2015-04-27 17:16:25 +00:00
Greg Hackmann
d6eac24aac libziparchive: fix clang build
Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-04-27 10:14:32 -07:00
Narayan Kamath
246f8533bf Merge "Avoid mapping output to memory while writing to a file." 2015-04-27 15:16:38 +00:00
Narayan Kamath
f899bd534b Avoid mapping output to memory while writing to a file.
It's unnecessary, and causes issues when the uncompressed
output is large.

Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53
2015-04-27 13:34:18 +01:00
Nick Kralevich
9c9280d863 Merge "init: get rid of the remaining double mounts" 2015-04-26 01:51:04 +00:00
Nick Kralevich
f667a3247a init: get rid of the remaining double mounts
Don't double mount /dev and its subdirectories anymore. Instead, the
first stage init is solely responsible for mounting it.

Don't have init prepare the property space. This is the responsibility
of the second stage init.

Don't have SELinux use the property space to determine how we should
be running. Instead, create a new function and extract the data we
need directly from /proc/cmdline. SELinux needs this information in
the first stage init process where the property service isn't available.

Change-Id: I5b4f3bec79463a7381a68f30bdda78b5cc122a96
2015-04-25 18:29:26 -07:00
Nick Kralevich
ccac2be8a6 Merge "init: use SELinux /dev/null if available" 2015-04-26 00:59:01 +00:00
Nick Kralevich
e34577ce1b init: use SELinux /dev/null if available
SELinux provides it's own /dev/null character device at
/sys/fs/selinux/null. This character device is exactly the same
as /dev/null, including the same major/minor numbers, and can
be used wherever /dev/null is used.

Use /sys/fs/selinux/null instead of trying to create our own
/dev/__null__ device. This moves us one step closer to eliminating
all uses of mknod() by init.

/sys/fs/selinux/null is only available once the /sys/fs/selinux filesystem
is mounted. It's not available to the first stage init, so we
still have to fall back to mknod then.

Change-Id: Ic733767ea6220a130537de33cc478ae79578ce20
2015-04-25 16:48:23 -07:00
Nick Kralevich
178299fd45 Merge "init: don't double mount /proc and /sys" 2015-04-25 23:11:27 +00:00
Nick Kralevich
f8b0743ef4 Merge "init: fix write_file checkreqprot logic error" 2015-04-25 23:09:08 +00:00
Elliott Hughes
47a9ef2f11 Merge "Improve logging of USBDEVFS_CLAIMINTERFACE failures." 2015-04-25 23:05:28 +00:00
Nick Kralevich
9dec93bfeb init: don't double mount /proc and /sys
The first stage init mounts /proc and /sys, and then the second
stage init also mounts /proc and /sys on top of the existing mount.
Only mount these two directories once, in the first stage init.

Not yet fixed: the double mounting of /dev. Removing the double
mounting doesn't work right now because both init stages are trying
to create a property space, and if the double mount of /dev goes away,
the property service in the second stage init fails to work.

Change-Id: I13719027a47526d074390c2b1a605ad99fb43a8f
2015-04-25 15:50:03 -07:00
Nick Kralevich
eedbe81f75 init: fix write_file checkreqprot logic error
write_file() returned -errno on error, not -1. Callers who check for
-1 would falsely believe that the write was successful when it wasn't.
Fixup write_file so that it return -1 on error consistent
with other functions.

Change-Id: Ic51aaf8678d8d97b2606bd171f11b3b11f642e39
2015-04-25 15:36:13 -07:00
Elliott Hughes
ce6363bbbc Improve logging of USBDEVFS_CLAIMINTERFACE failures.
Bug: https://code.google.com/p/android/issues/detail?id=170054
Change-Id: I9b11eb019093e3322da0a8e70d6e17de4c25ab75
2015-04-25 14:44:23 -07:00
Nick Kralevich
8929c77ab9 Merge "init: remove mkdir /dev /proc /sys" 2015-04-25 21:08:12 +00:00
Nick Kralevich
a1f6a4b139 init: remove mkdir /dev /proc /sys
These directories are already present in the initial ramdisk, and
these mkdir calls are no-ops.

Change-Id: I528f9e96a3471de904845a2f9e09c1b6ff83a708
2015-04-25 13:48:26 -07:00
Elliott Hughes
6ce5625d58 Merge "Improve toolbox SIGPIPE behavior." 2015-04-25 19:14:54 +00:00
Elliott Hughes
5976018b4a Improve toolbox SIGPIPE behavior.
None of our tools -- except for top, which I'd fixed previously --
handles SIGPIE correctly. Let's just handle SIGPIPE in the driver.

Bug: https://code.google.com/p/android/issues/detail?id=157920
Change-Id: I322ea411f53c71585a64118c217d54389f675d4e
2015-04-25 12:03:41 -07:00
Elliott Hughes
b7cd09b93e Use WriteFully in debuggerd to talk to ActivityManager.
Change-Id: I5b57fda9b0343434e1c0f9189147075a368e0282
2015-04-24 22:25:12 -07:00
Elliott Hughes
9798023e9f Merge "Add ReadFully and WriteFully to libbase." 2015-04-25 05:01:21 +00:00
Elliott Hughes
2899c94b9d Merge "Switch init to epoll." 2015-04-25 05:01:03 +00:00
Elliott Hughes
56085edbf8 Add ReadFully and WriteFully to libbase.
Change-Id: I6b7aa2a93398e7acdd1d74c71d9abed08a72b3c4
2015-04-24 21:57:16 -07:00
Elliott Hughes
929f407076 Switch init to epoll.
Not just because it's what the cool kids are doing --- it also lets us
simplify the inner loop and decouple it from whatever systems want to
be woken to perform some activity if there's data to be read on some fd.

Currently this is just used to clean up the existing signal handling,
keychord, and property service code.

Change-Id: I4d7541a2c4386957ad877df69e3be08b96a7dec5
2015-04-24 21:13:44 -07:00
Elliott Hughes
df5d448207 Merge "Clean up property service initialization." 2015-04-25 02:36:46 +00:00
Elliott Hughes
c6c26ed781 Clean up property service initialization.
All the code that was being delayed does is create a socket. We can
do that straight away, avoid the overhead, and simplify our main loop.

The keychord fd, on the other hand, seems a little tricky. It looks
like /dev/keychord isn't immediately available, at least not on N9;
we have to wait for ueventd to set us up the bomb.

Change-Id: I020e75b8e4b233497707f0a3cbbb6038b714161f
2015-04-24 19:15:20 -07:00
Elliott Hughes
b749be0bc3 Merge "Clean up init signal handling a little." 2015-04-25 01:10:58 +00:00
Elliott Hughes
9042cae40b Clean up init signal handling a little.
We can set it up earlier, and error reporting like this helped me find
the SELinux problem with the last change to this code.

Change-Id: If0f38bc5ff0465c4030e2d39d34f31f49b2d8487
2015-04-24 17:43:21 -07:00
Elliott Hughes
662baefbb7 Merge "Setup signal handler before any exec command" 2015-04-25 00:24:55 +00:00
Mark Salyzyn
05c92d2b4f Merge "liblog: Add BM_is_loggable benchmark" 2015-04-24 21:42:47 +00:00
Elliott Hughes
a5669861c1 Merge "Revert "Revert "Remove now-unusable 'setcon' command.""" 2015-04-24 20:31:19 +00:00
Elliott Hughes
c7ca9dd6c8 Revert "Revert "Remove now-unusable 'setcon' command.""
This reverts commit b862bd00a4.

This change was fine but an earlier change it depended on was broken.
That change has been fixed and resubmitted.

Bug: http://b/19702273
Change-Id: I17e565721026e48e2a73526f729f2481d4d6edb5
2015-04-24 12:41:47 -07:00
Elliott Hughes
132440b087 Merge "Revert "Revert "Make init re-exec itself for its SELinux domain transition.""" 2015-04-24 19:33:21 +00:00
Elliott Hughes
f65730e620 Revert "Revert "Make init re-exec itself for its SELinux domain transition.""
This reverts commit 4217374611.

It turns out that the kernel passes any unrecognized arguments on to init,
and (at least) N6 and N9 have such arguments. My lazy check of argc was
thus insufficient to recognize what stage of init we were in, so we'd
skip to stage 2 and not set up SELinux. And apparently you can get a
very long way with SELinux off... We'll fix that in a later change.

Bug: 19702273
Change-Id: I43b3fb722fed35dd217cb529cbcac9a29aff4e4b
2015-04-24 12:26:05 -07:00
Elliott Hughes
34dd04dbb5 Merge "Improve bad error reporting seen in shamu SELinux boot failures." 2015-04-24 18:36:55 +00:00