Commit graph

4236 commits

Author SHA1 Message Date
Justin Yun
8ce23dc44e Rename functions in libvendorsupport
Follow platform naming conventions for an LLNDK library.

Bug: 325093550
Test: atest libvendorsupport-tests
Change-Id: Id93f7e66a47ae9250191f9827a76ce819e8f6f88
2024-02-16 23:53:04 +09:00
Jooyung Han
39e8be43eb Add check_builtins to libinit_host
This requires a bit of refactoring: moving things around.

libinit_host is used by host_apex_verifier which needs check_builtins as
well.

Bug: 325565247
Test: atest host-apex-verifier
Test: m out/target/product/vsoc_x86_64/host_init_verifier_output.txt
Change-Id: Ifed54dd2149afbab2bf63f7e42c410c2354895fc
2024-02-16 17:36:12 +09:00
Treehugger Robot
b422458e2d Merge "first_stage_console: Address compiler warning" into main am: 619042f207
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2959286

Change-Id: Id019cffe424167ff16eb939a63d8823d215e0583
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 16:18:47 +00:00
Pierre-Clément Tosi
914ccc5664 first_stage_console: Address compiler warning
Re-order the fields in the declaration to address the following

  ISO C++ requires field designators to be specified in declaration order;
  field 'sigaction::(anonymous union at bionic/libc/include/bits/signal_types.h:76:20)'
  will be initialized after field 'sa_flags' [-Wreorder-init-list]

Test: TH
Change-Id: I3f1d4739f1677aad50d4f07361aa264da43bdd13
2024-02-12 18:57:16 +00:00
Jiyong Park
ac6907b466 Merge "Drop CtsInitTestCases from cts" into main am: 0edd5b860a
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2935210

Change-Id: I3c5f869e67c32498c57e99ccdb1784b8036ccde9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-31 01:31:31 +00:00
Jiyong Park
0edd5b860a Merge "Drop CtsInitTestCases from cts" into main 2024-01-31 00:58:50 +00:00
Xin Li
7f41fd4852 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I856c812d22363cc1d1e8aa88706d4d3b89044f52
Change-Id: I9ef2aa7496bbf81f7f0da6b0ea46dc2157ad91f1
2024-01-29 21:19:57 -08:00
Jiyong Park
75070b37e2 Drop CtsInitTestCases from cts
The test is not eligible for CTS. Reasons:

1. The init behavior does not directly affect app compat. App interact
   with init only for the property service and that part is covered by
the Bionic test already.

2. This test doesn't run against the init binary installed on the
   device. libinit where most of the init functionalities are
implemented is statically linked to this test binary. In other words,
this test is closer to a unit test for init.

3. This test is not compatible with Trunk stable where test and DUT are
   built in different branches. The test depends on several (private)
libraries like libbase and libutils. Since the interfaces of the
libraries may have changed in the main branch, the test binary built
from the old test-dev branch may break.

This change does not remove the test. The test will still run as a unit
test during pre/post submit.

I didn't drop the `Cts` prefix from the name, because that requires
broader changes.

Bug: 320800872
Test: N/A
Change-Id: I1402c08b79b57ad6daa7948fe37f14fbbe36f1d6
2024-01-30 10:24:10 +09:00
Justin Yun
6bc1bfe160 Use libvendorsupport for vendor api level calculation
Remove temporary 'vendor_api_level_of' function from init and replace
the function with the same in libvendorsupport.

Bug: 312403948
Test: getprop ro.vendor.api_level
Change-Id: I095353e602397220571e131431e7cbd1b8511fa6
Merged-In: I095353e602397220571e131431e7cbd1b8511fa6
2024-01-10 14:06:43 +09:00
Eric Biggers
9e30bf5e14 Merge "init: remove session keyring workaround for old kernels" into main 2024-01-04 18:21:23 +00:00
Greg Kaiser
4c4742f678 Revert^2 "Small fix: Use const value on IsHashreeDisabled"
This reverts commit ec3ef81fd9.

Reason for revert: b/317470107 is an infrastructure error

Change-Id: If5a022cbfd016d9c55261c67a1a73d81cb336343
2023-12-22 20:03:05 +00:00
Oleg Petšjonkin
ec3ef81fd9 Revert "Small fix: Use const value on IsHashreeDisabled"
This reverts commit f5d8773169.

Reason for revert: Identified as culprit for broken tests: b/317470107

