Commit graph

78576 commits

Author SHA1 Message Date
Seth Moore
8fbbf06f0c Add dependency on split out RKP HAL
Bug: 254112961
Test: vts_treble_vintf_vendor_test
Merged-In: I9dcb9b94b0e22466cd42592f4921eec3e4fcb13d
Change-Id: I9dcb9b94b0e22466cd42592f4921eec3e4fcb13d
2022-11-09 10:54:51 -08:00
Inseob Kim
cb4c7d56e8 Merge "Don't unmount APEXes in microdroid" 2022-11-09 09:57:09 +00:00
Yi-yo Chiang
2a501a11dc Merge changes from topic "merge_set-verity-state_with_remount"
* changes:
  remount: Merge 'remount' and 'set-verity-state'
  remount: Use MyLogger class and sundry improvements
2022-11-09 09:02:38 +00:00
Inseob Kim
0fbc1d7e31 Don't unmount APEXes in microdroid
In microdroid, APEXes are passed as block devices from host, and then
mounted directly, without using /data. Unmounting APEXes on reboot is
for clean unmount of /data, so it's not needed in microdroid.

This skips unmounting in microdroid to remove unnecessary SELinux
denials.

Bug: 256793087
Test: run microdroid and reboot, see no denials happen
Change-Id: Iaf737876f5ab5de5e8f76ed8bb0963cc25d73a80
2022-11-09 12:50:14 +09:00
Kelvin Zhang
3c163eca84 Merge "Store lz4 blocks as uncompressed if compression makes data larger" 2022-11-08 20:54:33 +00:00
Kelvin Zhang
b3c89fa6a0 Merge "Fsync on directory after rename() call" 2022-11-08 20:53:59 +00:00
Kelvin Zhang
0b8c4ebfa8 Store lz4 blocks as uncompressed if compression makes data larger
This will change cow size estimation. But since we haven't put lz4 on
SAC website yet, we can still change it.

Bug: 228478555
Test: th
Change-Id: Ifba7107954622ea04cbd25115700dfba50cec9c6
2022-11-08 10:17:26 -08:00
Kelvin Zhang
149fa74db5 Fsync on directory after rename() call
rename() isn't necessarily atomic, call fsync() on the directory to
ensure that changes in fs structure hit the disk.

Test: th
Bug: 254211456
Change-Id: I2de842f03766a1108e0f54581738fb964989658a
2022-11-08 10:02:12 -08:00
Kelvin Zhang
b190f3cbe1 Merge "Check for COW space before writing to COW" 2022-11-07 23:52:22 +00:00
Bart Van Assche
7b96179404 Merge "init: Rename 'cgroups_activated' into 'fifo'" 2022-11-07 17:53:27 +00:00
Yi-yo Chiang
955460e5a9 Merge "remount: prefer 'cache' backing storage for non-A/B devices" 2022-11-07 11:43:15 +00:00
Remi NGUYEN VAN
20edb70280 Merge "Add libconnectivity_native" 2022-11-07 02:07:45 +00:00
Bart Van Assche
9c61dad67e init: Rename 'cgroups_activated' into 'fifo'
Prepare for using the interprocess communication channel in two
directions.

Bug: 213617178
Change-Id: Ic78a3d8a2ec1f808fa5b4c4b198051655ee1b0ec
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-11-04 14:56:43 -07:00
Bart Van Assche
8462ceef62 Merge "Revert "init: Fix a race condition in KillProcessGroup()"" 2022-11-03 18:21:59 +00:00
Bart Van Assche
dcc378e53c Revert "init: Fix a race condition in KillProcessGroup()"
This reverts commit d8ef6f84d4.

Reason for revert: b/256874349

Change-Id: I86a1e03a0d2979db1c54abd3e78c32591fda98a1
2022-11-03 15:15:25 +00:00
Yi-Yo Chiang
e8d85b5814 remount: Merge 'remount' and 'set-verity-state'
Dedup fs_mgr_remount.cpp and set-verity-state.cpp by merging them
together and make '/system/bin/set-verity-state' a symlink to
'/system/bin/remount'.

