Commit Graph

566 Commits

Author SHA1 Message Date
Elliott Hughes 997abb668b Don't use TEMP_FAILURE_RETRY on close in frameworks/native.
Bug: http://b/20501816
Change-Id: Id13a62f02243c6c4831e2f47944dc34fa822f5b6
2015-05-15 17:05:40 -07:00
Chris Craik 05815996c9 Merge "Added Voltage and Current regulator ftrace events to atrace" 2015-05-07 16:20:52 +00:00
Mark Salyzyn 540e3de99f dumpstate: report per-partition MMC performance
Change-Id: If5cabe186d8377056effa1c0672a90e277cd7221
2015-04-30 12:58:32 -07:00
Andreas Gampe 816243d470 Installd: Add debug.gencfi to run_dex2oat
Add the debug.gencfi system property that forces generation of
CFI data.

Change-Id: Ida66f8c1567634d05cfdbba1a982be3684e94369
2015-04-27 08:12:23 -07:00
Jeff Sharkey e363724230 Command to move private app data between volumes.
New "mvuserdata" command will move all private app data from one
volume UUID to another.  It leverages the existing "cp" toybox
command to do the heavy lifting for all known users, preserving
details like timestamps and permissions.  It invokes restorecon()
to correctly label the new location when the copy is finished.

Changes installd to no longer drop capabilities, so we run as root
again.  This also allows us to exec "cp" with CAP_DAC_OVERRIDE and
CAP_FOWNER still in effect.

Bug: 19993667
Change-Id: I1f407a7c4a1af97ca5afc27b04eb16b4936cbdef
2015-04-10 00:21:35 -07:00
Jeff Sharkey 6fe28a0601 Start accepting volume UUIDs from framework.
We're now parsing and passing through volume UUIDs sent across the
command socket.  The "!" argument value is treated as null, which
means internal storage.

Bug: 19993667
Change-Id: I17729a769ce687a2e94e85991a6338c77ded0b66
2015-04-09 14:15:55 -07:00
Jeff Sharkey 41ea424413 More volume UUID awareness.
Teach free_cache() and restorecon_data() about building per-volume
paths.  Also clean up restorecon_data() by using std::string when
building paths.

Clearer names for path building utility methods, and tests to verify.

Bug: 19993667
Change-Id: Iacfbcdaa5b901cc2490bc8eba366dfdeb44f1d93
2015-04-09 11:44:06 -07:00
Andreas Gampe 0ad7a11003 Installd: Fix Clang build
Remove some unused parameters and variables.

Change-Id: I507ae48fe1744b800ceb29192d463fd26c2ccda7
2015-04-09 09:54:35 -07:00
Jeff Sharkey d107c305f7 Merge "Plumb through volume UUID when building paths." 2015-04-09 16:27:19 +00:00
Richard Uhler ab91d03b0d Merge "installd: Add support for SELF_PATCHOAT_NEEDED." 2015-04-09 14:13:27 +00:00
Mark Salyzyn f423b57dd9 dumpstate: scrub APANIC
Bug: 19525200
Change-Id: Ia2d2857cac953fb4ceafb66ddf775d89d7a777b1
2015-04-08 10:51:51 -07:00
Jeff Sharkey c03de09173 Plumb through volume UUID when building paths.
Since app data paths can live on expanded storage devices, accept the
target volume UUID when building paths.  The null UUID indicates the
default internal storage.

To improve readability, start using std::string in several places,
which throws when allocations fail.  For now, perform last-second
sanity checks on incoming path arguments, but we'll eventually want
to check arguments as they come through installd.cpp, instead of
crashing the entire daemon.

Also remove "lib" symlink code from install() and make_user_data(),
since we're no longer supporting /data/app-lib.  The framework
already uses linklib() to create the right symlink for the selected
ISA-specific library dir.

Bug: 19993667
Change-Id: Ib9343575ffb62bf3981e19375de8f3822fc31e28
2015-04-07 20:13:27 -07:00
Richard Uhler c92fb6247d installd: Add support for SELF_PATCHOAT_NEEDED.
Change-Id: Ib9a6373f98474f1242367b5285086251a9d580e5
2015-04-07 16:39:29 -07:00
Jeff Sharkey 19803807cd Switch installd to compile as C++.
This is the minimal change needed to switch it over to C++, which
paves the way for using more robust utilities like std::string.