Change-Id: If599c688bb4bbe800270881451fa5ac1f6898aff
2023-12-22 10:17:25 +00:00
Seungjae Yoo
f5d8773169 Small fix: Use const value on IsHashreeDisabled
Bug: N/A
Test: Presubmit
Change-Id: I2167ac6d022c2c8c96febf2fc82eb3bba6fb6541
2023-12-22 10:11:55 +09:00
Seungjae Yoo
66dc7b7b99 Support dm-verity with verification based on root digest
Currently the only ways to enable dm-verity were relying on its built-in
vbmeta image or containing its public key on standalone vbmeta image.
Merging this change will support enabling dm-verity based on hashtree
descriptor root digest for standalone vbmeta image.

Bug: 285855436
Test: Presubmit
Test: adb shell /apex/com.android.virt/bin/vm run-microdroid --vendor /vendor/etc/avf/microdroid/microdroid_vendor.img
Change-Id: I51eb64cae2ca8b4e97f1c6419b35d45e6f51cacb
2023-12-20 10:41:44 +09:00
Kelvin Zhang
cb3cfc1655 Optimize PrepareSnapshotPartitionsForUpdate runtime
During PrepareSnapshotPartitionsForUpdate, we attempt to connect to
snapuserd with a 5s timeout, only to tell snapuserd to shutdown
immediately. If snapuserd isn't running, we will wait-out the whole 5
seconds. Change the logic to return early if socket_connect() calls
return ENOENT, indicating that snapuserd socket isn't used by any
process. This reduces allocateSpaceForPayload() time from 6s to 1s.

Test: th
Bug: 315215541
Change-Id: Ib24d7c63733a896c082ac92aaa88ad52d050a2a5
2023-12-12 13:36:34 -08:00
Treehugger Robot
e347211353 Merge "Revert "Revert "Calculate ro.vendor.api_level with the new vendo..."" into main am: 053e75b946 am: f587bda852 am: add88a5cb8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2862614

Change-Id: Idccd83a62f408c3485fb140faff36cf4464f64c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 18:06:13 +00:00
Treehugger Robot
053e75b946 Merge "Revert "Revert "Calculate ro.vendor.api_level with the new vendo..."" into main 2023-12-08 16:24:15 +00:00
Justin Yun
29192395bc Revert "Revert "Calculate ro.vendor.api_level with the new vendo..."
Revert submission 2863786-trunk_vendor_api_level

Reason for revert: Reland the ro.vendor.api_level update

Reverted changes: /q/submissionid:2863786-trunk_vendor_api_level

Change-Id: I1f380e04f673eb4570e598a6e2013fce6e69213e
2023-12-07 22:22:53 +00:00
Massimo Carli
40bb6f8f7e Merge "Revert "Calculate ro.vendor.api_level with the new vendor API format"" into main am: 367d732f3c am: 7a4c47e3ac am: 6451103c4e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2863786

Change-Id: Ic854525e904d4cd5db5539dd9c388d1c075ade90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07 13:05:54 +00:00
Massimo Carli
367d732f3c Merge "Revert "Calculate ro.vendor.api_level with the new vendor API format"" into main 2023-12-07 11:22:17 +00:00
Massimo Carli
08534b8d0b Revert "Calculate ro.vendor.api_level with the new vendor API format"
This reverts commit e267e31d73.

Reason for revert: b/315246126

Change-Id: I456858c6f4c528158c0826efcdc1509b701c32f7
2023-12-07 09:19:24 +00:00
Justin Yun
4af401079e Merge "Calculate ro.vendor.api_level with the new vendor API format" into main am: 698c6f9035 am: dfeb7be11f am: d454b501cb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2839486

Change-Id: I0e5b20a1134e0d66d973bf0503baea5d51526547
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07 05:34:14 +00:00
Justin Yun
698c6f9035 Merge "Calculate ro.vendor.api_level with the new vendor API format" into main 2023-12-07 03:54:45 +00:00
Bart Van Assche
303252a2c9 Merge "service_test: Only run the ServiceStopTest as root" into main am: a34c125cad am: 7fc41b6c2b am: 9863de3df8
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2854013

Change-Id: I20cb349342c82401103f83208d8fa1b21270fe1a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-01 04:07:16 +00:00
Bart Van Assche
fb3e64ab42 service_test: Only run the ServiceStopTest as root
Despite 'require_root: true' in Android.bp for CtsInitTestCases, it can
happen that this test is run without root privileges. If that happens,
skip the ServiceStopTest.

Bug: 313551148
Change-Id: I45f29369915a1f61e08ffd9bf5601a83a147597c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-30 10:00:43 -08:00
Treehugger Robot
c5c73dde2b Merge "service_test: Test stopping services after migration to another cgroup" into main am: 0ca4e8f4b4 am: d891ecae9c am: f99f1cdc33
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2832973