Bug: 241688845
Test: adb-remount-test
Change-Id: I42a2344b9bdac112bf8767d428a99cb020267546
2022-11-03 22:58:43 +08:00
Treehugger Robot
5ed1bda720 Merge "Make bpf_attach_tracepoint() available as soon as possible" 2022-11-03 09:03:14 +00:00
Yi-Yo Chiang
a799a58842 remount: Use MyLogger class and sundry improvements
* Use the MyLogger class from set-verity-state.cpp and eliminate the
  |verbose| global variable.
* Support specifying reboot() reason. Log error if reboot() failed to
  reboot.
* Move precondition checks after all |argv| are processed. This way (-h)
  help message can be shown w/o root user.
* Log "remount [succeeded|failed]" message before auto-reboot. Give
  users a clear succeeded/failed message.

Bug: 241688845
Test: adb-remount-test
Change-Id: If45de2eba0d532632de43b19c797ffdeea90cd6d
2022-11-03 16:17:12 +08:00
chenyc5
7e357eb731 Make bpf_attach_tracepoint() available as soon as possible
The "sys.init.perf_lsm_hooks" is set on TestPerEventSelinux and it
is before early-init, but it need trigger by queue_property_triggers
and it is after late-init (zygote start on late-init).
The property is ready on load_bpf_programs, make sure
bpf_attach_tracepoint() is available on zygote start.

Bug: 257102190
Test: cat /sys/fs/bpf/map_time_in_state_uid_time_in_state_map
Change-Id: I5aa102df54b82e1584882800e93efd06ccf61c16
2022-11-03 10:21:45 +08:00
Christopher Ferris
9d8576d701 Merge "Modify the mmc data structure." 2022-11-03 01:20:03 +00:00
Kelvin Zhang
c903ef4517 Check for COW space before writing to COW
This gives a more detailed message when we run out of cow space.
Also, previously, it's possible that the COW op metadata writes
successfully but op data fails due to out of space, resulting in a
broken COW image. After this change, we won't write anything unless
there's sufficient space for both OP metadata and block data. This makes
COW operations more atomic and easier to debug/inspect.

Test: th
Change-Id: I6c1347e91b4ec2d7e434b47a0f47b290e288e600
2022-11-02 11:01:26 -07:00
Oleg Lyovin
c227809041 remount: prefer 'cache' backing storage for non-A/B devices
In non-A/B configurations system partitions often
have layout with not so much free space left, while having
large /cache partition.

In a dynamic partitions configuration 'remount' for backing
storage will user either:

-- /data partition, which is not guaranteed to have
enough space due to applications disk usage;

-- or super partition, which is tied to system images size
having a little room for growing.

At the same time, /cache is guaranteed to be free,
so non-A/B platform can force it to be used as
backing storage.

Test: remount
Signed-off-by: Oleg Lyovin <ovlevin@sberdevices.ru>
Change-Id: I68e621b884b2fe21a5c464b3deaf679186232eb3
2022-11-02 15:11:21 +03:00
Treehugger Robot
3b88013a8c Merge "init: Amend code format for DoLoadApex" 2022-11-02 07:48:23 +00:00
Shen Lin
63ae3fdd9d init: Amend code format for DoLoadApex
Test: m init
Change-Id: I9d873cdf067ea586f75e62ff8a39cb753151f9ec
2022-11-02 11:01:04 +08:00
Steven Moreland
b41a7e382f Merge "Adding fuzzer for trusty-confirmationui service." 2022-11-01 17:04:47 +00:00
Yi-yo Chiang
25eb51a941 Merge "fs_mgr_overlayfs: Remove backing image if failed to allocate scratch" 2022-11-01 05:46:42 +00:00
Treehugger Robot
a433501fb0 Merge "charger: update resource location" 2022-11-01 00:17:11 +00:00
Treehugger Robot
da644317e3 Merge "Clean up some unneeded non-neon support." 2022-10-31 18:51:46 +00:00
Elliott Hughes
7a30483996 Clean up some unneeded non-neon support.
It's 2022.

