Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 671d3ca8 authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-12.1.0_r7' into staging/lineage-19.1_merge-android-12.1.0_r7

Android 12.1.0 Release 7 (SQ3A.220605.009.A1)

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCYp57OwAKCRDorT+BmrEO
# eOwnAJ4nj5xu6b+dn2N00qWM6/qU3mk68ACfaU8gU+EronAgAHMDuITQtTJI/6M=
# =S5HZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Jun  7 01:10:03 2022 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1202 signatures in the past
#      7 months.  Encrypted 4 messages in the past 4 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Jaegeuk Kim (5) and others
# Via Automerger Merge Worker (10) and others
* tag 'android-12.1.0_r7':
  Backport of Win-specific suppression of potentially rogue construct that can engage in directory traversal on the host.
  Backport of Win-specific suppression of potentially rogue construct that can engage in directory traversal on the host.
  init: Wait for snapuserd before starting second stage
  libprocessgroup: Use WriteStringToFd for WriteFileAction
  libprocessgroup: Prevent error spam when tests disable all cpus in a cpuset
  storageproxyd: Use alternate data path if in DSU state
  init: Wait for snapuserd before starting second stage
  init.rc: Set permissions to cgroup.procs files
  libprocessgroup: Add fd caching support for SetProcessProfiles
  libprocessgroup: Move fd caching code into FdCacheHelper
  [DO NOT MERGE] Allow to run fsck.f2fs in first_stage_ramdisk
  [DO NOT MERGE] Mount /mnt/scracth with -o sync,nodiscard
  [DO NOT MERGE] Run check_fs only /data is mounted
  [DO NOT MERGE] Don't use FSCK_LOG_FILE used for ext4 only
  [DO NOT MERGE] Don't try to mount if the disk has no FS magic
  [DO NOT MERGE] Retry to unmount /data
  libprocessgroup: Use WriteStringToFd for WriteFileAction
  libprocessgroup: Prevent error spam when tests disable all cpus in a cpuset

 Conflicts:
	libprocessgroup/task_profiles.cpp
	libprocessgroup/task_profiles.h

Change-Id: I7a57400978d11a576f92411224d6338de41004fe
parents 9b596795 cae6aec3
Loading
Loading
Loading
Loading
+32 −26
Original line number Diff line number Diff line
@@ -170,6 +170,22 @@ static bool should_force_check(int fs_stat) {
            FS_STAT_SET_RESERVED_BLOCKS_FAILED | FS_STAT_ENABLE_ENCRYPTION_FAILED);
}

static bool umount_retry(const std::string& mount_point) {
    int retry_count = 5;
    bool umounted = false;

    while (retry_count-- > 0) {
        umounted = umount(mount_point.c_str()) == 0;
        if (umounted) {
            LINFO << __FUNCTION__ << "(): unmount(" << mount_point << ") succeeded";
            break;
        }
        PERROR << __FUNCTION__ << "(): umount(" << mount_point << ") failed";
        if (retry_count) sleep(1);
    }
    return umounted;
}

