No description
Find a file
Eric Biggers 6cb5a36f4c init: fix mkdir to reliably detect top-level /data directories
To determine the default encryption action, the mkdir command checks
whether the given path is a top-level directory of /data.  However, it
assumed a path without any duplicate slashes or trailing slash(es).

While everyone *should* be providing paths without unnecessary slashes,
it is not guaranteed, as paths with unnecessary slashes still work
correctly for all other parts of the mkdir command, including the
SELinux label lookup and the actual directory creation.  In particular,
the /data/fonts directory is being created using 'mkdir /data/fonts/'.

The effect is that the mkdir command thinks that /data/fonts/ is *not* a
top-level directory of /data, so it defaults to no encryption action.
Fortunately, the full command happens to use "encryption=Require", so we
dodged a bullet there, though the warning "Inferred action different
from explicit one" is still triggered.

There are a few approaches we could take here, including even just
fixing the /data/fonts/ command specifically, but I think the best
solution is to have mkdir clean its path at the very beginning.  This
retains the Linux path semantics that people expect, while avoiding
surprises in path processing afterwards.  This CL implements that.

Note, this CL intentionally changes the behavior of, and thus would
break, any existing cases where mkdir is used to create a top-level
/data directory using a path with unnecessary slashes and without using
an explicit encryption action.  There are no known cases where this
already occurs, however.  No cases exist in platform code, and vendor
init scripts shouldn't be creating top-level /data directories anyway.

Test: atest CtsInitTestCases
Test: Booted and verified that a trailing slash is no longer present in
      the log message "Verified that /data/fonts/ has the encryption
      policy ...".  Also verified that the message "Inferred action
      different ..." is no longer present just above it.
Bug: 232554803
Change-Id: Ie55c3ac1a2b1cf50632d54a1e565cb98c17b2a6a
2022-05-13 19:29:00 +00:00
bootstat bootstat: add more bootreasons 2021-09-19 19:11:06 +00:00
cli-test [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
code_coverage [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
debuggerd Merge "[GWP-ASan] Enable debuggerd to pull more allocation metadata." 2022-04-21 18:12:43 +00:00
diagnose_usb Support building diagnose_usb against musl 2021-12-16 14:04:06 -08:00
fastboot Merge "set isolated: false on fuzzy_fastboot" 2022-05-06 17:11:17 +00:00
fs_mgr Promote HWASan tests to presubmit. 2022-05-06 19:14:15 +00:00
gatekeeperd Depend on KeyMint HAL via default 2021-12-02 08:16:25 +00:00
healthd Add healthd to hwasan-postsubmit 2022-03-18 21:19:00 +00:00
include Remove include/backtrace symlink. 2020-10-20 12:46:14 -07:00
init init: fix mkdir to reliably detect top-level /data directories 2022-05-13 19:29:00 +00:00
janitors Add the two best build system janitors. 2019-03-25 10:25:13 -07:00
libappfuse [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
libasyncio Set min_sdk_version 2021-12-02 09:23:42 +09:00
libbinderwrapper [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
libcrypto_utils Set min_sdk_version 2021-12-02 09:23:42 +09:00
libcutils Added async trace functions with a track name argument 2022-03-24 23:55:00 +00:00
libdiskconfig Tweak linux_glibc properties for musl builds in system/core 2022-03-24 15:59:08 -07:00
libgrallocusage Make apex_available explicit 2022-02-09 11:37:19 -08:00
libkeyutils Make libfs_mgr dependencies vendor_ramdisk_available. 2021-07-23 16:50:06 -07:00
libmodprobe Merge "Load kernel modules in parallel" 2022-03-23 07:40:18 +00:00
libnetutils Move libipchecksum to frameworks/libs/net. 2021-12-16 19:38:01 +00:00
libpackagelistparser Add libpackagelistparser to hwasan-postsubmit 2022-03-18 21:41:03 +00:00
libprocessgroup libprocessgroup: Add a function to remove only empty process groups 2022-04-29 10:17:17 -07:00
libsparse sparse_fuzzer: Bug fix 2022-04-04 14:03:55 +05:30
libstats Promote HWASan tests to presubmit. 2022-05-09 22:42:47 +00:00
libsuspend libsuspend: vendor_available. 2021-11-02 13:52:40 -07:00
libsync libsync: remove hridya@ from OWNERS file 2022-01-05 16:59:03 -08:00
libsystem Relax requirements on android_ycbcr to allow P010 2022-02-17 10:54:15 -08:00
libsysutils Fix 32-bit userspace on 64-bit kernel quota2 compatibility. 2021-10-25 16:24:49 -07:00
libusbhost libusbhost: factor out frameworks descriptors -> byte[] code. 2022-01-24 13:35:20 -08:00
libutils Merge "Doc Thread requirement." 2022-05-12 01:53:32 +00:00
libvndksupport Add libvndksupport-tests to TEST_MAPPING 2022-03-08 09:53:55 +09:00
llkd llkd: Disable in userdebug builds by default 2021-11-04 16:21:46 -07:00
mini_keyctl Merge "Make libmini_keyctl_static available in recovery" 2021-11-23 17:54:31 +00:00
mkbootfs Rename system/cote/cpio/ -> system/core/mkbootfs/ 2021-05-05 19:03:36 +08:00
property_service Promote HWASan tests to presubmit. 2022-05-06 19:08:21 +00:00
reboot [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
rootdir Merge changes from topics "action-in-apex-config", "apex-ready-event", "subcontext-for-vendor-apex" 2022-05-13 01:47:40 +00:00
run-as [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
sdcard [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
set-verity-state Remove support for AVB 1.0. 2021-11-30 00:57:49 -08:00
shell_and_utilities Update shell_and_utilities docs for T. 2022-03-05 08:12:29 -08:00
storaged storaged: Fix double ownership for HealthInfoCallback. 2022-03-22 21:25:28 -07:00
toolbox toolbox/generate-input.h-labels.py: python3. 2021-08-17 14:34:55 -07:00
trusty Promote tests to HWASan presubmit. 2022-05-03 19:40:36 +00:00
usbd usbd - remove unused libcutils dep 2021-06-28 23:56:29 +00:00
watchdogd [LSC] Add LOCAL_LICENSE_KINDS to system/core 2021-02-19 12:59:05 -08:00
.clang-format Add a 2 width option of clang format. 2017-03-10 13:01:39 -08:00
.clang-format-2 Move clang-formats to build. 2019-01-18 14:26:33 -08:00
.clang-format-4 Move clang-formats to build. 2019-01-18 14:26:33 -08:00
.gitignore Ignore adb/*.pyc files 2015-08-11 12:59:58 -07:00
CleanSpec.mk snapshotctl don't auto-merge. 2020-03-03 13:19:49 -08:00
METADATA Add METADATA to system/core: Apache2+BSD=NOTICE 2020-04-29 13:16:41 -07:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2013-07-30 13:56:49 -07:00
OWNERS Remove baligh@ from owners. CodeShuffle done. 2020-10-17 00:28:10 +00:00
PREUPLOAD.cfg Configure rustfmt for preupload hook 2022-04-06 21:11:09 +00:00
rustfmt.toml Configure rustfmt for preupload hook 2022-04-06 21:11:09 +00:00