Change-Id: I1a32d1c868f4f71cb0e4aef9a2065b64fa9efab7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-28 01:27:02 +00:00
Eric Biggers
5d7c35ce20 init: remove session keyring workaround for old kernels
The android-4.14-stable and later kernels support the
FS_IOC_ADD_ENCRYPTION_KEY and FS_IOC_REMOVE_ENCRYPTION_KEY ioctls.  This
has superseded the old way of adding fscrypt keys to the kernel, which
was to use the add_key() syscall to add keys to the "session" keyring.
On kernels that support the ioctls, Android doesn't use the obsolete
way.  Since upgrading even just to Android 14 requires at minimum a
android-4.14-stable kernel (according to
https://source.android.com/docs/core/architecture/kernel/android-common#compatibility-matrix),
there is no need to support the obsolete way anymore.

Therefore, this commit removes the code from init that created a keyring
named "fscrypt" in the session keyring.  It also removes the code that
created the session keyring itself, since the only reason that Android
even created a session keyring was just to hold the "fscrypt" keyring.

Flag: N/A for the following reasons:
      - Removing obsolete code, which is fairly safe
      - Very early code, so runtime flag cannot be used
      - Even a build-time flag cannot be used, since init needs
        recovery_available, which aconfig libraries do not support

Bug: 311736104
Test: Build and boot Cuttlefish
Change-Id: Id9a184c68cf16d5c4b1d889444cf637c95a91413
2023-11-27 23:43:49 +00:00
Bart Van Assche
86a2ae28e6 service_test: Test stopping services after migration to another cgroup
The root cause of "After OTA, device is not responding" is that
Service::Stop() did not stop services that had been migrated to another
v2 cgroup. Add a unit test for that scenario.

Bug: 308900853
Change-Id: I590fde90e31326290c2c8ce8fce51e94b215a979
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-27 14:27:02 -08:00
Treehugger Robot
742c255c39 Merge "init: Fix signalfd support in WaitToBeReaped()" into main am: dfe6c802d0 am: 7aa325791f am: fe36333f7e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2834997

Change-Id: I81a89d4ae603ad942c8858af238583cfbe744d15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-22 19:45:02 +00:00
Bart Van Assche
1daf88d6ce init: Fix signalfd support in WaitToBeReaped()
Add an Epoll::Open() call such that the Epoll::Wait() calls wait for the
signalfd. Rename DiscardSiginfo() into HandleSignal(). Handle Epoll method
call failures. Test whether alive_pids is empty once per loop iteration.

Test: CtsInitTestCases:ServiceStopTest
Change-Id: I16c27aa74d61f889b304f3e59cd3c5255c299ce1
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-22 09:06:02 -08:00
Treehugger Robot
b33c258084 Merge "init: Introduce the function ReapAndRemove()" into main am: c93c5eff0e am: b0e5d6405e am: 0ae7962866
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2838464

Change-Id: I3ef25bac13a2aae73b94f887447752db292a6f47
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-22 04:27:42 +00:00
Treehugger Robot
c93c5eff0e Merge "init: Introduce the function ReapAndRemove()" into main 2023-11-22 02:52:44 +00:00
Bart Van Assche
9c6b723adb init: Introduce the function ReapAndRemove()
Prepare for adding a second caller of ReapAndRemove().

Change-Id: I0f54af6136f49caa0198c123a4c8de968e5f41ba
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-21 09:16:50 -08:00
Justin Yun
e267e31d73 Calculate ro.vendor.api_level with the new vendor API format
In Android V, ro.vendor.api_level read ro.board.api_level only if
ro.board.first_api_level is defined. The format of the vendor api
level is YYYYMM.
Update the ro.vendor.api_level initialize funtion with this change.

As ro.product.first_api_level follows the version from the SDK, a
new function `vendor_api_level_of` translates the SDK version to the
vendor API level.

Bug: 312403948
Test: getprop ro.vendor.api_level
Change-Id: I2961ed9a6de8e9156f72c1bbfeabcac9c35f08fb
2023-11-21 19:54:47 +09:00
Treehugger Robot
0c30461764 Merge "Use vendor/etc/ueventd.rc on microdroid" into main am: 2e2e836a89 am: 4774ceef11 am: 8e123f72d4
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2836366

Change-Id: I52b9b2bb3e1330062971c3c0bf324becc82a8d09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 03:47:54 +00:00
Inseob Kim
52d8fe9b04 Use vendor/etc/ueventd.rc on microdroid
... because vendors should be able to extend ueventd.rc for their own
devices (in microdroid) and microdroid's system.img can't be amended.

Bug: N/A
Test: boot microdroid
Change-Id: I7ceaf3f87453c8e29f9d9bf03d4d1866185d4fec
2023-11-21 10:05:49 +09:00
Treehugger Robot
c167d19bec Merge "init: Combine two global sigchld_fd variables into one" into main am: 142f8129ec am: ba8817789b am: 9875d68032
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2834996

Change-Id: Ia53cee805c362db366ba87961732d84b6a6ed85e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 20:20:01 +00:00
Bart Van Assche
97047b54e9 init: Combine two global sigchld_fd variables into one
Remove the Service::SetSigchldFd() method. Make the Service::GetSigchldFd()
create a signalfd for SIGCHLD. This makes it possible to use a SIGCHLD
signalfd in unit tests.

Change-Id: I0b41caa8f46c79f4d400e49aaba5227fad53c251
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-20 09:32:59 -08:00
Kalesh Singh
f965e4f28f Merge "x86_64: mmap rnd bits: Allow min bits of less than 32" into main am: 72d8882153 am: 6585b0f0fa am: 073ca81f54
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2825759

Change-Id: I4f4c4a76de17e1a29f87535f761df237145dd76b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 23:02:37 +00:00
Kalesh Singh
72d8882153 Merge "x86_64: mmap rnd bits: Allow min bits of less than 32" into main 2023-11-17 21:23:26 +00:00
Kalesh Singh
24a47eccf7 x86_64: mmap rnd bits: Allow min bits of less than 32
With a regular x86 kernel we are always able to get 32
min bits for mmap randomization.

However to emulate 16KB for x86 app developers the kernel
can only provide 30 bits for the randomization due the to
larger page size (PAGE_SHIFT =+ 2).

Allow the min rand bits to be (32 - (PAGE_SHIFT - 12)) in
order to generically support larger than 4KB page sizes.

This should be a no-op change for all devices, except the
x86 16KB emulator, since they will always be able to get
32 random bits.

Bug: 309816695
Test: Boot test 4k x86 device
Test: Boot test emulated 16k x86 device
Change-Id: I48d47d56ac3aecb71a9e0093a7033bb60b89c2b7
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-11-17 11:02:04 -08:00
Treehugger Robot
eae868270f Merge "Attempt process kill even if cgroup is already removed" into main am: b37d7cbef8 am: d5462260cd am: 7998ae5d16
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2828279

Change-Id: I2673eee85531760970192fe6565282db3769cea0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 22:06:21 +00:00
Kelvin Zhang
109932146d Attempt process kill even if cgroup is already removed
Test: th
Bug: 308900853
Change-Id: I21ae5bacf4a25cc06a1fd47e2aadbf5ae22661a7
2023-11-14 11:13:28 -08:00
Akilesh Kailash
d93306f54a Merge "init: Start snapuserd_proxy after early-init" into main am: 14270410cf am: 37b50e3ff0 am: 3d2749cb25
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2820943

Change-Id: I2fd842305a0bdfb0833d267da561e14fe1ba944a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 22:12:49 +00:00
Akilesh Kailash
76b553c93b init: Start snapuserd_proxy after early-init
When service is started prior to early init and if per-app memcg is enabled, service start will fail as the required directories for memcg isn't present viz /dev/memcg/apps.

Bug: 308818430
Test: th and CF OTA test with per-app memcg enabled
Change-Id: Ic65e8d179fbfb8e2135f2de5cc7c77d6c29ea7d2
Signed-off-by: Akilesh Kailash <akailash@google.com>
2023-11-08 15:07:57 +00:00
Treehugger Robot
48986a1706 Merge changes I5e259fdd,I5b9ab456 into main am: 7d1f582d36 am: a621f52726 am: 33d6182768
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2818001

Change-Id: I5d954f7f7f4921d26dca18419e34cb47e633a992
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 03:33:10 +00:00
Treehugger Robot
7d1f582d36 Merge changes I5e259fdd,I5b9ab456 into main
* changes:
  init: Make WaitToBeReaped() wait less long
  init: Create different file descriptors for SIGCHLD and SIGTERM
2023-11-08 01:35:58 +00:00
Bart Van Assche
a75f210398 init: Make WaitToBeReaped() wait less long
Reduce the time spent in WaitToBeReaped() by waiting for SIGCHLD instead
of waiting for 50 ms.

Bug: 308687042
Change-Id: I5e259fdd22dec68e45d27205def2fc6463c06ca3
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-07 10:52:26 -08:00
T.J. Mercier
245a143aa9 Merge "libprocessgroup: Remove max_processes from KillProcessGroup API" into main am: ef9e7f8572 am: a5c6b198ae am: 205d562a33
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2808374

Change-Id: I10d90265ac36c65026e8448ba3a341e566b16b32
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-06 23:22:10 +00:00
T.J. Mercier
ef9e7f8572 Merge "libprocessgroup: Remove max_processes from KillProcessGroup API" into main 2023-11-06 21:43:59 +00:00
Bart Van Assche
43323a7e7a init: Create different file descriptors for SIGCHLD and SIGTERM
This change will allow a later CL to wait for SIGCHLD without discarding
the SIGTERM information.

Bug: 308687042
Change-Id: I5b9ab4562060455573cd816cc48bf90576b39ab9
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-06 10:38:20 -08:00
Treehugger Robot
7769988c57 Merge "Update fmtlib to 10.1.1" into main am: 6c7dca816f am: 52ec54ddff am: d165e2fdf2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2814593

Change-Id: Idcd213bec5a03035f56e87f0398732d4133bd62b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-05 05:32:31 +00:00
Treehugger Robot
6c7dca816f Merge "Update fmtlib to 10.1.1" into main 2023-11-05 03:36:11 +00:00
Bart Van Assche
d0865268be Merge changes I3c882c36,I930c668d,I29e2d51d into main am: 63d52783de am: 508d886382 am: f2ff46a799
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2815845

Change-Id: I9583ca62dc7ba58ecbb8b7f6153f41ea9bd113e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-03 02:16:05 +00:00
Bart Van Assche
63d52783de Merge changes I3c882c36,I930c668d,I29e2d51d into main
* changes:
  init: Fix a bug in the WaitToBeReaped() logging code
  init/host_init_verifier: Fix a compiler warning
  init: Fix a compiler warning
2023-11-03 00:55:57 +00:00
Bart Van Assche
7ce6453aa8 init: Fix a bug in the WaitToBeReaped() logging code
Only report status information for the processes that are still running.
Additionally, make the logging output look better by starting the
process information from /proc start on a new line.

Fixes: ea595ba2a0 ("init: Log more information if stopping times out")
Change-Id: I3c882c364f11278087a78efb7a8e8fee8e582417
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-02 13:06:23 -07:00
Bart Van Assche
4844092066 init/host_init_verifier: Fix a compiler warning
Fix the following compiler warning:

//system/core/init:host_init_verifier clang++ host_init_verifier.cp
system/core/init/host_init_verifier.cpp:112:9: warning: ISO C++ requires field designators to be specified in declaration order; field 'pw_shell' will be initialized after field 'pw_uid' [-Wreorder-init-list]
        .pw_uid = 0,
        ^~~~~~~~~~~
system/core/init/host_init_verifier.cpp:111:21: note: previous initialization for field 'pw_shell' is here
        .pw_shell = static_shell,
                    ^~~~~~~~~~~~

Change-Id: I930c668d7fb1d12ebe9307b1549776da71a9a95a
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-02 13:06:23 -07:00
Bart Van Assche
ac8b5bd0bc init: Fix a compiler warning
Fix the following compiler warning:

system/core/init/init.cpp:754:57: warning: ISO C++ requires field designators to be specified in declaration order; field '' will be initialized after field 'sa_flags' [-Wreorder-init-list]
    const struct sigaction act { .sa_handler = SIG_DFL, .sa_flags = SA_NOCLDSTOP };
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~
system/core/init/init.cpp:754:34: note: previous initialization for field '' is here
    const struct sigaction act { .sa_handler = SIG_DFL, .sa_flags = SA_NOCLDSTOP };
                                 ^~~~~~~~~~~~~~~~~~~~~

Change-Id: I29e2d51dfdff85212a33eebfd51b241268cdfe9a
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-11-02 13:06:22 -07:00
Dennis Shen
5f74c0f29a Merge "Move staging value application logic to persistent_properties and add unit tests" into main am: fa21f12e3b am: 2854ab55d0 am: 55095392ab
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2801973

Change-Id: Ic6cdb7cfd2bdecf087ede0d6bc2dd235707aca3e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 19:32:31 +00:00
Dennis Shen
fa21f12e3b Merge "Move staging value application logic to persistent_properties and add unit tests" into main 2023-11-02 17:00:44 +00:00
Dennis Shen
79283ef377 Move staging value application logic to persistent_properties and add
unit tests

1, Previous implementation has the staged prop application done in
property_service, which caused a number of unnecessary changes which
including exposing apis like AddPersistentProperty. In addition, it made
the property_service logic complicated. A better design is to have the
staged value application done while reading the persistent properties
from file. This way, no change to property service. In addition, unit
test is much cleaner and efficient.

2, add a unit test to lock down the behavior. Specifically, it locks down that when a prop is staged, it should be applied the next time when the persistent prop is loaded. In addition, it should lock down that other persistent props are not overwritten.

Bug: b/307752841, b/300111812, b/306062513

Change-Id: I43c603efbb803195065dda3f0bc2145716302bbc
2023-11-02 14:17:33 +00:00
Henri Chataing
6bdb5f86cd Update fmtlib to 10.1.1
Test: m
Change-Id: I1f23ea1a07c792c3b4974414aef9aeb9ae8f11d7
2023-11-01 17:25:37 +00:00
T.J. Mercier
599d979126 libprocessgroup: Remove max_processes from KillProcessGroup API
The max_processes calculation is incorrect for KillProcessGroup because
the set of processes in cgroup.procs can differ between the multiple
reads in the implementation. Luckily the exact value isn't very
important because it's just logged. Remove max_processes from the API
and remove the warning about the new behavior in Android 11.

Note that we still always LOG(INFO) that any cgroup is being killed.

Bug: 301871933
Change-Id: I8e449f5089d4a48dbc1797b6d979539e87026f43
2023-10-31 16:31:44 +00:00
Treehugger Robot
1f5e877185 Merge "Initialize the appcompat system property folder" into main 2023-10-31 02:29:56 +00:00
Treehugger Robot
3f1aea5092 Merge "Don't overwrite persistent property files" into main am: 68fbe13281 am: c5dec993c8 am: d21e11b030
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2796061

Change-Id: I67083e4c0900b65402765308d21c1319e03d8176
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 18:12:16 +00:00
Jiyong Park
c7230a1eb1 Don't overwrite persistent property files
This fixes a bug introduced by I81b6bd984aad8f7ddec93ce74f4543e4f71be508

In the original CL, setting a sysprop `next_boot.<name>` and then
rebooting the device could remove all the persistent properties stored
in /data/property/persistent_properties. It happened because the
function `WritePersistentProperty` is called with a properties set which
is initialized as an empty set and then added with the properties which
had the next_boot prefix.

As a result...

Before the boot:
* persist.a = 1
* next_boot.b = 2
* next_boot.persist.c = 3

After the reboot:
* b = 2
* persist.c = 3

persist.a gets lost.

This change fixes the issue by populating properties set from the memory
and then save it to the file.

Bug: 306062513
Bug: 300111812
Test: do the following.
$ adb root
$ adb shell setprop persist.a 1
$ adb shell setprop next_boot.b 1
$ adb shell setprop next_boot.persist.c 1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
1
$ adb shell getprop persist.c
1

$ adb reboot
$ adb shell getprop persist.a
1    // was (none) before this change
$ adb shell getprop b
     // (none) because b isn't persisted. WAI.
$ adb shell getprop persist.c
1

Change-Id: I85d3777f9b32523b010e49b8ca53f4319dd2ce05
2023-10-20 21:20:50 +09:00
Thiébaud Weksteen
830fc3018a Merge "Remove write to /sys/fs/selinux/checkreqprot" into main am: 3ef4da2f6a am: ab696e910a am: ba38e62894
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2795756

Change-Id: Id239991de861a5529ad916cb73899e93698c3f01
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 04:48:46 +00:00
Nate Myren
c25abe4739 Initialize the appcompat system property folder
Certain applications may have their system properties overlaid with the
contents overlaid for appcompat purposes. Init must initialize the
appcompat folder, same as it does the standard folder.

Bug: 291814949
Test: manual
Change-Id: I6d239e0a10a1c81a05d4121e5fc2c41da5b3dbc4
Merged-In: I0c6a0f66dc543c6e861bc86a417e4feb5ecd7789
2023-10-19 20:17:55 +00:00
Nate Myren
428a53798b Merge "Initialize the appcompat system property folder" into main 2023-10-19 19:29:59 +00:00
Thiébaud Weksteen
b010393fe5 Remove write to /sys/fs/selinux/checkreqprot
This SELinux option has been deprecated in the kernel since v5.7. In
v6.4, commit a7e4676e made any write to this file a no-op.

Since v4.4, the default value of 0 is set by the kernel. Skip the
setting of this value since we only support kernel >= 4.14.

Test: presubmit
Change-Id: Ied5945532e10b156dc0d9996b2a41a99d04e750b
2023-10-19 11:39:42 +11:00
Elliott Hughes
f74f3a4620 Merge "init: don't use magic numbers for RLIMIT_ constants." into main am: 3aee719660 am: ba43615d77 am: 6c2caea559
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2791561

Change-Id: If9c04743c8dc98b1e5905a97111a2fb5f5ce3e4d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-17 17:43:54 +00:00
Elliott Hughes
3aee719660 Merge "init: don't use magic numbers for RLIMIT_ constants." into main 2023-10-17 15:34:56 +00:00
Elliott Hughes
7a19bf8e0d init: don't use magic numbers for RLIMIT_ constants.
Also, why are we accepting the completely made-up "RLIM_AS" but not the
real "RLIMIT_AS" in .rc files?

Bug: http://b/293894041
Test: treehugger
Change-Id: I18b10b6dd77265a9a14b88bfdf1cc0b474800a94
2023-10-16 22:29:47 +00:00
Nate Myren
5ae7a8053a Initialize the appcompat system property folder
Certain applications may have their system properties overlaid with the
contents overlaid for appcompat purposes. Init must initialize the
appcompat folder, same as it does the standard folder.

Bug: 291814949
Ignore-AOSP-First: must be merged with ag/24558703, which has an   Aosp -> internal merge conflict
Test: manual

Change-Id: I0c6a0f66dc543c6e861bc86a417e4feb5ecd7789
2023-10-16 17:06:16 +00:00
Dennis Shen
f307ee0767 Merge "apply staged property value when loading persistent props" into main 2023-10-13 18:22:56 +00:00
Dennis Shen
40995c90fc Merge "apply staged property value when loading persistent props" into main 2023-10-13 16:27:48 +00:00
Dennis Shen
ecf8e1cf2f apply staged property value when loading persistent props
Bug: b/300111812
Change-Id: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
Ignore-AOSP-First: see cherry pick to aosp/2781147
2023-10-13 13:22:40 +00:00
Dennis Shen
678d268848 apply staged property value when loading persistent props
Bug: b/300111812
Change-Id: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
Merged-In: I81b6bd984aad8f7ddec93ce74f4543e4f71be508
2023-10-13 13:18:50 +00:00
Yi-Yo Chiang
ed95fe0854 Merge "Revert "init_first_stage: Disable ThinLTO"" into main am: c519d1dde2 am: a9d7576a2e am: 568326b5da am: 1be41edb47 am: a89c105f5e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2783807

Change-Id: Ifaa3031358a8996539cc5b3550f7c76a806d0732
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 13:20:03 +00:00
Yi-Yo Chiang
c519d1dde2 Merge "Revert "init_first_stage: Disable ThinLTO"" into main 2023-10-12 10:33:54 +00:00
Yi-Yo Chiang
1a3dd7eb4b Revert "init_first_stage: Disable ThinLTO"
This reverts commit 4d6fa8ccaf.

Reason for revert: b/295944813 is fixed

Bug: 304290959
Change-Id: I2d6f5216800d6ee26b25623898836dc216c8be18
Test: adb-remount-test.sh
2023-10-11 02:06:26 +00:00
Treehugger Robot
810b3f9e80 Merge "init: Remove arbitrary delay in async persist writes." into main am: 1258dabac7 am: 4ba12afcd5 am: de52214f54 am: d5d429062b am: 234de3df8d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2777581

Change-Id: I0ee69d93d583b12f1876873bf35af94d6876e940
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 04:45:56 +00:00
David Anderson
d8a9a0c81c init: Remove arbitrary delay in async persist writes.
Bug: 297093092
Test: manual test
Change-Id: Ia80b33d2fe87aa5da64b4f156fefeb474e68dc93
2023-10-06 14:52:08 -07:00
Elliott Hughes
6ad1a49b3c Merge "Remove obsolete <linux/capabilities.h> workarounds." into main am: b0bff22429 am: fd605f23d1 am: e8c6297e96 am: 7b986c5477 am: 2cdc3fdecc
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2770138

Change-Id: Ic08a70b2f5f30ab6433da52ad03c33765775363b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-02 21:18:45 +00:00
Elliott Hughes
7d46c3fd7a Remove obsolete <linux/capabilities.h> workarounds.
We've updated the glibc header (and musl will just use the bionic uapi
headers), so this is obsolete (and getting in the way of someone trying
to use the PERFMON capability).

