Commit graph

3367 commits

Author SHA1 Message Date
Qilin Tan
5d0aaaf8e0 Fix the overflow issue in Checkpoint
When the partition is f2fs and the OS is 32bit, the data.f_bavail and
data.f_frsize are 32 bits in size. The product of them is also 32 bits
in size. If the available size of storage is greater than 4G, the
product may be greater than the unsigned long max value. If the product
is overflow and less than 100M. The UDC feature will be disabled.

There is also an overflow for std::strtoul when the variable content
is a very big number(more the unsigned long max value).

To avoid the overflow:
1. convert the variable data.f_bavvail to uint64_t and then compute the
multiplication.
2. use std::strtoull replace to std::strtoul.

Bug: 147118861
Change-Id: I60172ae4cb7c997e2ad4a36583be74736c25e565
2020-01-03 08:12:03 +00:00
Automerger Merge Worker
61f5d1e399 Merge "Consistently use CLOCK_MONOTONIC for timing encryption" am: f9510e3262 am: 395c47e046
Change-Id: I5aa535a2dc31bce130c1e48c8a3cf9bdc1a8b238
2019-12-27 02:21:36 +00:00
Denis Hsu
395c47e046 Merge "Consistently use CLOCK_MONOTONIC for timing encryption"
am: f9510e3262

Change-Id: I6eb165b5e9214eb614434ecfa654cfcd22327af1
2019-12-26 18:03:33 -08:00
Treehugger Robot
f9510e3262 Merge "Consistently use CLOCK_MONOTONIC for timing encryption" 2019-12-27 01:51:56 +00:00
Denis Hsu
1740effeaa Consistently use CLOCK_MONOTONIC for timing encryption
time_started in encryptGroupsData is set from and compared to
clock_gettime(CLOCK_MONOTONIC, ...) nearly everywhere: "Clock that
cannot be set and represents monotonic time since some unspecified
starting point". However in cryptfs_enable_inplace_f2fs() it is set
from a different clock, time(NULL), with the result that the setprop
calls that indicate progress are wrong and can be called much too
often. The fix is to make this function consistent with
cryptfs_enable_inplace_ext4.

Bug: 146877356
Change-Id: I2707180e5c5bf723a5a880f6a3aac47f2bb34ccd
2019-12-26 18:53:53 +00:00
Automerger Merge Worker
270e041a14 Merge "Clean up providing key via old API" am: 180b1a7f89 am: fe823efdae
Change-Id: Ic130119f9887dcb0d8459770aed2253bcbf909c1
2019-12-18 20:13:43 +00:00
Eric Biggers
fe823efdae Merge "Clean up providing key via old API"
am: 180b1a7f89

Change-Id: Icc84ee275ce240fc65eb872d44ffc856e8cc8dd0
2019-12-18 11:57:42 -08:00
Eric Biggers
180b1a7f89 Merge "Clean up providing key via old API" 2019-12-18 19:13:28 +00:00
Eric Biggers
506342fb37 Clean up providing key via old API
- Use FSCRYPT_MAX_KEY_SIZE from <linux/fscrypt.h> instead of manually
  defining FS_AES_256_XTS_KEY_SIZE.  These have the same numeric value
  (64), but the former is supposed to be used, and AES-256-XTS isn't
  necessarily the encryption algorithm that is being used anyway.

- Use the new name FSCRYPT_KEY_DESCRIPTOR_SIZE instead of the old name
  FS_KEY_DESCRIPTOR_SIZE.  These have the same numeric value (8).

- Don't try to handle sizeof(fscrypt_key::raw) > FSCRYPT_MAX_KEY_SIZE,
  as this simply isn't the case.

- Set fscrypt_key::mode to 0 rather than FS_ENCRYPTION_MODE_AES_256_XTS.
  This field has always been ignored by the kernel, and AES-256-XTS
  isn't necessarily the encryption algorithm that is being used anyway.

- Initialize the fields of fscrypt_key in order.

This is a cleanup only.

Test: booted hikey with fileencryption=aes-256-xts and a kernel that
      doesn't support the new fscrypt ioctls.