Test: treehugger
Change-Id: If7feede199545cf36ae4759b635a56d1421e505f
2022-10-31 15:38:01 +00:00
Yi-Yo Chiang
c82ad4fd90 fs_mgr_overlayfs: Remove backing image if failed to allocate scratch
In CreateScratchOnData(), if backing image is allocated but failed to
map, then remove the backing image. Otherwise the unusable (unmappable)
image would waste a lot of space.

Bug: 255593675
Test: On device that don't support mapping gsid scratch,
  run `adb remount` and then check that gsid scratch is removed and
  scratch is allocated on super.
Test: TH run g3-app-compat-main
Change-Id: I0c01c2fd93a30ac0e46f4350c900403337530406
2022-10-31 16:15:35 +08:00
Treehugger Robot
cb881e7cf0 Merge "Add riscv support for heap_addr_in_register" 2022-10-29 18:23:31 +00:00
Christopher Ferris
c666453851 Merge "Remove unnecessary logging." 2022-10-29 18:22:12 +00:00
haocheng.zy@linux.alibaba.com
3f4d036cb6 Add riscv support for heap_addr_in_register
Change-Id: I42a93a96c8c9c7a32d32674535ff466380e3c2fa
Signed-off-by: haocheng.zy <haocheng.zy@linux.alibaba.com>
2022-10-29 14:57:23 +00:00
Christopher Ferris
fac411d97c Remove unnecessary logging.
Test: Extra logging no longers happens.
Change-Id: Ia179ebe5d16e0bde7d6ec66e39d4484ff18f2b1e
2022-10-27 17:56:27 -07:00
Treehugger Robot
c8c24a7255 Merge changes I4c55790c,I14baaa7a
* changes:
  init: Fix a race condition in KillProcessGroup()
  init: Document that ReapOneProcess() does not modify 'pid'
2022-10-27 23:17:03 +00:00
Treehugger Robot
0eaca46f48 Merge "Add mmap_rnd_bits routine for riscv64" 2022-10-27 22:28:21 +00:00
Bart Van Assche
d8ef6f84d4 init: Fix a race condition in KillProcessGroup()
Multiple tests in CtsInitTestCases, e.g. RebootTest#StopServicesSIGKILL,
can trigger the following race condition:
* A service is started. This involves calling fork() and also to call
  RunService() in the child process. RunService() calls setpgid().
* Service::Stop() is called and calls KillProcessGroup().
  KillProcessGroup() calls kill(-pgid, SIGKILL) before the child process
  has called setpgid(). pgid is the process ID of the child process. The
  kill() call fails because setpgid() has not yet been called.

Fix this race condition by adding a setpgid() call in the parent process
and by waiting from the parent until the child has called setsid() if a
console is attached.

Bug: 213617178
Test: Cuttlefish + atest 'CtsInitTestCases'
Change-Id: I4c55790c2dcde8716b860aecd57708d51a081086
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-27 14:29:35 -07:00
Bart Van Assche
c7d7ed0eae init: Document that ReapOneProcess() does not modify 'pid'
It is essential for correct operation of ReapAnyOutstandingChildren()
that ReapOneProcess() does not modify 'pid'. Make it easier to verify
for humans that ReapOneProcess() does not modify the 'pid' local
variable. Document the value of siginfo.si_signo with DCHECK_EQ()
statements.

Bug: 213617178
Change-Id: I14baaa7adbe5416b7f777f32fb76896f2ae27b4e
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-27 14:29:35 -07:00
Treehugger Robot
1b2d443626 Merge "init: Log more information if stopping times out" 2022-10-27 21:12:19 +00:00
Bart Van Assche
2afbe6270f Merge "init: Fix HandleSignalFd()" 2022-10-27 19:28:41 +00:00
Bart Van Assche
ea595ba2a0 init: Log more information if stopping times out
The newly logged information includes the pending signals bitmask (SigPnd).
That information allows to determine whether kill() did not deliver a
signal or whether SIGCHLD has not been processed in time. This patch is
expected to help with root-causing b/254878413.