Change-Id: I80ed6280146875eb6ddbbb340c05450388ca13f0
2015-04-07 14:01:43 -07:00
Jeff Sharkey e23a13299a Valid APK paths now include expanded storage.
Apps on expanded storage live at /mnt/expand/<uuid>/app/com.example,
so we need to relax one more directory level.

Bug: 19993667
Change-Id: I347ec7b92435ea69e632ed5d5fdfabe38ce0b56e
2015-04-07 14:01:12 -07:00
Fyodor Kupolov 8eed7e6a9b Use AID_SYSTEM as uid when creating oat dir
Previously AID_INSTALL was used, which was causing permission denied errors
when PackageManager was trying to recursively rename staging directory

Bug: 19550105
Bug: 20087446
Change-Id: I3a9e3056c1fbc1ce0077a3ce52cf77ea6b5085ee
2015-04-07 11:22:00 -07:00
Elliott Hughes a60ff367a4 Merge "Remove useless 'svcmgr_handle' (which had wrong type)." 2015-04-06 23:13:32 +00:00
Elliott Hughes 0b41ad5d6e Remove useless 'svcmgr_handle' (which had wrong type).
Also use the 'ptr' union member rather than 'handle'.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Change-Id: I68e5336cd3af3bc61dbddd2b33d7e1512c0c329c
2015-04-03 22:46:56 -07:00
Serban Constantinescu 018cf41a15 ServiceManager: Print kernel/userspace binder version
This patch adds extra logging for the binder version in case the userspace
and kernel versions differ.

Change-Id: I9859b29099726cfcfe5ca23d88ed2e101a06af1a
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2015-04-03 17:02:48 -07:00
Fyodor Kupolov 26ff93c1a7 Fix errors caused by unused variables
Change-Id: Ie52ae0e9a642504ee7b78c6bc54b61549cfb0342
2015-04-02 17:03:11 -07:00
Fyodor Kupolov 4eb88f8839 Merge "Support for storing OAT files in app directory" 2015-04-02 23:11:01 +00:00
Mark Salyzyn 13df5f5f8f servicemanager: service_manager missing include for string.h
service_manager.c gets string.h inherited from
private/android_filesystem_config.h it should
not rely on this in the future. The intent is
to move fs_config function into libcutils and
thus deprecate any need for string.h in this
include file.

Bug: 19908228
Change-Id: Icc95ee02bf02c596463868b1330d209d1bd5c58a
2015-04-01 11:11:11 -07:00
Andreas Gampe 8d7af8b241 Installd: Support dex2oat threads system property
Check dalvik.vm.dex2oat-threads in installd and pass to dex2oat.

Bug: 19992386
Change-Id: I5e7806cf560607d31a1d6901dffb14bee538c9cc
2015-03-30 18:45:03 -07:00
Fyodor Kupolov 88ce4ff7a9 Support for storing OAT files in app directory
Changes to installd:
- dexopt now allows oat_dir param for custom output directory
- Added helper method calculate_oat_file_path for calculating oat file
  output location based on oat_dir and apk_path.

Bug: 19550105
Change-Id: I6b079207310583adeb6dad918a58034a059e34c4
2015-03-30 13:48:22 -07:00
John Reck 469a194051 Add trace_event_clock_sync to atrace
Change-Id: I8adce15210d82df09ff3a39ddd8df617aeb16a42
2015-03-26 16:57:30 -07:00
Richard Uhler 009b877132 Store odex files in oat/<isa>/ directory.
Previously odex files were stored alongside the dex location as:
  dex location: /foo/bar/base.apk
  odex location: /foo/bar/<isa>/base.odex

This changes where odex files are stored, adding an "oat" directory:
  dex location: /foo/bar/base.apk
  odex location: /foo/bar/oat/<isa>/base.odex

See also the corresponding changes in platform/art and platform/build.

