Commit Graph

2170 Commits

Author SHA1 Message Date
Chih-Hung Hsieh 6e28ff2ce6 Merge "Use -Werror in system/core" am: 4ef714eae0
am: 57270f809a

Change-Id: If5d4ec1749ff2acbce781b0b6678a53fc7169d90
2017-11-01 21:23:58 +00:00
Chih-Hung Hsieh 122352d983 Use -Werror in system/core
* Move -Wall -Werror from cppflags to cflags.
* Fix/suppress warning on unused variables.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
2017-11-01 11:32:55 -07:00
Tao Wu 8b0654925d Merge "Fix race condition between restart and stop/reset." am: ee14225e0d
am: 5c5a6bdc87

Change-Id: Id9c1bb0ecd1b7b02c60fd2f0ce6ab67ea8f7096d
2017-10-27 22:04:54 +00:00
Tao Wu ee14225e0d Merge "Fix race condition between restart and stop/reset." 2017-10-27 21:32:51 +00:00
Tao Wu 84b856d901 Fix race condition between restart and stop/reset.
If there is a restart follow a stop/reset immediately or vice versa,
clear previous flag bits.

Test: manual - trigger restart after stop immediately to check if
service get started.

Change-Id: I4503177d7cb5ed054dbcf50cd8e09728415404d4
2017-10-27 11:31:42 -07:00
Tao Wu 7cb9d878a0 Merge "Fix one race condition between start and stop." am: 876b13d0ec
am: 36be7e61bf

Change-Id: I6b46004ac43d1c29ebedd982be10ba33c7460968
2017-10-27 00:26:42 +00:00
Tao Wu 876b13d0ec Merge "Fix one race condition between start and stop." 2017-10-26 22:48:51 +00:00
Tao Wu 990d43cb82 Fix one race condition between start and stop.
For a oneshot service, if start happens immediately after stop,
the service could be still in stopping status and then start
won't do anything. This fix this race condition.

Test: manual - see reproduce instructions in bug.
Bug: 68020256
Change-Id: I20202fa346f1949a8bda3d90deedc8b6a6d814d3
2017-10-26 22:08:56 +00:00
Joe Tanen bd14151a96 Merge "init: fixed issues related to forking services" am: 03d67dd99e
am: 0f9791bdd3

Change-Id: I2fa0c42f1ac075c636930cea435d19ac801b7e15
2017-10-26 18:47:18 +00:00
Treehugger Robot 03d67dd99e Merge "init: fixed issues related to forking services" 2017-10-26 18:38:23 +00:00
Joe Tanen 4bfdcb3932 init: fixed issues related to forking services
Fixed issues related to forking services into new PID + mount
namespaces.

Remounting rootfs recursively as slave when creating a service in new
PID + mount namespaces. This prevents the service from interfering with
mount points in the parent namespace.

Unmount then mount /proc instead of mounting it with MS_REMOUNT, since
MS_REMOUNT is not sufficient to update /proc to the state appropriate
for the new PID namespace. Note that the /proc mount options specified
here are not the same as those used in the default mount namespace. I
kept them consistent with those used in the code prior to this fix.

Test: Used custom sleepd service to test init 'namespace' keyword.
Tested on angler in oreo-dev - I had to add PID namespaces to the
kernel (commit ad82c662).

Change-Id: I859104525f82fef3400d5abbad465331fc3d732f
2017-10-26 09:08:11 -07:00
Nick Kralevich 4163af47dc Merge "Don't use TEMP_FAILURE_RETRY on close()" am: 0f2097c0f0
am: 72d7cbe78f

Change-Id: I889fb09b36b07567154c4ba5c2c7c85bd3b302f9
2017-10-24 20:43:03 +00:00
Treehugger Robot 0f2097c0f0 Merge "Don't use TEMP_FAILURE_RETRY on close()" 2017-10-24 19:47:20 +00:00
Nick Kralevich 3d118e72dd Don't use TEMP_FAILURE_RETRY on close()
See https://lkml.org/lkml/2005/9/10/129 for details.

