Commit Graph

5788 Commits

Author SHA1 Message Date
Ethan Yonker 917331b968 Fix build error in old 5.0 tree
Change-Id: I3faa0b6cc964a148dcc1bae7fdeba877fd795cf7
2017-11-28 22:28:27 -06:00
bigbiff bigbiff 5b7cb88818 ADB Backup: fix compilation error for remove
Change-Id: Ia1b6e7a216bf3fd60bbfac9cbc11038636e3560f
2017-11-28 19:26:27 -05:00
nkk71 7d1222a5fe vold_decrypt: FDE Keymaster 3.0 support
* HTC U11 Oreo is using keymaster3 FDE encryption which requires
  the new services:
    1- /system/bin/hwservicemanager
    2- /vendor/bin/hw/android.hardware.keymaster@3.0-service
    3- /vendor/bin/qseecomd (instead of /system/bin/qseecomd)
  So in addition to /vendor/lib and /vendor/lib64 also
  symlink /system/vendor/bin to /vendor/bin.

* vold_decrypt services now have separate prefixes:
    1- 'sys_' referring to /system/bin
    2- 'ven_' referring to /vendor/bin

* The additional (hwservicemanager, keymaster-3-0) and modified
  (qseecomd) .rc files have been updated in the vold_decrypt
  directory.
  Comments were added directly in the .rc files, please check
  them.