Test: treehugger
Change-Id: Ife7ee076179e1db6246738aa41c2b82bd8546265
2023-09-29 22:45:59 +00:00
Treehugger Robot
cad272e1e4 Merge "Only skip _16k/_64k kernel modules dirs on 4K builds" into main am: 73fcd754ee am: 6b38c7ed6f am: fe743c5704 am: da860a02ed am: 38e5d473bb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2758048

Change-Id: I6b0bb74bf7f15a2cd1c5872076eaa292150373ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-23 02:18:57 +00:00
Treehugger Robot
73fcd754ee Merge "Only skip _16k/_64k kernel modules dirs on 4K builds" into main 2023-09-22 21:55:11 +00:00
Kelvin Zhang
b4987345ff Only skip _16k/_64k kernel modules dirs on 4K builds
The initramfs.img from kernel builds do not store kernel modules under
_16k directory. Currently, init is programmed to only load kernel
modules from _16k dir if running on 16K page size kernel. Relax this
restriction so that booting on custom 16K kernel would work without
going through platform rebuild.

Test: th
Bug: 293313353
Bug: 300184677

Change-Id: I9ee3c74066ad9ec5127f1e8662f7c1273445994c
2023-09-22 09:14:43 -07:00
Treehugger Robot
b9f8824754 Merge "Delete unused DATA_MNT_POINT macro" into main am: 9c562cf82b am: 5e32ce2d28 am: afc3f8e7e4 am: 0fe1b3c518 am: fcee2ca617
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2759565