Bug: 20501816
Test: code compiles and boots with no obvious problems.
Change-Id: I5a9c470156d498852cfd81fbd59ddcf267309e73
2017-10-24 10:46:34 -07:00
Wei Wang 31665189cf Merge "init: call umount unconditionally" am: b409e5e00b
am: 121ff413ef

Change-Id: I9a1da7d6ffa4af9968d7b07adf44494ef61df312
2017-10-24 02:16:15 +00:00
Wei Wang 121ff413ef Merge "init: call umount unconditionally"
am: b409e5e00b

Change-Id: I9eb45b728145301418b9d7775067ce298551f063
2017-10-24 02:13:43 +00:00
Wei Wang 25dc30f3be init: call umount unconditionally
std::all_of is using std::find_if, which means, if any element the given
predicate returns false, it stops further iteration and just returns false.
std::all_of used in Reboot.cpp will cause umount not to be called on all
block devices if some block device returns false in the middle.

Bug: 68158923
Test: reboot
Change-Id: I43ba6bd0c18018c1ed5fe2b63996552bc51cc67c
2017-10-23 16:25:31 -07:00
Tom Cherry 1668f91590 Merge "init: clean up subcontext_test" am: 4e2a8e375e am: be96bdb09d
am: 9beb982787

Change-Id: I17f189d04ac8ce0c16bd5d71aaad316e5249f63f
2017-10-20 14:44:44 +00:00
Tom Cherry be96bdb09d Merge "init: clean up subcontext_test"
am: 4e2a8e375e

Change-Id: I0ab7401d36d32c5e0df7dc68286117a1ac60d2f8
2017-10-20 14:40:02 +00:00
Tom Cherry 4e2a8e375e Merge "init: clean up subcontext_test" 2017-10-20 14:36:31 +00:00
Steven Moreland 7caf2a4d59 Merge "init language extension for lazy HIDL services." am: 0f40200577 am: fea6f56069
am: 195475418c

Change-Id: I253c8d243489e6d6286d3e5127e2eaf63adc2395
2017-10-20 06:52:10 +00:00
Steven Moreland fea6f56069 Merge "init language extension for lazy HIDL services."
am: 0f40200577

Change-Id: I7b42d2b6af8c9d53a7adb97643d040037ab96b00
2017-10-20 06:43:34 +00:00
Treehugger Robot 0f40200577 Merge "init language extension for lazy HIDL services." 2017-10-20 06:38:42 +00:00
Steven Moreland e055d73396 init language extension for lazy HIDL services.
This associates every service with a list of HIDL services
it provides. If these are disabled, hwservicemanager will
request for the service to startup.

Bug: 64678982
Test: manual with the light service
Change-Id: Ibf8a6f1cd38312c91c798b74574fa792f23c2df4
2017-10-19 20:38:47 -07:00
Tom Cherry c4763ff50b Merge "init: add SelabelInitialize() for subcontext" am: cba7f57119 am: f0b4e4daee
am: 9815d0d400

Change-Id: I36b8a5ebe5d8845fdc0bba61434b94ef015efea3
2017-10-20 01:49:32 +00:00
Tom Cherry f0b4e4daee Merge "init: add SelabelInitialize() for subcontext"
am: cba7f57119

Change-Id: I0ea0c99c5848aeaa5fd463e347bd76c5b471b7ef
2017-10-20 00:54:39 +00:00
Tom Cherry 0d1452ee1b init: add SelabelInitialize() for subcontext
Children of init that use any of the SELinux wrapper functions,
including make_dir(), mkdir_recursive(), and plenty others, need to
first initialize the sehandle with SelabelInitialize().

