Commit graph

78585 commits

Author SHA1 Message Date
Victor Chang
f6a35e2c5f Merge "Revert "Add ::1 to localhost in etc/hosts"" 2022-11-11 15:36:13 +00:00
Victor Chang
1498382581 Revert "Add ::1 to localhost in etc/hosts"
Revert submission 2291455-localhost_v6

Reason for revert: b/258627476
Reverted Changes:
Icd11fab47:[Test] Update test to comply with etc/hosts change...
Ibcee52a14:Add ::1 to localhost in etc/hosts

Bug: 258627476
Change-Id: I42c8b0aebdbd8b73a90606c0a999f25d8d071cd1
2022-11-11 12:26:49 +00:00
Seth Moore
7e17f702e4 Merge "Add dependency on split out RKP HAL" 2022-11-10 19:32:31 +00:00
Treehugger Robot
7f046419f8 Merge "init: Fix a race condition in KillProcessGroup()" 2022-11-10 18:58:04 +00:00
Sandeep Dhavale
7a866d5ac2 Merge "Fastbootd: Use Fastboot AIDL with the help of fastbootshim for legacy fastboot HAL" 2022-11-10 18:29:00 +00:00
Bart Van Assche
15e5ecdcd7 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: I6931cd579e607c247b4f79a5b375455ca3d52e29
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-11-10 09:08:21 -08:00
Ken Chen
f7a95c879e Merge "Add ::1 to localhost in etc/hosts" 2022-11-10 08:19:07 +00:00
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
Ken Chen
7e6f2a44db Add ::1 to localhost in etc/hosts
::1 is IPv6 loopback address.

Bug: 256507503
Test: $ adb shell /data/dnschk localhost
      # localhost (via nethandle 0):
      127.0.0.1
      ::1
Change-Id: Ibcee52a14143856db50fca301c48ea9e2591914b
2022-11-09 17:05:35 +08: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
Sandeep Dhavale
2534d485d8 Fastbootd: Use Fastboot AIDL with the help of fastbootshim for legacy fastboot HAL
Bug: 205760652
Test: build & flash & reboot fastboot
Change-Id: I79617a396f536258655bdc28006ac2d0a7ab1912
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2022-11-09 00:38:34 +00: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