Change-Id: If01bfb413445ff68ec624edd740f4a88b69d527c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-21 22:18:51 +00:00
Treehugger Robot
9c562cf82b Merge "Delete unused DATA_MNT_POINT macro" into main 2023-09-21 17:33:28 +00:00
Andrew Scull
f06e218e82 Delete unused DATA_MNT_POINT macro
The macros isn't used anywhere but was a distraction when tracking down
/data mounting behaviour.

Test: build
Change-Id: Ie23574326cbebd7f515c8409e1dcb91a00cafc6f
2023-09-21 14:50:55 +00:00
Elliott Hughes
f5d2953bab Merge "arm64: update the "minimum maximum" comment." into main am: cc8d909ccb am: be175c3af6 am: 272351cefd am: af6f413068 am: d4b2240eca
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2755786

Change-Id: Ie3038bddb055f9ea05595c5732d1ac888060863d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-20 20:21:36 +00:00
Elliott Hughes
cc8d909ccb Merge "arm64: update the "minimum maximum" comment." into main 2023-09-20 15:55:18 +00:00
Elliott Hughes
5c746fb2dc Merge "riscv64: minor ASLR bits changes." into main am: d741c23288 am: 2d5747438c am: a0124bab19 am: 50bed42063 am: c3b46b1699
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2755787