Bug: none
Change-Id: Ie2a7e9240aa479dfab2765c11db8a7124d20c643
2019-12-17 13:48:25 -08:00
Automerger Merge Worker
feef5dc6d0 Merge "Use <linux/fscrypt.h> from Bionic" am: 1d3cd24c4e am: c1e5cbe182
Change-Id: Ie0142719a4b3836912aa4b41ce72f782e8c68f43
2019-12-17 17:50:04 +00:00
Eric Biggers
c1e5cbe182 Merge "Use <linux/fscrypt.h> from Bionic"
am: 1d3cd24c4e

Change-Id: Icf5a715146d6edd6740fcff0b45df9e817fac1ef
2019-12-17 09:39:37 -08:00
Eric Biggers
1d3cd24c4e Merge "Use <linux/fscrypt.h> from Bionic" 2019-12-17 17:35:03 +00:00
Eric Biggers
3e9c996ab0 Use <linux/fscrypt.h> from Bionic
aosp/1184798 has updated the kernel headers to 5.4, so we no longer need
the file fscrypt_uapi.h.  In KeyUtil.cpp we also now don't need
<linux/fs.h>, but rather just the more specific <linux/fscrypt.h>.

Test: build
Bug: None
Change-Id: I56d17826eb7c3b95c74ce0435a4feae7f3cc325e
2019-12-16 16:19:44 -08:00
Automerger Merge Worker
4f2f5d03b1 Merge "Allow fscrypt_mount_metadata_encrypted to be called more than once" am: 69199c70ec am: c39c12d0c3
Change-Id: I075c96eff7910c7a68c295ecf5f887b9deb929c0
2019-12-11 19:09:42 +00:00
Nikita Ioffe
c39c12d0c3 Merge "Allow fscrypt_mount_metadata_encrypted to be called more than once"
am: 69199c70ec

Change-Id: I743a9bbcca76af3fc1701d315e7e053b7ebea57e
2019-12-11 10:47:20 -08:00
Nikita Ioffe
69199c70ec Merge "Allow fscrypt_mount_metadata_encrypted to be called more than once" 2019-12-11 18:40:21 +00:00
Tianjie Xu
9586a3dd1b Merge "Clear the warm_reset flag after boot is successful" am: 3fc3d75eb0
am: 9e9e9143b0

Change-Id: Ib1fe4e420b7d673cfbdb4b425ba8b9f97cbea2fc
2019-12-10 10:39:46 -08:00
Tianjie Xu
9e9e9143b0 Merge "Clear the warm_reset flag after boot is successful"
am: 3fc3d75eb0

Change-Id: I7da336fa51761f133c633a9ba9997c99772b1e9c
2019-12-10 10:37:48 -08:00
Tianjie Xu
3fc3d75eb0 Merge "Clear the warm_reset flag after boot is successful" 2019-12-10 18:28:26 +00:00
Oli Lan
f243a3b105 Merge changes from topics "createapexdirs", "createapexrollbackdirs" am: 3e1c0478b9
am: 0ad91e40ea

Change-Id: I63e3a68a9d197c89aa195409c9847d6334f1dd14
2019-12-10 05:07:29 -08:00
Oli Lan
3f26f52ede Create DE_n and CE_n APEX data directories. am: 94457217cb
am: e7216f643d

Change-Id: I2afb35d4744224f19e3dafb327ba26f3348e09a5
2019-12-10 05:07:26 -08:00
Oli Lan
0ad91e40ea Merge changes from topics "createapexdirs", "createapexrollbackdirs"
am: 3e1c0478b9

Change-Id: I8ec5a0d3d1519eec788604dbaa5e41b869b8d428
2019-12-10 05:04:20 -08:00
Oli Lan
e7216f643d Create DE_n and CE_n APEX data directories.
am: 94457217cb

Change-Id: I5e2a86ae85152b2ea36547783a86ccae654eb6ea
2019-12-10 05:04:17 -08:00
Oli Lan
3e1c0478b9 Merge changes from topics "createapexdirs", "createapexrollbackdirs"
* changes:
  Create directories for snapshots of DE_n and CE_n apex data.
  Create DE_n and CE_n APEX data directories.