I wish there were a better solution, but early init doesn't actually
want this handle initialized, so that is a valid use case.  Ueventd
needs to initialize this before fork()'ing, so lazy initialization is
not universally acceptable either.  Likely we won't have other
children that fork() then exec() init again, so this should be okay.

Bug: 62875318

Test: init unit tests
Test: sailfish creates directories with correct SELabel after wipe
Change-Id: I6de937604a060e18945427418f15b90e0b9d5c37
2017-10-19 16:25:45 -07:00
Tom Cherry e6d37cdbf9 init: clean up subcontext_test
subcontext_test had been failing due to setexeccon() failing to
transition to vendor_init context.  This is a good thing as nothing
other than init should be able to transition into this context.

I don't want to add code to skip the setexeccon() call only for the
tests, so I instead call setexeccon() with the return value of
getcon().  This works however only for root, so these tests are
skipped for non-root.

Test: init unit tests
Change-Id: I8a415599e0ec5506511202f7f5018c0e5265837d
2017-10-19 16:24:56 -07:00
Tom Cherry 24a7f14a39 Merge "init: add extra std::move" am: d72d92aee2 am: 7a23e13edb
am: fecca8eef1

Change-Id: Ifa816d0bb2b6e5e784aed66972f30316560ace55
2017-10-19 02:39:45 +00:00
Tom Cherry 7a23e13edb Merge "init: add extra std::move"
am: d72d92aee2

Change-Id: I928e6f60bd8ffb764ea5f25a81091242efd1f61d
2017-10-19 02:27:32 +00:00
Treehugger Robot d72d92aee2 Merge "init: add extra std::move" 2017-10-19 02:17:20 +00:00
Tom Cherry 4d4cc0920b Merge "init: wait_for_prop shouldn't run in a subcontext" am: 6e52973623 am: cadc34fd9a
am: fe08631fe8

Change-Id: I4fb910117150fecf4f61670be8d7ea1def235c61
2017-10-19 00:19:01 +00:00
Tom Cherry cadc34fd9a Merge "init: wait_for_prop shouldn't run in a subcontext"
am: 6e52973623

Change-Id: I160bedcb91668ccf2b663c36835871d21be2db8b
2017-10-19 00:14:21 +00:00
Tom Cherry 5d7b55bc69 init: add extra std::move
This is meant to be copy-and-move, but I forgot the move.

Test: build
Change-Id: I755ad0d99624dc0ae419ad9ed3ae6d0e017b27c5
2017-10-18 14:52:33 -07:00
Tom Cherry fa3e52c64a init: wait_for_prop shouldn't run in a subcontext
wait_for_prop sets a flag that prevents the action queue from
continuing while otherwise allowing init's main loop to continue
executing.  This cannot be done from a subcontext, so it's moved to
normal init.

All property functions need work in any case, particularly once
property_service is moved out of init.

Bug: 62875318
Test: boot sailfish and see that the previous failure related to this
      is fixed

Change-Id: Ib9e0d0bdbd0ff22ab0e5c3fe6db620700af266c6
2017-10-18 14:42:27 -07:00
Tom Cherry 486dc4a497 Merge "Only allow UTF8 encoded property values" am: 4ff2607ef7 am: 9c767212eb
am: fccffc8645

Change-Id: I0957c2c71a4deb72a0e41db971a416369c9d03b4
2017-10-17 16:20:58 +00:00
Tom Cherry 9c767212eb Merge "Only allow UTF8 encoded property values"
am: 4ff2607ef7

Change-Id: Ib83ef796bfaaa30dfda36937dfe6be4dac878346
2017-10-17 16:17:21 +00:00
Tom Cherry 8702dcb992 Only allow UTF8 encoded property values
Java already restricts properties to only UTF8 valid strings, and
this change makes this restriction also apply to all native code.