Change-Id: I40c7a19ba03217b40dcf012d49d64e25ea1e80bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-20 01:38:26 +00:00
Elliott Hughes
d741c23288 Merge "riscv64: minor ASLR bits changes." into main 2023-09-19 21:23:00 +00:00
Elliott Hughes
6bc53ff7dd arm64: update the "minimum maximum" comment.
Noticed while looking at riscv64. Looks like a bug, but actually nothing
we can do about it now or for the foreseeable future.

Bug: https://github.com/google/android-riscv64/issues/45
Test: treehugger
Change-Id: I2be81b2fd7095df40958a1f641d7b89cf5a8e41d
2023-09-19 20:08:41 +00:00
Elliott Hughes
b60befa806 riscv64: minor ASLR bits changes.
Improve the comment, and increase the "minimum maximum" to 24 --- we
only support 64-bit, and 64-bit never has less than 24 bits.

Bug: https://github.com/google/android-riscv64/issues/1
Test: treehugger
Change-Id: I478c7649aa19258352c908a449cabe12da94952c
2023-09-19 18:47:18 +00:00
Thiébaud Weksteen
ac132a8deb Merge "Revert "Use Apex sepolicy if it's available"" into main am: 158a26da4a am: c3493ef261 am: fa6eef546c am: 75c82239ce am: 951682de9d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2738173

Change-Id: I9974d6d574a375a570f80e99d2892db88454521f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-06 08:07:22 +00:00
Thiébaud Weksteen
50f03fd58e Revert "Use Apex sepolicy if it's available"
This reverts commit baeece6d0c.

Test: boot aosp_cf_x86_64_phone-userdebug
Bug: 297794885
Change-Id: I0515bc30eba42589c407deb587684b4da011aead
2023-09-06 10:52:49 +10:00
Thiébaud Weksteen
a2d51c9cad Merge "Remove SeamendcHostTest from TEST_MAPPING" into main am: 9fb6b49131 am: baced3df83 am: c12a550175 am: c41121c1f5 am: 72bfc28e8e
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2735076

Change-Id: I7b44c43b9cd71effa13510e448196acc5b3a0c92
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 09:43:02 +00:00