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

Commit f0b8ebc9 authored by Yo Chiang's avatar Yo Chiang
Browse files

fs_mgr: Harden adb-remount-test.sh by ERR trap handler

Exit immediately if any unexpected error.

Bug: 165925766
Test: adb-remount-test.sh
Change-Id: I5e9e796f61be21d4b130640949432c1f531de5a4
parent a28b67e9
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -844,6 +844,9 @@ if ! ${color}; then
  NORMAL=""
  NORMAL=""
fi
fi


# Set an ERR trap handler to report any unhandled error
trap 'die "line ${LINENO}: unhandled error"' ERR

if ${print_time}; then
if ${print_time}; then
  echo "${BLUE}[     INFO ]${NORMAL}" start `date` >&2
  echo "${BLUE}[     INFO ]${NORMAL}" start `date` >&2
fi
fi
@@ -1171,7 +1174,7 @@ echo "${GREEN}[ RUN ]${NORMAL} remount" >&2


# Feed log with selinux denials as baseline before overlays
# Feed log with selinux denials as baseline before overlays
adb_unroot
adb_unroot
adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null
adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null || true
adb_root
adb_root


D=`adb remount 2>&1`
D=`adb remount 2>&1`
@@ -1358,7 +1361,7 @@ if ${enforcing}; then
  echo "${GREEN}[       OK ]${NORMAL} /vendor content correct MAC after reboot" >&2
  echo "${GREEN}[       OK ]${NORMAL} /vendor content correct MAC after reboot" >&2
  # Feed unprivileged log with selinux denials as a result of overlays
  # Feed unprivileged log with selinux denials as a result of overlays
  wait_for_screen
  wait_for_screen
  adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null
  adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null || true
fi
fi
# If overlayfs has a nested security problem, this will fail.
# If overlayfs has a nested security problem, this will fail.
B="`adb_ls /system/`" ||
B="`adb_ls /system/`" ||
@@ -1385,7 +1388,7 @@ check_eq "${BASE_VENDOR_DEVT}" "`adb_sh stat --format=%D /vendor/bin/stat </dev/
check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" --warning devt for su after reboot
check_eq "${BASE_SYSTEM_DEVT}" "`adb_sh stat --format=%D /system/xbin/su </dev/null`" --warning devt for su after reboot


# Feed log with selinux denials as a result of overlays
# Feed log with selinux denials as a result of overlays
adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null
adb_sh find ${MOUNTS} </dev/null >/dev/null 2>/dev/null || true


# Check if the updated libc.so is persistent after reboot.
# Check if the updated libc.so is persistent after reboot.
adb_root &&
adb_root &&