Bug: 19550105
Change-Id: I4c6be4f0c41ff175904846db8e360c4af815b265
2015-03-25 11:11:05 -07:00
Mathieu Chartier 6dad171304 Merge "Use verify-at-runtime if debug.usejit is true" 2015-03-21 00:14:27 +00:00
Mathieu Chartier d4a7b459f4 Use verify-at-runtime if debug.usejit is true
Bug: 19735273
Change-Id: Ib65b50dbde00184544a1341f351a0fe0ef504d32
2015-03-20 16:05:18 -07:00
Nick Kralevich cd67e9f059 dumpstate: add O_CLOEXEC
Add O_CLOEXEC to various file descriptor calls, to avoid
leaking file descriptors to dumpstate's child processes.

Bug: 18342188
Change-Id: I74c47a98dfddc29c618067ad53d879b98ed1d87a
2015-03-19 11:32:02 -07:00
Andreas Gampe 1fc747d20c am 5a25a63d: Merge "Installd: Pass debuggable flag"
* commit '5a25a63de2693177b15817fb19b684ca7bfec582':
  Installd: Pass debuggable flag
2015-03-10 02:10:06 +00:00
Andreas Gampe 598c25e23f Installd: Pass debuggable flag
Pass the debuggable flag from the package manager to dex2oat.

Change-Id: Id17ec72babe2ee88713a0d274eff86508de30666
2015-03-09 15:13:24 -07:00
Nick Kralevich fcf1689c1a am 5fec7915: Merge "service_manager: reorder permission checks for find"
* commit '5fec79156d749322dcc0376da1d6cf4d9ee9ccf4':
  service_manager: reorder permission checks for find
2015-03-05 21:48:25 +00:00
Nick Kralevich b27bbd18bb service_manager: reorder permission checks for find
Reorder the find permission checks. This avoids generating misleading
SELinux denials when a service doesn't exist, or when a service is
prohibited to isolated apps.

The original reason for structuring the code this way is explained
in https://android-review.googlesource.com/#/c/100530/4/cmds/servicemanager/service_manager.c@172
The concern at the time was to avoid leaking a situation where
a caller could probe for the existance of a service. This turns out
to be unnecessary. The same return value is used for both a
permission denied and a service not found. The only side effect
is the generation of an SELinux audit log, which likely won't be
accessible to the calling application.

Change-Id: I9760e1821ed16102fa5f9bec07f8c34944565be9
2015-03-05 10:58:40 -08:00
Christopher Ferris 69a141e07f am 9d68ed0e: Merge "Add timeout for dump_file."
* commit '9d68ed0ecd3a101c13a163cfe730b13b1564b442':
  Add timeout for dump_file.
2015-02-26 18:40:42 +00:00
Christopher Ferris 9d68ed0ecd Merge "Add timeout for dump_file." 2015-02-26 18:35:02 +00:00
Mark Salyzyn 2f655daeea am bb67beca: Merge "dumpstate: add pstore read"
* commit 'bb67beca35e7d570ede193a316a92022fbc2f810':
  dumpstate: add pstore read
2015-02-26 17:29:07 +00:00
Mark Salyzyn 2262c16372 dumpstate: add pstore read
Call logcat -L to pull any LAST Android logs. If the kernel is not
configured for PSTORE and PSTORE_PMSG, the hopes are the empty
content will pressure vendors to slice up and configure support.

Change-Id: I5fddfa1e0f59f24fccc30b257ba68af8a8cf8640
2015-02-26 07:41:41 -08:00
Christopher Ferris 54bcc5ffd5 Add timeout for dump_file.
It turns out dump_file is used on a number of /proc and system files.
In one case, the read of a file stalled and caused a bugreport to
hang forever. It's still possible if there is a kernel bug that this
could stall forever, but less likely.

Also, change the return type of nanotime to uint64_t.

Testing:
- Created a named fifo and verified that dump_file fails with a timeout.
- Created a large /data/anr/traces.txt to verify that large files still
  dump properly and that the additional NONBLOCK parameter doesn't cause
  a problem.
- Created a dummy /data/tombstones/tombstone_00 to verify that the
  dump of these files still works.