* /etc/recovery.fstab needs to be temporarily moved since
  vold will use it if it finds the '/sbin/recovery' file
  (refer to fs_mgr for the fstab load code https://goo.gl/8KaZyf).
  Since fs_mgr cannot parse TWRP style fstab, we 'hide' it
  and attempt to create a symlink to /fstab.{ro.hardware}.

Also remove shell dependencies, code cleanup, new error codes:
* Critical sections of vold_decrypt should not rely on the external
  shell (and the available binaries) provided by TWFunc::Exec_Cmd.
  Doing so may lead to failures resulting from different shell
  provided binaries not working properly, especially since busybox
  can be inconsistent across different trees.

  In particular the following functions have been changed:
  * run_vdc() no longer uses daisy chained commands, instead
    it now forks and executes vdc directly including a 30 second
    built in timeout.
  * Symlink_Firmware_Files() no longer relies on the shell 'find'
    command to retrieve the list of firmware/vendor files and instead
    uses a built in function, Find_Firmware_Files(), which traverses
    the system partition to retrieve the list of files.

* The code has also been cleaned up a little for better consistency,
  and vold_decrypt will now return various error codes for the
  different failures, as defined in vold_decrypt.h, which allows the
  gui_msg to be moved back to partitionmanager.cpp.

Notes regarding pre Android 8.0 builds:
* Service names in .rc files cannot exceed 16 characters (including
  the prepended 'sys_' or 'ven_') in Android 7.1 and below, so a
  service name such as 'sys_hwservicemanager' is out of the question
  for 7.1 and below.
* hwservicemanager will check ACLs on 'hwservicemanager' and 'ITokenManager'
  if they are even allowed to run, otherwise the interfaces will fail.
  The policies have only been introduced in 8.0, and although it is possible
  to manually add them to the 7.1 policies it's not recommended.
* Therefore the best course of action is to build in 8.0.

* SIDE NOTE: On the HTC U11 we are actually using omni-7.1 with some changes
  in the device tree to support both Nougat and Oreo decryption, please
  refer to:
    1- https://gerrit.twrp.me/c/2756/ for the necessary sepolicy and
       BoardConfig changes.
    2- The Android.mk file for vold_decrypt was modified to truncate
       greater than 16 character service names (as mentioned therein)

Other changes:
* TW_CRYPTO_SYSTEM_VOLD_DISABLE_TIMEOUT is now deprecated due to built-
  in fork and timeout.
* Output_dmesg_to_recovery_log() is also deprecated so upon a failed
  decryption the recovery.log will no longer append it, instead you can
  just use 'adb shell dmesg' to check it. Nonetheless if a true debug
  build is needed use the original TW_CRYPTO_SYSTEM_VOLD_DEBUG flag as
  outlined in the original commit message (see below).

Usage info:
This is an update to the initial vold_decrypt, for more info refer to
https://github.com/omnirom/android_bootable_recovery/commit/71c6c50d0da1f32dd18a749797e88de2358c5ba1

Change-Id: Id7129d125ae7f5dcba0779489825add718022ba3
2017-11-28 23:05:54 +01:00
Ethan Yonker fefe5915b0 FBE for Pixel 2
Includes various minor fixes for building in Android 8 trees with r23+ tag

Update FBE extended header in libtar to version 2 and include the entire
ext4_encryption_policy structure now after translating the policy.

See this post for more details:
https://plus.google.com/u/1/+DeesTroy/posts/i33ygUi7tiu

Change-Id: I2af981e51f459b17fcd895fb8c2d3f6c8200e24b
2017-11-28 16:03:41 -06:00
Dees Troy dc864ec8ac Merge "Support v2 fstab format" into android-8.0 2017-11-28 15:04:30 +01:00
Ethan Yonker dcd9f3f384 Fix issues building with LineageOS cryptfs_hw
Change-Id: Ie22691433aefa3b8819ec14e0349ee12bd88a1c2
2017-11-28 14:53:49 +01:00
Ethan Yonker 6e8c27a52b Support v2 fstab format
Auto detect and support both the v1 and v2 fstab formats
Support putting TWRP style flags in a separate /etc/twrp.flags file

twrp.flags format is the same as twrp.fstab (v1 with TWRP flags)

Support using a wildcard in a block device and find all partitions:
/usb-otg vfat /dev/block/sda*

Support using sysfs entries (voldmanaged) and read uevents and scan for
wildcard partitions from uevent data. (twvold?)

May not be complete for some of the newer flags found in fstabs in newer
build trees and there is a slim chance of a crash if the user removes a
removable device while TWRP is performing actions. May need to add some
kind of mutex to prevent the 2 threads from causing this crash. We need
to start somewhere though and this change is pretty innocuous when not
using a v2 fstab.

Change-Id: I617d97c7db332cbe671a9d2b8ad98b3d9c4f03cc
2017-11-28 00:20:51 +01:00
bigbiff bigbiff adcb4d8cb7 ADB Backup: Fix gzip backup and restore
Change-Id: I92821c7053089d130a5ab73fa36aec486da77bf1
2017-11-27 16:43:20 +01:00
bigbiff bigbiff 19fb79c722 ADB Backup: add ability for TWRP GUI to restore
Restore adb backup files that TWRP made to your PC.
Put files in your backup directory to see them.

e.g. /sdcard/TWRP/BACKUPS/<sn>

Change-Id: I2c57970d77b64c39a302159041456e761c185259
2017-11-27 09:32:30 -06:00
leskal 372019c8cd Improve greek translation
Change-Id: I1642a2c89e50438fdd7308dba318d52440b0809f
2017-11-20 18:37:52 +01:00
Michael Bestas 4a18558c69 Improve automatic detection of QCOM RTC fix
* Enable it on all platforms after msm8960

Change-Id: I2584048a9b9fa77c6c7d3408d280811143b01e8d
2017-11-19 00:12:50 +01:00
Ethan Yonker 32e803a474 Fix compile error in bootloader_message_twrp on 6.0 tree
Change-Id: Ifcfff60fab1cd73b524cd521a7094c344f8e9e1d
2017-11-18 08:10:51 -06:00
nkk71 b4c3591306 Auto detect possible use of legacy props
* Revert: Make legacy props an option disabled by default
  (reverted from commit 75aa615767)

* Instead check for ANDROID_PROPERTY_WORKSPACE in the updater-
  binary to determine whether legacy property service can be
  used

Change-Id: If68d5cca9a2b56edcb1c73db0474668cf46d8c91
2017-11-17 23:49:11 +01:00
nkk71 04ec095226 Fix mkfs.f2fs build error
* OmniROM 8.0 uses AOSP f2fs-tools which builds a static
  mkfs.f2fs directly to $(TARGET_RECOVERY_ROOT_OUT)/sbin

Change-Id: I364a13e33e71abceab2f9ba1bd3179c2d9672b27
2017-11-17 18:13:00 +01:00
nkk71 884bb2bc24 Fix 'No OS' on System_Image restore after wipe
* When you format the system partition, it will remain
  in a mounted state.
* Subsequently restoring a system_image (even though
  successfully) the Update_System_Details() function
  will not correctly update the system partition
  details.

* Reproducible by:
  1- Advanced wipe: System
  2- Restore: System_Image
  3- Reboot -> No OS prompt

* eg: [
       ~ # twrp get tw_min_system
           tw_min_system = 50
       ~ # twrp get tw_backup_system_size
           tw_backup_system_size = 8
       ~ # mount -o ro /system
       ~ # du -sh /system
           3.5G    /system
      ]

Change-Id: I99f75274816788dd38eccdd387f7ac691e1f3fab
2017-11-17 18:11:59 +01:00
Ethan Yonker 477da64554 Merge branch 'android-7.1' of github.com:omnirom/android_bootable_recovery 2017-09-25 21:11:49 -05:00
Ethan Yonker d9918b7c38 Fix a few build errors
Change-Id: I1311e4f9bb2409e856df3d333cc0d6c3f8f097f8
2017-09-15 08:17:42 -05:00
Ethan Yonker c3c0e648bb Add libraries needed in 8.0 for e2fsck and tune2fs
Change-Id: I99fad0cf2de7ff95814eff1a5f8dde59afb4b5c2
2017-09-11 21:39:57 -05:00
Ethan Yonker 75aa615767 Make legacy props an option disabled by default
Change-Id: Id0bb17ebd11e120b4676c41d6553e6a830ac7ee9
2017-09-08 12:17:53 -05:00
Ethan Yonker 8373cfe28c Update to AOSP 8.0 base
Change-Id: I29fe722b4eb9718765327902779046840a01433e
2017-09-08 07:14:59 -05:00
Ethan Yonker 95e8007578 DO NOT MERGE Android 8.0 stuff
Change-Id: I8c8a9734adbf36c33463123844fa6e078934ae34
2017-08-24 21:45:50 -05:00
kaneawk c75c8a2eb4 Remove duplicate entries & Improve Chinese translation
Change-Id: I3ed9b5731d63f69748fbbf99c626669db39a1eb4
2017-08-18 19:36:03 +08:00
big biff c0c5c3a1a4 Merge "Fix typos / inconsistencies in German language" into android-7.1 2017-08-15 02:49:40 +02:00
big biff 5302ec42b7 Merge "SHA2: Enable in landscape and watch xml" into android-7.1 2017-08-13 01:51:57 +02:00
nkk71 1a230e461c Show scrollbar on TWRP Settings
* The scrollbar is not shown when more options
  are actually available.

Change-Id: I78b223c5fe12f0cbd73357ca6615f83ff04201e1
2017-08-08 13:23:49 +03:00
bigbiff bigbiff 1c01fabf87 SHA2: Enable in landscape and watch xml
Change-Id: I8bdb4b8a24cbdd0f68d45676f2858eb63f74677b
2017-08-07 18:44:04 -04:00
nkk71 d59d02e1a1 twrpTar: Fix uninitialized current_archive_type
* current_archive_type is not properly initialized
  leading to a potential random close(fd) in closeTar()

Change-Id: I1598ba4d524b723b8175ee847e2b1c5aeedbd938
2017-07-21 20:37:36 +02:00
Ethan Yonker cd00a8b361 backup: fix return handling when no digest is being created
If the user selects to skip digest creation, Backup_Partition always returned
false. This patch fixes this problem and somewhat cleans up the error
handling.

Change-Id: I1db0e285cd5ed2bd93756cd27c6f56b8415ffa86
2017-07-06 10:23:36 -05:00
Ethan Yonker da056fdc5b libtar: Fix restore of e4crypt policies
Change-Id: I457356069330c38299fd326181c1c88b12a08dbd
2017-07-06 10:10:13 -05:00
Michael Bestas c86b6d4312 Complete support for project pathmap
* Use project pathmap when available for LOCAL_C_INCLUDES

Change-Id: Iddc7cc8509d966307c4a490c9d6c15d761dbb3b4
2017-06-24 14:32:07 +02:00
android-build-team Robot 43348a6282 release-request-f4ecf242-5d1c-45e0-8c7c-ede48d1a9e82-for-git_oc-release-4111650 snap-temp-L02200000075283731
Change-Id: Id1b274b254753d4ee0fc788092ef6a62f86efd92
2017-06-18 07:12:19 +00:00
nkk71 9efbe769c3 Fix incorrect 'unlink' return value check
Change-Id: I430f6bb21a5fd87e0422420463e8bb96c4a612e1
2017-06-17 14:21:47 +02:00
bigbiff bigbiff 56cf564658 twrpDigest refactor
This patch is to refactor twrpDigest using polymorphism
and inheritance to use the same call patterns for creating and
reading a digest. Now a library.
Use SHA2 from libcrypto. SHA2 is default if device has libcrypto.

Change string MD5 everywhere to use digest or Digest instead. Updated
string tags to digest. Translation will be required.

Switch out digest code into a driver class from partitionmanager.

SHA2 is better for digest creation due to decreased collision space
compared to MD5 and SHA1.

See https://en.wikipedia.org/wiki/SHA-2

Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f
2017-06-17 07:05:45 -05:00
Jeff Vander Stoep e35926e1af Fix "No file_contexts" warning
Fixed by Loading the file_contexts specified in libselinux, whereas
previously recovery loaded /file_contexts which no longer exists.

Bug: 62587423
Test: build and flash recovery on Angler. Warning is gone.
Test: Wipe data and cache.
Test: sideload OTA
Change-Id: I11581c878b860ac5f412e6e8e7acde811f37870f
(cherry picked from commit 2330dd8733)
2017-06-15 21:24:29 +00:00
Dees Troy 92e2531dca Merge "Fix minui issues for some build trees" into android-7.1 2017-06-10 15:52:31 +02:00
big biff 52dc0ea4f9 Merge "ors: Update doc" into android-7.1 2017-06-08 02:08:45 +02:00
Pierre Roth e136fd495c Fix typos / inconsistencies in German language
Change-Id: Id3b4cca16ec18f63fb71f7e0ae09d2cc2d8516f8
2017-06-07 08:55:59 +02:00
Ethan Yonker 39662b2914 Fix minui issues for some build trees
In trees where TWRP is the primary recovery, minui.h was not setting rules
properly for healthd because healthd uses clang. Must use
CLANG_TARGET_GLOBAL_CFLAGS to set global flags.

Change-Id: I4cd9c88f8fcaec345fe012d09abcb9f24be06ef4
2017-06-06 11:32:50 -05:00
nailyk-fr 79605aece1 ors: Update doc
Change-Id: Ia026a8578262d4bb231e1727313ed1f5e323b880
2017-06-05 11:32:23 +02:00
nkk71 ffb02bdfc4 Improve decrypted partition logging
* Partition information should be updated after successful
  decryption (both userdata and adopted) and then logged

* Fix adopted storage nickname being ""

Change-Id: Idcdab84f339e932e62880089bad36e206920dd70
2017-06-04 23:15:05 +03:00
bigbiff bigbiff 4a2a1914a2 adbbackup: write smaller reads less than 512 bytes
This will allow the gzip compression header to be
written properly to the adb stream.

Thanks to nkk71 for finding the issue.
Change-Id: I3d88c5f575ca3fac904d8279f1f246994be2b02f
2017-06-04 04:30:09 +02:00
Ayke van Laethem 05c2de4c68 Fix various memory errors
There were a few memory errors while restoring a backup via adb (created
using `adb backup --twrp`).
On my device (S5 mini) it resulted in this error message:

  FORTIFY: strlen: prevented read past end of buffer

This commit fixes this issue and a few other potential issues.

Change-Id: I5022c94c961217238b3fefec0b2c4b8c6fa26ec7
2017-06-03 02:37:06 +02:00
nkk71 5073003302 cryptfs: Remove dm-crypt device on failed table load
* The dm-crypt device needs to be removed from
   the device-mapper driver list otherwise it will
   remain busy and cannot be used later on by
   other processes (eg vold_decrypt) or for further
   testing/debugging in recovery.

Change-Id: I35e43a79ecc3de234ddb9f87f7d75c6439ea7454
2017-05-23 14:59:57 +02:00
android-build-team Robot 445c948c0a release-request-c72e46fd-06a9-4104-bad3-f7ba8aeb3e1d-for-git_oc-release-4029917 snap-temp-L38800000066299680
Change-Id: I8fd5a0c76fe7275b05cc3fb7713a582920cfe76c
2017-05-21 07:14:42 +00:00
Tianjie Xu 539b08cfcf Fix the input parameter for "set_retry_bootloader_message"
We're not updating argc & argv during get_args(), so some boot
arguments missed when we set the boot message for retry.

Bug: 38383406
Test: boot command sets correctly during retry attempt.
Change-Id: Ie8583a22fad5e0084245e3431d4018518d508dfd
(cherry picked from commit 72449c9f99)
2017-05-17 11:52:17 -07:00
that 9c3b7e990e etc: remove "." from LD_LIBRARY_PATH
We shouldn't load libraries from some random working directory.
For example it breaks busybox when you're in /system/lib.

Change-Id: Ia1f8f4fda9e6182c0cd8c5ac727c2b1eb09c84a2
2017-05-16 22:56:51 +02:00
Michael Bestas 5f05255911 mtdutils: Fix mounting partitions by-name
Change-Id: I8314bb94bf5bcd9576995cd2ecdc5133c5f5ea11
2017-05-15 22:17:39 +02:00
that 0d0d522b88 gui: fix line wrapping in terminal, issue #876
Apparently we are supposed to delay going to the next line until the next
character is printed.

Change-Id: I5cd0cc128cc00dcdd0dd2dd9508281f1249db257
2017-05-15 15:14:32 -05:00
Ethan Yonker 805a5dfe89 3.1.1
Change-Id: I6ab4169836e460d1652d29c24ad1c5a55191efe7
2017-05-12 09:37:41 -05:00
Ethan Yonker 0afc1fdc48 Fix reboot when no OS is present
Change-Id: Idc3d3c79b8a7acf0f632ed39703766005d73de29
2017-05-12 16:21:54 +02:00