Bug: 63177684
Test: new unit tests
Change-Id: I9fa0ecc0da066b0a026db3497c0f0cbf3f5c2d5a
2017-10-16 22:35:33 +00:00
Tom Cherry ea696c71bc Merge "Allow setting read-only properties with value length > 92 characters" am: 96e8042e41 am: 5d40a3372f
am: 854dfedc90

Change-Id: I1bc483ec7cc96afe3a607965a051dd1d6af693fd
2017-10-12 16:23:27 +00:00
Tom Cherry 5d40a3372f Merge "Allow setting read-only properties with value length > 92 characters"
am: 96e8042e41

Change-Id: I538a1e415f4a80df29ba7129af479c061948d36f
2017-10-12 16:19:15 +00:00
Tom Cherry 1cf8d699a4 Allow setting read-only properties with value length > 92 characters
Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: Ie196c1fdacc0489508c633e98fe9f4ad7a27dc6e
2017-10-12 02:52:28 +00:00
Mark Salyzyn c0edd4a633 Merge "init+bootstat: reduce last reboot reason to canonical alias" am: 613a5a97e0 am: cfed5e795a
am: 75374ba1d2

Change-Id: I2de7cd7c894a7c26a59221aa20efc1f7226cebeb
2017-10-10 19:40:53 +00:00
Mark Salyzyn cfed5e795a Merge "init+bootstat: reduce last reboot reason to canonical alias"
am: 613a5a97e0

Change-Id: I3217fe94b0b3637521ef3a9f455124155001dd0d
2017-10-10 19:26:14 +00:00
Mark Salyzyn 6290982ee3 init+bootstat: reduce last reboot reason to canonical alias
To make parsing easier for last reboot reason.  This also ensures that
last boot reason matches the content that is typically returned by the
bootloader or in turn landed in the canonical system boot reason.

Simplify parsing in bootstat.  Adjust and fix boot_reason_test.sh for
new reality.  Allow boot reason tests battery and kernel_panic to pass
if device does not support pstore (empty before and after the test).
If device somehow landed in fastboot mode while waiting for the
display, issue a fastboot reboot to move the test along.  Some cleanup
and standardization changes to the test script.

Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I97d5467c0b4a6d65df3525f1a2d0051db813d5ad
2017-10-10 09:37:59 -07:00
Jeffrey Vander Stoep e04a7757ac Merge "Allow redeclaring typeattributes" am: f8bc6cee3f am: ceb5dea905
am: b7559e571b

Change-Id: I093f8be7b4f8c810d4ffefab5461687bdc883ac7
2017-10-08 04:18:13 +00:00
Jeffrey Vander Stoep ceb5dea905 Merge "Allow redeclaring typeattributes"
am: f8bc6cee3f

Change-Id: I119e687a3aaf397ac38365728f6bf9e7c24c1067
2017-10-08 04:08:45 +00:00
Jeffrey Vander Stoep f8bc6cee3f Merge "Allow redeclaring typeattributes" 2017-10-08 04:02:55 +00:00
Jeff Vander Stoep 5e9ba3c50b Allow redeclaring typeattributes
Allows partners to add a new attribute definition to their public
policy without causing a compatibility failure with the AOSP system
image.

Bug: 67092827
Bug: 37915794
Test: build and boot aosp_sailfish with a new type declared in public
    policy.

Change-Id: I3899065affb6806ae9080e1a7dfa5a6f368370f0
2017-10-06 17:04:28 -07:00
Tom Cherry 3bcda2413c Merge "init: use ro.init.subcontexts_enabled to enable subcontexts" am: 99016bce92 am: 2f5b8bb3f0
am: 16d1488614

Change-Id: I7afef0bf95ca413593e6bf36f07432af3fa41614
2017-10-06 20:43:37 +00:00
Tom Cherry 2f5b8bb3f0 Merge "init: use ro.init.subcontexts_enabled to enable subcontexts"
am: 99016bce92

Change-Id: If410f650dd67577957d653ecd0b1a1e5a45dd14a
2017-10-06 20:27:05 +00:00