Bug: 254878413
Change-Id: Id33d1fb724163f8e5d4b3edfeb6c4be5321c0d95
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-27 12:17:34 -07:00
Eric Biggers
745111fbec Merge "Remove unneeded 'slave' flag for /data_mirror/data_ce/null" 2022-10-27 19:17:09 +00:00
Mao Han
c09eee098b Add mmap_rnd_bits routine for riscv64
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Change-Id: Ide793f4365fee67f30e35302365c4a7a5ba1f021
2022-10-27 17:59:25 +00:00
Bart Van Assche
1a5b59386d init: Fix HandleSignalFd()
There are two bugs in HandleSignalFd():
* If the one_off argument is true and if no data is read from the
  signalfd, 'siginfo' is left uninitialized and used in the switch
  statement in HandleSignalFd().
* The PLOG() statement in the switch statement should be a LOG()
  statement since it does not report a failed system call.

This CL has been tested by changing kDiagnosticTimeout locally from 10s
into 100ms.

Change-Id: I0e488dd95bc13e1befaef770c0748d1d47f6e431
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-27 08:07:26 -07:00
Bart Van Assche
874448f4aa Merge "subcontext: Change a std::string argument into std::string_view" 2022-10-27 14:34:57 +00:00
Nathan Huckleberry
f2d93cebfd Merge changes I8174adf8,I9d252b0b
* changes:
  Expose system property for dm-verity check_at_most_once
  Fix flaky AVB test from late verity_update_state
2022-10-27 00:45:01 +00:00
Eric Biggers
28a1969ebf Remove unneeded 'slave' flag for /data_mirror/data_ce/null
Remove the 'slave' mount flag that was added by commit ef9275223c
(https://r.android.com/2095463) because it doesn't actually do anything
in this context.  MS_SLAVE can only be used to change the propagation
type of an existing mount, and the kernel ignores it if MS_BIND is also
specified, due to the way the various high-level operations that the
mount() system call can do are prioritized.

The reason that the /data/user/0 mount gets propagated into /data_mirror
anyway is because the /data mount has the "shared" propagation type.  In
the above-mentioned commit I had assumed the default Linux mount
semantics, but actually Android applies the "shared" propagation type to
everything (see SetupMountNamespaces() in init/mount_namespace.cpp).

Test: Booted Cuttlefish and verified (via /proc/self/mountinfo) that
      /data/data is still bind-mounted to both /data/user/0 and
      /data_mirror/data_ce/null/0.
Bug: 156305599
BYPASS_INCLUSIVE_LANGUAGE_REASON=commit message mentioning removed code
Change-Id: Idc45d8dcb3a21d4e8e2e72f4d4dda7286f898127
2022-10-26 18:33:11 +00:00
Bart Van Assche
462ea55095 subcontext: Change a std::string argument into std::string_view
This change prevents that a later CL will trigger the following warning:

parameter 'test_context' is passed by value and only copied once; consider
moving it to avoid unnecessary copies

Change-Id: If5837ee6438efdf194781de041779c1089897789
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-10-26 09:31:59 -07:00
Bart Van Assche
5e524e28ee Merge "init: Introduce class InterprocessFifo" 2022-10-25 23:33:28 +00:00
Nathan Huckleberry
997d738dda Expose system property for dm-verity check_at_most_once
Allow us to check if check_at_most_once is set for any partitions.

This property should be false for any device with a reasonable amount of
RAM and a modern CPU. Enabling check_at_most_once violates AVB best
practices, it should only be allowed on performance limited devices.

Bug: 253033920
Test: Ensure that avbHashtreeNotUsingSha1 CTS test still passes
    and that partition.system.verified.check_at_most_once is set.
Change-Id: I8174adf81111cc0df547ea01f81b0dfaca32631f
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
2022-10-25 21:12:52 +00:00