- Compared a dump using the old dumpstate to the new dumpstate to verify
  nothing obviously different.

Bug: 19117030
Change-Id: I0d3dd27583c853cdaccd2fd278748cb5f9ccd4fb
2015-02-25 19:59:29 -08:00
Aaron Schulman c2c6ecd119 Added Voltage and Current regulator ftrace events to atrace
Tracing the state of the voltage and current regulators enables a developer
to attribute power consumption measurements to specific perhipherals and
cores. Unlike other indirect methods of tracing when peripherals and cores
are toggled, the regulator ftrace event indicates the exact point in time
when the kernel switches on or off the device. For example, in the following
trace, a developer can see exactly when the krait2 core starts receiving
power, and and when the voltage is set for voltage scaling.

mpdecision-2172  [000] ...1  1566.665481: regulator_enable: name=krait2
mpdecision-2172  [000] ...1  1566.665493: regulator_enable_delay: name=krait2
mpdecision-2172  [000] ...1  1566.665495: regulator_enable_complete: name=krait2
<...>-4133  [002] ...1  1566.666891: regulator_set_voltage: name=krait2 (1075000-1100000)

Change-Id: I964d50be89bbfc554d2ab3e32a18514d1b1e70f4
Signed-off-by: Aaron Schulman <aschulman@google.com>
2015-02-25 17:50:23 +00:00
Bill Yi 28d41f5640 Merge commit '26cc3d0b67ff4daf31eaeed0ecd87b391978aadb' into HEAD 2015-02-19 14:31:45 -08:00
Elliott Hughes 2ead70ce67 Add missing <sys/file.h> include for flock.
Change-Id: I5c9bb4aa74d8a36d44e086bbcb5d60876727ce4c
2015-02-16 10:44:22 -08:00
Christopher Ferris 34e3246646 am 8511b3ae: Merge "Remove -z option."
* commit '8511b3ae5eb42810f97f7c3e993d7f80d3393b83':
  Remove -z option.
2015-02-10 16:53:52 +00:00
Christopher Ferris ff4a4dc7e6 Remove -z option.
This option doesn't work with the current selinux protections and
doesn't serve much of a purpose. You can get the same results running
this:

dumpstate | gzip > /data/local/tmp/dump.txt.gz

Bug: 19271141
Change-Id: Icc76200df33dc708e30c556ec8a0f393f995fe7c
2015-02-09 16:45:35 -08:00
Christopher Ferris 16c62c468a am 50ad67e4: Merge "Add better timeout mechanism for running commands."
* commit '50ad67e4ce6b07b5f5f4649ace81ed9a8b2c2eac':
  Add better timeout mechanism for running commands.
2015-02-04 02:08:44 +00:00
Christopher Ferris 1a9a338615 Add better timeout mechanism for running commands.
Change-Id: I60fc9e7d59c3e0e4b8b2f69f79c6903240bfd131
2015-02-03 14:53:44 -08:00
Elliott Hughes 42b5e6d49c am 51bfedd8: Merge "Add missing includes."
* commit '51bfedd821c79ae34ee1caffd9ae958faa71ecec':
  Add missing includes.
2015-01-30 21:16:38 +00:00
Elliott Hughes 824e30e5ed Add missing includes.
Change-Id: I1dad32ab459c25063a70cf52100a29d00fea3a90
2015-01-29 22:32:32 -08:00
Elliott Hughes e55073a96c am 0e17a265: Merge "Switch dumpstate to "ip link list"."
* commit '0e17a265f5e8bf233a3e3b74fc03ada3dc467bed':
  Switch dumpstate to "ip link list".
2015-01-28 17:34:16 +00:00
Elliott Hughes a59828a5d2 Switch dumpstate to "ip link list".
Change-Id: Ia1db51c866890f09fbd4316764dea5982554598f
2015-01-28 08:45:40 -08:00
Elliott Hughes 2e5a1cf27e am 346329b7: Merge "Move atrace from the obsolete bzero to memset."
* commit '346329b7a70b594895be0aec5dc00f9f4108b533':
  Move atrace from the obsolete bzero to memset.
2015-01-25 20:43:27 +00:00