2019-12-10 12:54:43 +00:00
Nikita Ioffe
f850e6e564 Allow fscrypt_mount_metadata_encrypted to be called more than once
In case of userspace reboot, this function will be called again to
remount userdata into checkpoint mode.

Test: adb shell setprop sys.init.userdata_remount.force_umount_f2fs 1
Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb reboot userspace
Test: adb shell dumpsys activity
Bug: 135984674
Bug: 143970043
Change-Id: I300b1960a6c4e95b13c43d806c4f3a9e4a612ac4
2019-12-09 21:19:11 +00:00
Songchun Fan
1119bc8531 Merge "[incremental] use vold to mount/unmount IncrementalFileSystem" am: 6bdfb77d8b
am: a0945f468a

Change-Id: I4244844cde78dc46cac88299fa1fd2e2eee9af26
2019-12-06 00:05:07 -08:00
Songchun Fan
a0945f468a Merge "[incremental] use vold to mount/unmount IncrementalFileSystem"
am: 6bdfb77d8b

Change-Id: Ic9abd7f6e502e9f051effa998e3fbd40746d57d7
2019-12-06 00:03:15 -08:00
Songchun Fan
6bdfb77d8b Merge "[incremental] use vold to mount/unmount IncrementalFileSystem" 2019-12-06 06:45:37 +00:00
Songchun Fan
ab55cecdc1 [incremental] use vold to mount/unmount IncrementalFileSystem
Let vold mount IncFs onto directories under data and open control files.

Test: builds
Change-Id: Ibd96aae254b4fefaf56c9d549c4672a987c46221
2019-12-04 14:01:22 -08:00
Nikita Ioffe
961806fdc9 Merge "Add '/system/bin/vdc volume reset' command" am: d21a8a495d
am: 86bad28329

Change-Id: I589bc0973050eea50147f927cf2044949ca4d7e0
2019-12-04 12:18:28 -08:00
Nikita Ioffe
86bad28329 Merge "Add '/system/bin/vdc volume reset' command"
am: d21a8a495d

Change-Id: I21fde79cd170bdfcd8a32b8a85da56099a223e2d
2019-12-04 11:52:20 -08:00
Nikita Ioffe
d21a8a495d Merge "Add '/system/bin/vdc volume reset' command" 2019-12-04 19:22:50 +00:00
Oli Lan
ac003c4955 Create directories for snapshots of DE_n and CE_n apex data.
This creates apexrollback directories under /data/misc_[de|ce]/<user>
which will hold snapshots of DE_n and CE_n apex data directories
(i.e. it will hold backups of data from /data/misc_[de|ce]/<user>/apexdata
for particular apexes).

See go/apex-data-directories for details.

Bug: 141148175
Test: Built and flashed, checked directory was created.
Change-Id: I468060b20dee0c50033b5f014ce8716582d5e6bc
2019-12-04 10:29:50 +00:00
Nikita Ioffe
7596581e9f Add '/system/bin/vdc volume reset' command
It will be used during the userspace reboot to unmount all emulated
storages, which is a prerequisite to unmount+remount ext4 userdata into
checkpoint mode.

Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb reboot userspace
Bug: 143970043
Bug: 135984674
Change-Id: I07491bc4be2f30debe21b764766c9def68548e16
2019-12-02 11:51:20 +00:00
Oli Lan
94457217cb Create DE_n and CE_n APEX data directories.
This creates an apexdata directory under /data/misc_de/<user> and
/data/misc_ce/<user>, and also creates a directory under that for
every APEX that is installed.

See go/apex-data-directories.

APEXes are discovered by scanning the /apex directory. It may be better
to delegate this process to a library, but it is proposed to defer that
change to a future CL.

Bug: 141148175
Test: Built and flashed, checked directories were created.
Change-Id: I95a060b4f42241c91da25a779e61a8f85ca1914c
2019-11-21 14:07:18 +00:00
Janis Danisevskis
ffe6756d10 Merge "Removed obsolete Test" am: 6e3441a8ea
am: 9f5f518c19