static void check_fs(const std::string& blk_device, const std::string& fs_type,
                     const std::string& target, int* fs_stat) {
    int status;
@@ -209,26 +225,13 @@ static void check_fs(const std::string& blk_device, const std::string& fs_type,
                        tmpmnt_opts.c_str());
            PINFO << __FUNCTION__ << "(): mount(" << blk_device << "," << target << "," << fs_type
                  << ")=" << ret;
            if (!ret) {
                bool umounted = false;
                int retry_count = 5;
                while (retry_count-- > 0) {
                    umounted = umount(target.c_str()) == 0;
                    if (umounted) {
                        LINFO << __FUNCTION__ << "(): unmount(" << target << ") succeeded";
                        break;
                    }
                    PERROR << __FUNCTION__ << "(): umount(" << target << ") failed";
                    if (retry_count) sleep(1);
                }
                if (!umounted) {
            if (ret) {
                *fs_stat |= FS_STAT_RO_MOUNT_FAILED;
            } else if (!umount_retry(target)) {
                // boot may fail but continue and leave it to later stage for now.
                PERROR << __FUNCTION__ << "(): umount(" << target << ") timed out";
                *fs_stat |= FS_STAT_RO_UNMOUNT_FAILED;
            }
            } else {
                *fs_stat |= FS_STAT_RO_MOUNT_FAILED;
            }
        }

        /*
@@ -268,12 +271,12 @@ static void check_fs(const std::string& blk_device, const std::string& fs_type,
            LINFO << "Running " << F2FS_FSCK_BIN << " -f -c 10000 --debug-cache "
                  << realpath(blk_device);
            ret = logwrap_fork_execvp(ARRAY_SIZE(f2fs_fsck_forced_argv), f2fs_fsck_forced_argv,
                                      &status, false, LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
                                      &status, false, LOG_KLOG | LOG_FILE, false, nullptr);
        } else {
            LINFO << "Running " << F2FS_FSCK_BIN << " -a -c 10000 --debug-cache "
                  << realpath(blk_device);
            ret = logwrap_fork_execvp(ARRAY_SIZE(f2fs_fsck_argv), f2fs_fsck_argv, &status, false,
                                      LOG_KLOG | LOG_FILE, false, FSCK_LOG_FILE);
                                      LOG_KLOG | LOG_FILE, false, nullptr);
        }
        if (ret < 0) {
            /* No need to check for error in fork, we can't really handle it now */
@@ -1031,12 +1034,11 @@ static int handle_encryptable(const FstabEntry& entry) {
            return FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;
        }
    } else if (should_use_metadata_encryption(entry)) {
        if (umount(entry.mount_point.c_str()) == 0) {
        if (umount_retry(entry.mount_point)) {
            return FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION;
        } else {
        }
        PERROR << "Could not umount " << entry.mount_point << " - fail since can't encrypt";
        return FS_MGR_MNTALL_FAIL;
        }
    } else if (entry.fs_mgr_flags.file_encryption || entry.fs_mgr_flags.force_fde_or_fbe) {
        LINFO << entry.mount_point << " is file encrypted";
        return FS_MGR_MNTALL_DEV_FILE_ENCRYPTED;
@@ -1882,9 +1884,13 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& alt_mount_po
    auto& mount_point = alt_mount_point.empty() ? entry.mount_point : alt_mount_point;

    // Run fsck if needed
    prepare_fs_for_mount(entry.blk_device, entry, mount_point);
    int ret = prepare_fs_for_mount(entry.blk_device, entry, mount_point);
    // Wiped case doesn't require to try __mount below.
    if (ret & FS_STAT_INVALID_MAGIC) {
      return FS_MGR_DOMNT_FAILED;
    }

    int ret = __mount(entry.blk_device, mount_point, entry);
    ret = __mount(entry.blk_device, mount_point, entry);
    if (ret) {
      ret = (errno == EBUSY) ? FS_MGR_DOMNT_BUSY : FS_MGR_DOMNT_FAILED;
    }
+6 −1
Original line number Diff line number Diff line
@@ -866,9 +866,14 @@ bool fs_mgr_overlayfs_mount_scratch(const std::string& device_path, const std::s
            errno = save_errno;
        }
        entry.flags &= ~MS_RDONLY;
        entry.flags |= MS_SYNCHRONOUS;
        entry.fs_options = "nodiscard";
        fs_mgr_set_blk_ro(device_path, false);
    }
    // check_fs requires apex runtime library
    if (fs_mgr_overlayfs_already_mounted("/data", false)) {
        entry.fs_mgr_flags.check = true;
    }
    auto save_errno = errno;
    if (mounted) mounted = fs_mgr_do_mount_one(entry) == 0;
    if (!mounted) {
+1 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ static const struct fs_path_config android_files[] = {
    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/resize2fs" },
    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/snapuserd" },
    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/tune2fs" },
    { 00755, AID_ROOT,      AID_ROOT,      0, "first_stage_ramdisk/system/bin/fsck.f2fs" },
    // generic defaults
    { 00755, AID_ROOT,      AID_ROOT,      0, "bin/*" },
    { 00640, AID_ROOT,      AID_SHELL,     0, "fstab.*" },
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector<std::string>& pr

#ifndef __ANDROID_VNDK__

bool SetProcessProfilesCached(uid_t uid, pid_t pid, const std::vector<std::string>& profiles);

static constexpr const char* CGROUPS_RC_PATH = "/dev/cgroup_info/cgroup.rc";

bool UsePerAppMemcg();
+7 −2
Original line number Diff line number Diff line
@@ -112,11 +112,16 @@ static bool isMemoryCgroupSupported() {
}

void DropTaskProfilesResourceCaching() {
    TaskProfiles::GetInstance().DropResourceCaching();
    TaskProfiles::GetInstance().DropResourceCaching(ProfileAction::RCT_TASK);
    TaskProfiles::GetInstance().DropResourceCaching(ProfileAction::RCT_PROCESS);
}

bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector<std::string>& profiles) {
    return TaskProfiles::GetInstance().SetProcessProfiles(uid, pid, profiles);
    return TaskProfiles::GetInstance().SetProcessProfiles(uid, pid, profiles, false);
}

bool SetProcessProfilesCached(uid_t uid, pid_t pid, const std::vector<std::string>& profiles) {
    return TaskProfiles::GetInstance().SetProcessProfiles(uid, pid, profiles, true);
}

bool SetTaskProfiles(int tid, const std::vector<std::string>& profiles, bool use_fd_cache) {
Loading