Change-Id: I39bccf96f352b1000f2fdd64ffff92e20bbfc340
2019-11-18 16:28:28 -08:00
Janis Danisevskis
9f5f518c19 Merge "Removed obsolete Test"
am: 6e3441a8ea

Change-Id: I392f1737c5dfa6e7aee78c7b1af1b016f6f102e9
2019-11-18 16:22:14 -08:00
Treehugger Robot
6e3441a8ea Merge "Removed obsolete Test" 2019-11-19 00:11:11 +00:00
Janis Danisevskis
8c4eb2c2c0 Removed obsolete Test
The HidlizationEquivalenceTest was used to make sure the same key is
computed by the scrypt algorithm regardless of whether the old
(<= KM2 HAL pre treble) or the new (>= KM3.0 treble) HAL was used.
Since the treble is now the default, and old HAL don't even exist on
new devices, we should call the migration a success and drop this test
altogether.

Test: Removed obsolete Code
Bug: 68197448
Change-Id: If10c79bafac4d0c8268675cbb8e1c4b46974aab5
2019-11-18 22:53:30 +00:00
Tianjie Xu
09de0ff8d6 Clear the warm_reset flag after boot is successful
The property is set to inform kernel to do a warm_reset on the next
reboot. This is useful to persist the logs to debug device boot
failures. After the slot has been marked as boot successful, we can drop
the warm_reset flag to avoid the performance overhead on the next
reboot.

Bug: 143489994
Test: check the property is set to 0 by vold
Change-Id: If7c922f40bcf9a6f7894af0a334ab23d88d40d17
2019-11-15 14:06:02 -08:00
Zimuzo Ezeozue
b287ea6a02 Merge "Add zezeozue to OWNERS" am: f9972055f5
am: e8db702702

Change-Id: I0b6a7b06d1ce39e8e70e87a14b312425c55828d5
2019-11-15 08:32:59 -08:00
Zimuzo Ezeozue
e8db702702 Merge "Add zezeozue to OWNERS"
am: f9972055f5

Change-Id: I45c211d810f1a15e0b5a1f4decc33a0eece8dafd
2019-11-15 08:25:56 -08:00
Zimuzo Ezeozue
f9972055f5 Merge "Add zezeozue to OWNERS" 2019-11-15 16:06:59 +00:00
Zim
076967a823 Add zezeozue to OWNERS
Test: n/a
Change-Id: I75339fcea5d4e537c6312e8e515b6dd62d7ae7fc
2019-11-15 16:03:47 +00:00
shaozhongqi
42726be6a3 Merge "Exfat Need to add automatic repair function when exfat fsck device" am: 7e249ebdae
am: 8006c80960

Change-Id: I74cdf0596642b2db70f4507eefc8acd68ad1fe26
2019-11-08 15:22:25 -08:00
shaozhongqi
8006c80960 Merge "Exfat Need to add automatic repair function when exfat fsck device"
am: 7e249ebdae

Change-Id: I835a8717fb25b651ce815c9912322b84e9d66041
2019-11-08 15:18:28 -08:00
Treehugger Robot
7e249ebdae Merge "Exfat Need to add automatic repair function when exfat fsck device" 2019-11-08 22:43:45 +00:00
shaozhongqi
081cf8efdb Exfat Need to add automatic repair function when exfat fsck device
bug:143229109

Test: Manual

Change-Id: Ibf650bdcb378dd9c07f904bdd18b36f376b45b61
Signed-off-by: shaozhongqi <shaozhongqi@xiaomi.com>
2019-10-31 06:37:50 +00:00
Paul Crowley
ff5ad94627 Merge "Remove libfscrypt now it's in libfs_mgr" am: 43f8298bdd
am: ce187e7fd6

Change-Id: I67dab6b461cf9eebc91db8d922c100b786597f1d
2019-10-30 20:38:26 -07:00
Paul Crowley
ce187e7fd6 Merge "Remove libfscrypt now it's in libfs_mgr"
am: 43f8298bdd

Change-Id: I0eaafaa461fa2ec6153a3e3bf49926b2efc610b7
2019-10-30 20:31:55 -07:00