Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "EncryptInplace.h" |
| 18 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 19 | #include <ext4_utils/ext4.h> |
| 20 | #include <ext4_utils/ext4_utils.h> |
| 21 | #include <f2fs_sparseblock.h> |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 22 | #include <fcntl.h> |
| 23 | #include <inttypes.h> |
| 24 | #include <stdint.h> |
| 25 | #include <stdio.h> |
| 26 | #include <sys/stat.h> |
| 27 | #include <sys/types.h> |
| 28 | #include <time.h> |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 29 | |
| 30 | #include <algorithm> |
| 31 | |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 32 | #include <android-base/logging.h> |
| 33 | #include <android-base/properties.h> |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 34 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 35 | // FIXME horrible cut-and-paste code |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 36 | static inline int unix_read(int fd, void* buff, int len) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 37 | return TEMP_FAILURE_RETRY(read(fd, buff, len)); |
| 38 | } |
| 39 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 40 | static inline int unix_write(int fd, const void* buff, int len) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 41 | return TEMP_FAILURE_RETRY(write(fd, buff, len)); |
| 42 | } |
| 43 | |
| 44 | #define CRYPT_SECTORS_PER_BUFSIZE (CRYPT_INPLACE_BUFSIZE / CRYPT_SECTOR_SIZE) |
| 45 | |
| 46 | /* aligned 32K writes tends to make flash happy. |
| 47 | * SD card association recommends it. |
| 48 | */ |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 49 | #define BLOCKS_AT_A_TIME 8 |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 50 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 51 | struct encryptGroupsData { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 52 | int realfd; |
| 53 | int cryptofd; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 54 | off64_t one_pct, cur_pct, new_pct; |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 55 | off64_t blocks_already_done; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 56 | off64_t used_blocks_already_done, tot_used_blocks; |
Paul Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 57 | const char* real_blkdev; |
| 58 | const char* crypto_blkdev; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 59 | int count; |
| 60 | off64_t offset; |
| 61 | char* buffer; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 62 | time_t time_started; |
| 63 | int remaining_time; |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 64 | bool set_progress_properties; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 67 | static void update_progress(struct encryptGroupsData* data, int is_used) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 68 | data->blocks_already_done++; |
| 69 | |
| 70 | if (is_used) { |
| 71 | data->used_blocks_already_done++; |
| 72 | } |
| 73 | if (data->tot_used_blocks) { |
| 74 | data->new_pct = data->used_blocks_already_done / data->one_pct; |
| 75 | } else { |
| 76 | data->new_pct = data->blocks_already_done / data->one_pct; |
| 77 | } |
| 78 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 79 | if (!data->set_progress_properties) return; |
| 80 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 81 | if (data->new_pct > data->cur_pct) { |
| 82 | char buf[8]; |
| 83 | data->cur_pct = data->new_pct; |
| 84 | snprintf(buf, sizeof(buf), "%" PRId64, data->cur_pct); |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 85 | android::base::SetProperty("vold.encrypt_progress", buf); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | if (data->cur_pct >= 5) { |
| 89 | struct timespec time_now; |
| 90 | if (clock_gettime(CLOCK_MONOTONIC, &time_now)) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 91 | LOG(WARNING) << "Error getting time"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 92 | } else { |
| 93 | double elapsed_time = difftime(time_now.tv_sec, data->time_started); |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 94 | off64_t remaining_blocks = data->tot_used_blocks - data->used_blocks_already_done; |
| 95 | int remaining_time = |
| 96 | (int)(elapsed_time * remaining_blocks / data->used_blocks_already_done); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 97 | |
| 98 | // Change time only if not yet set, lower, or a lot higher for |
| 99 | // best user experience |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 100 | if (data->remaining_time == -1 || remaining_time < data->remaining_time || |
| 101 | remaining_time > data->remaining_time + 60) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 102 | char buf[8]; |
| 103 | snprintf(buf, sizeof(buf), "%d", remaining_time); |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 104 | android::base::SetProperty("vold.encrypt_time_remaining", buf); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 105 | data->remaining_time = remaining_time; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 111 | static void log_progress(struct encryptGroupsData const* data, bool completed) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 112 | // Precondition - if completed data = 0 else data != 0 |
| 113 | |
| 114 | // Track progress so we can skip logging blocks |
| 115 | static off64_t offset = -1; |
| 116 | |
| 117 | // Need to close existing 'Encrypting from' log? |
| 118 | if (completed || (offset != -1 && data->offset != offset)) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 119 | LOG(INFO) << "Encrypted to sector " << offset / info.block_size * CRYPT_SECTOR_SIZE; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 120 | offset = -1; |
| 121 | } |
| 122 | |
| 123 | // Need to start new 'Encrypting from' log? |
| 124 | if (!completed && offset != data->offset) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 125 | LOG(INFO) << "Encrypting from sector " << data->offset / info.block_size * CRYPT_SECTOR_SIZE; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | // Update offset |
| 129 | if (!completed) { |
| 130 | offset = data->offset + (off64_t)data->count * info.block_size; |
| 131 | } |
| 132 | } |
| 133 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 134 | static int flush_outstanding_data(struct encryptGroupsData* data) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 135 | if (data->count == 0) { |
| 136 | return 0; |
| 137 | } |
| 138 | |
Sudheer Shanka | 4b6ca4e | 2018-09-21 10:54:54 -0700 | [diff] [blame] | 139 | LOG(DEBUG) << "Copying " << data->count << " blocks at offset " << data->offset; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 140 | |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 141 | if (pread64(data->realfd, data->buffer, info.block_size * data->count, data->offset) <= 0) { |
| 142 | LOG(ERROR) << "Error reading real_blkdev " << data->real_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 143 | return -1; |
| 144 | } |
| 145 | |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 146 | if (pwrite64(data->cryptofd, data->buffer, info.block_size * data->count, data->offset) <= 0) { |
| 147 | LOG(ERROR) << "Error writing crypto_blkdev " << data->crypto_blkdev |
| 148 | << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 149 | return -1; |
| 150 | } else { |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 151 | log_progress(data, false); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | data->count = 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 155 | return 0; |
| 156 | } |
| 157 | |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 158 | static uint64_t first_block_in_group(uint32_t group) { |
| 159 | return aux_info.first_data_block + (group * (uint64_t)info.blocks_per_group); |
| 160 | } |
| 161 | |
| 162 | static uint32_t num_blocks_in_group(uint32_t group) { |
| 163 | uint64_t remaining = aux_info.len_blocks - first_block_in_group(group); |
| 164 | return std::min<uint64_t>(info.blocks_per_group, remaining); |
| 165 | } |
| 166 | |
| 167 | // In block groups with an uninitialized block bitmap, we only need to encrypt |
| 168 | // the backup superblock and the block group descriptors (if they are present). |
| 169 | static uint32_t num_base_meta_blocks_in_group(uint64_t group) { |
| 170 | if (!ext4_bg_has_super_block(group)) return 0; |
| 171 | return 1 + aux_info.bg_desc_blocks; |
| 172 | } |
| 173 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 174 | static int encrypt_groups(struct encryptGroupsData* data) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 175 | unsigned int i; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 176 | u8* block_bitmap = 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 177 | unsigned int block; |
| 178 | off64_t ret; |
| 179 | int rc = -1; |
| 180 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 181 | data->buffer = (char*)malloc(info.block_size * BLOCKS_AT_A_TIME); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 182 | if (!data->buffer) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 183 | LOG(ERROR) << "Failed to allocate crypto buffer"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 184 | goto errout; |
| 185 | } |
| 186 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 187 | block_bitmap = (u8*)malloc(info.block_size); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 188 | if (!block_bitmap) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 189 | LOG(ERROR) << "failed to allocate block bitmap"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 190 | goto errout; |
| 191 | } |
| 192 | |
| 193 | for (i = 0; i < aux_info.groups; ++i) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 194 | LOG(INFO) << "Encrypting group " << i; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 195 | |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 196 | u32 block_count = num_blocks_in_group(i); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 197 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 198 | off64_t offset = (u64)info.block_size * aux_info.bg_desc[i].bg_block_bitmap; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 199 | |
| 200 | ret = pread64(data->realfd, block_bitmap, info.block_size, offset); |
| 201 | if (ret != (int)info.block_size) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 202 | LOG(ERROR) << "failed to read all of block group bitmap " << i; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 203 | goto errout; |
| 204 | } |
| 205 | |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 206 | offset = (u64)info.block_size * first_block_in_group(i); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 207 | |
| 208 | data->count = 0; |
| 209 | |
| 210 | for (block = 0; block < block_count; block++) { |
Will Shiu | 4ac43f0 | 2020-07-29 17:03:17 +0800 | [diff] [blame] | 211 | int used; |
| 212 | |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 213 | if (aux_info.bg_desc[i].bg_flags & EXT4_BG_BLOCK_UNINIT) |
| 214 | used = (block < num_base_meta_blocks_in_group(i)); |
| 215 | else |
Will Shiu | 4ac43f0 | 2020-07-29 17:03:17 +0800 | [diff] [blame] | 216 | used = bitmap_get_bit(block_bitmap, block); |
Will Shiu | 4ac43f0 | 2020-07-29 17:03:17 +0800 | [diff] [blame] | 217 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 218 | update_progress(data, used); |
| 219 | if (used) { |
| 220 | if (data->count == 0) { |
| 221 | data->offset = offset; |
| 222 | } |
| 223 | data->count++; |
| 224 | } else { |
| 225 | if (flush_outstanding_data(data)) { |
| 226 | goto errout; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | offset += info.block_size; |
| 231 | |
| 232 | /* Write data if we are aligned or buffer size reached */ |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 233 | if (offset % (info.block_size * BLOCKS_AT_A_TIME) == 0 || |
| 234 | data->count == BLOCKS_AT_A_TIME) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 235 | if (flush_outstanding_data(data)) { |
| 236 | goto errout; |
| 237 | } |
| 238 | } |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 239 | } |
| 240 | if (flush_outstanding_data(data)) { |
| 241 | goto errout; |
| 242 | } |
| 243 | } |
| 244 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 245 | rc = 0; |
| 246 | |
| 247 | errout: |
| 248 | log_progress(0, true); |
| 249 | free(data->buffer); |
| 250 | free(block_bitmap); |
| 251 | return rc; |
| 252 | } |
| 253 | |
Paul Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 254 | static int cryptfs_enable_inplace_ext4(const char* crypto_blkdev, const char* real_blkdev, |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 255 | off64_t size, bool set_progress_properties) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 256 | u32 i; |
| 257 | struct encryptGroupsData data; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 258 | int rc; // Can't initialize without causing warning -Wclobbered |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 259 | int retries = RETRY_MOUNT_ATTEMPTS; |
| 260 | struct timespec time_started = {0}; |
| 261 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 262 | memset(&data, 0, sizeof(data)); |
| 263 | data.real_blkdev = real_blkdev; |
| 264 | data.crypto_blkdev = crypto_blkdev; |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 265 | data.set_progress_properties = set_progress_properties; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 266 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 267 | LOG(DEBUG) << "Opening" << real_blkdev; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 268 | if ((data.realfd = open(real_blkdev, O_RDWR | O_CLOEXEC)) < 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 269 | PLOG(ERROR) << "Error opening real_blkdev " << real_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 270 | rc = -1; |
| 271 | goto errout; |
| 272 | } |
| 273 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 274 | LOG(DEBUG) << "Opening" << crypto_blkdev; |
Eric Biggers | 69520d2 | 2020-11-03 14:11:01 -0800 | [diff] [blame] | 275 | if ((data.cryptofd = open(crypto_blkdev, O_WRONLY | O_CLOEXEC)) < 0) { |
| 276 | PLOG(ERROR) << "Error opening crypto_blkdev " << crypto_blkdev << " for inplace encrypt"; |
| 277 | rc = -1; |
| 278 | goto errout; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 281 | if (setjmp(setjmp_env)) { // NOLINT |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 282 | LOG(ERROR) << "Reading ext4 extent caused an exception"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 283 | rc = -1; |
| 284 | goto errout; |
| 285 | } |
| 286 | |
| 287 | if (read_ext(data.realfd, 0) != 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 288 | LOG(ERROR) << "Failed to read ext4 extent"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 289 | rc = -1; |
| 290 | goto errout; |
| 291 | } |
| 292 | |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 293 | data.blocks_already_done = 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 294 | |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 295 | LOG(INFO) << "Encrypting ext4 filesystem in place..."; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 296 | |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 297 | data.tot_used_blocks = 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 298 | for (i = 0; i < aux_info.groups; ++i) { |
Eric Biggers | 7e70d69 | 2020-11-03 14:11:01 -0800 | [diff] [blame^] | 299 | if (aux_info.bg_desc[i].bg_flags & EXT4_BG_BLOCK_UNINIT) |
| 300 | data.tot_used_blocks += num_base_meta_blocks_in_group(i); |
| 301 | else |
| 302 | data.tot_used_blocks += |
| 303 | (num_blocks_in_group(i) - aux_info.bg_desc[i].bg_free_blocks_count); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | data.one_pct = data.tot_used_blocks / 100; |
| 307 | data.cur_pct = 0; |
| 308 | |
| 309 | if (clock_gettime(CLOCK_MONOTONIC, &time_started)) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 310 | LOG(WARNING) << "Error getting time at start"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 311 | // Note - continue anyway - we'll run with 0 |
| 312 | } |
| 313 | data.time_started = time_started.tv_sec; |
| 314 | data.remaining_time = -1; |
| 315 | |
| 316 | rc = encrypt_groups(&data); |
| 317 | if (rc) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 318 | LOG(ERROR) << "Error encrypting groups"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 319 | goto errout; |
| 320 | } |
| 321 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 322 | rc = 0; |
| 323 | |
| 324 | errout: |
| 325 | close(data.realfd); |
| 326 | close(data.cryptofd); |
| 327 | |
| 328 | return rc; |
| 329 | } |
| 330 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 331 | static void log_progress_f2fs(u64 block, bool completed) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 332 | // Precondition - if completed data = 0 else data != 0 |
| 333 | |
| 334 | // Track progress so we can skip logging blocks |
| 335 | static u64 last_block = (u64)-1; |
| 336 | |
| 337 | // Need to close existing 'Encrypting from' log? |
| 338 | if (completed || (last_block != (u64)-1 && block != last_block + 1)) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 339 | LOG(INFO) << "Encrypted to block " << last_block; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 340 | last_block = -1; |
| 341 | } |
| 342 | |
| 343 | // Need to start new 'Encrypting from' log? |
| 344 | if (!completed && (last_block == (u64)-1 || block != last_block + 1)) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 345 | LOG(INFO) << "Encrypting from block " << block; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | // Update offset |
| 349 | if (!completed) { |
| 350 | last_block = block; |
| 351 | } |
| 352 | } |
| 353 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 354 | static int encrypt_one_block_f2fs(u64 pos, void* data) { |
| 355 | struct encryptGroupsData* priv_dat = (struct encryptGroupsData*)data; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 356 | |
| 357 | priv_dat->blocks_already_done = pos - 1; |
| 358 | update_progress(priv_dat, 1); |
| 359 | |
| 360 | off64_t offset = pos * CRYPT_INPLACE_BUFSIZE; |
| 361 | |
| 362 | if (pread64(priv_dat->realfd, priv_dat->buffer, CRYPT_INPLACE_BUFSIZE, offset) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 363 | LOG(ERROR) << "Error reading real_blkdev " << priv_dat->crypto_blkdev |
| 364 | << " for f2fs inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 365 | return -1; |
| 366 | } |
| 367 | |
| 368 | if (pwrite64(priv_dat->cryptofd, priv_dat->buffer, CRYPT_INPLACE_BUFSIZE, offset) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 369 | LOG(ERROR) << "Error writing crypto_blkdev " << priv_dat->crypto_blkdev |
| 370 | << " for f2fs inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 371 | return -1; |
| 372 | } else { |
| 373 | log_progress_f2fs(pos, false); |
| 374 | } |
| 375 | |
| 376 | return 0; |
| 377 | } |
| 378 | |
Paul Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 379 | static int cryptfs_enable_inplace_f2fs(const char* crypto_blkdev, const char* real_blkdev, |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 380 | off64_t size, bool set_progress_properties) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 381 | struct encryptGroupsData data; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 382 | struct f2fs_info* f2fs_info = NULL; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 383 | int rc = ENABLE_INPLACE_ERR_OTHER; |
Denis Hsu | 1740eff | 2019-12-26 16:06:37 +0800 | [diff] [blame] | 384 | struct timespec time_started = {0}; |
| 385 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 386 | memset(&data, 0, sizeof(data)); |
| 387 | data.real_blkdev = real_blkdev; |
| 388 | data.crypto_blkdev = crypto_blkdev; |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 389 | data.set_progress_properties = set_progress_properties; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 390 | data.realfd = -1; |
| 391 | data.cryptofd = -1; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 392 | if ((data.realfd = open64(real_blkdev, O_RDWR | O_CLOEXEC)) < 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 393 | PLOG(ERROR) << "Error opening real_blkdev " << real_blkdev << " for f2fs inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 394 | goto errout; |
| 395 | } |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 396 | if ((data.cryptofd = open64(crypto_blkdev, O_WRONLY | O_CLOEXEC)) < 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 397 | PLOG(ERROR) << "Error opening crypto_blkdev " << crypto_blkdev |
| 398 | << " for f2fs inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 399 | goto errout; |
| 400 | } |
| 401 | |
| 402 | f2fs_info = generate_f2fs_info(data.realfd); |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 403 | if (!f2fs_info) goto errout; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 404 | |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 405 | data.blocks_already_done = 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 406 | |
| 407 | data.tot_used_blocks = get_num_blocks_used(f2fs_info); |
| 408 | |
| 409 | data.one_pct = data.tot_used_blocks / 100; |
| 410 | data.cur_pct = 0; |
Denis Hsu | 1740eff | 2019-12-26 16:06:37 +0800 | [diff] [blame] | 411 | if (clock_gettime(CLOCK_MONOTONIC, &time_started)) { |
| 412 | LOG(WARNING) << "Error getting time at start"; |
| 413 | // Note - continue anyway - we'll run with 0 |
| 414 | } |
| 415 | data.time_started = time_started.tv_sec; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 416 | data.remaining_time = -1; |
| 417 | |
Denis Hsu | 1740eff | 2019-12-26 16:06:37 +0800 | [diff] [blame] | 418 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 419 | data.buffer = (char*)malloc(f2fs_info->block_size); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 420 | if (!data.buffer) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 421 | LOG(ERROR) << "Failed to allocate crypto buffer"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 422 | goto errout; |
| 423 | } |
| 424 | |
| 425 | data.count = 0; |
| 426 | |
| 427 | /* Currently, this either runs to completion, or hits a nonrecoverable error */ |
| 428 | rc = run_on_used_blocks(data.blocks_already_done, f2fs_info, &encrypt_one_block_f2fs, &data); |
| 429 | |
| 430 | if (rc) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 431 | LOG(ERROR) << "Error in running over f2fs blocks"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 432 | rc = ENABLE_INPLACE_ERR_OTHER; |
| 433 | goto errout; |
| 434 | } |
| 435 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 436 | rc = 0; |
| 437 | |
| 438 | errout: |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 439 | if (rc) LOG(ERROR) << "Failed to encrypt f2fs filesystem on " << real_blkdev; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 440 | |
| 441 | log_progress_f2fs(0, true); |
Eric Biggers | b3ba087 | 2020-11-03 14:11:01 -0800 | [diff] [blame] | 442 | free_f2fs_info(f2fs_info); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 443 | free(data.buffer); |
| 444 | close(data.realfd); |
| 445 | close(data.cryptofd); |
| 446 | |
| 447 | return rc; |
| 448 | } |
| 449 | |
Paul Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 450 | static int cryptfs_enable_inplace_full(const char* crypto_blkdev, const char* real_blkdev, |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 451 | off64_t size, bool set_progress_properties) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 452 | int realfd, cryptofd; |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 453 | char* buf[CRYPT_INPLACE_BUFSIZE]; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 454 | int rc = ENABLE_INPLACE_ERR_OTHER; |
| 455 | off64_t numblocks, i, remainder; |
| 456 | off64_t one_pct, cur_pct, new_pct; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 457 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 458 | if ((realfd = open(real_blkdev, O_RDONLY | O_CLOEXEC)) < 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 459 | PLOG(ERROR) << "Error opening real_blkdev " << real_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 460 | return ENABLE_INPLACE_ERR_OTHER; |
| 461 | } |
| 462 | |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 463 | if ((cryptofd = open(crypto_blkdev, O_WRONLY | O_CLOEXEC)) < 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 464 | PLOG(ERROR) << "Error opening crypto_blkdev " << crypto_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 465 | close(realfd); |
Eric Biggers | 69520d2 | 2020-11-03 14:11:01 -0800 | [diff] [blame] | 466 | return ENABLE_INPLACE_ERR_OTHER; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 467 | } |
| 468 | |
| 469 | /* This is pretty much a simple loop of reading 4K, and writing 4K. |
| 470 | * The size passed in is the number of 512 byte sectors in the filesystem. |
| 471 | * So compute the number of whole 4K blocks we should read/write, |
| 472 | * and the remainder. |
| 473 | */ |
| 474 | numblocks = size / CRYPT_SECTORS_PER_BUFSIZE; |
| 475 | remainder = size % CRYPT_SECTORS_PER_BUFSIZE; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 476 | |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 477 | LOG(ERROR) << "Encrypting filesystem in place..."; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 478 | |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 479 | one_pct = numblocks / 100; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 480 | cur_pct = 0; |
| 481 | /* process the majority of the filesystem in blocks */ |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 482 | for (i = 0; i < numblocks; i++) { |
| 483 | new_pct = i / one_pct; |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 484 | if (set_progress_properties && new_pct > cur_pct) { |
Greg Kaiser | e0691cc | 2018-12-18 12:34:07 -0800 | [diff] [blame] | 485 | char property_buf[8]; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 486 | |
| 487 | cur_pct = new_pct; |
Greg Kaiser | e0691cc | 2018-12-18 12:34:07 -0800 | [diff] [blame] | 488 | snprintf(property_buf, sizeof(property_buf), "%" PRId64, cur_pct); |
| 489 | android::base::SetProperty("vold.encrypt_progress", property_buf); |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 490 | } |
| 491 | if (unix_read(realfd, buf, CRYPT_INPLACE_BUFSIZE) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 492 | PLOG(ERROR) << "Error reading real_blkdev " << real_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 493 | goto errout; |
| 494 | } |
| 495 | if (unix_write(cryptofd, buf, CRYPT_INPLACE_BUFSIZE) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 496 | PLOG(ERROR) << "Error writing crypto_blkdev " << crypto_blkdev << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 497 | goto errout; |
| 498 | } else { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 499 | LOG(DEBUG) << "Encrypted " << CRYPT_SECTORS_PER_BUFSIZE << " block at " |
| 500 | << i * CRYPT_SECTORS_PER_BUFSIZE; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 501 | } |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | /* Do any remaining sectors */ |
Paul Crowley | 14c8c07 | 2018-09-18 13:30:21 -0700 | [diff] [blame] | 505 | for (i = 0; i < remainder; i++) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 506 | if (unix_read(realfd, buf, CRYPT_SECTOR_SIZE) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 507 | LOG(ERROR) << "Error reading final sectors from real_blkdev " << real_blkdev |
| 508 | << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 509 | goto errout; |
| 510 | } |
| 511 | if (unix_write(cryptofd, buf, CRYPT_SECTOR_SIZE) <= 0) { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 512 | LOG(ERROR) << "Error writing final sectors to crypto_blkdev " << crypto_blkdev |
| 513 | << " for inplace encrypt"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 514 | goto errout; |
| 515 | } else { |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 516 | LOG(INFO) << "Encrypted 1 block at next location"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 517 | } |
| 518 | } |
| 519 | |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 520 | rc = 0; |
| 521 | |
| 522 | errout: |
| 523 | close(realfd); |
| 524 | close(cryptofd); |
| 525 | |
| 526 | return rc; |
| 527 | } |
| 528 | |
| 529 | /* returns on of the ENABLE_INPLACE_* return codes */ |
Paul Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 530 | int cryptfs_enable_inplace(const char* crypto_blkdev, const char* real_blkdev, off64_t size, |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 531 | bool set_progress_properties) { |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 532 | int rc_ext4, rc_f2fs, rc_full; |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 533 | LOG(DEBUG) << "cryptfs_enable_inplace(" << crypto_blkdev << ", " << real_blkdev << ", " << size |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 534 | << ", " << set_progress_properties << ")"; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 535 | |
| 536 | /* TODO: identify filesystem type. |
| 537 | * As is, cryptfs_enable_inplace_ext4 will fail on an f2fs partition, and |
| 538 | * then we will drop down to cryptfs_enable_inplace_f2fs. |
| 539 | * */ |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 540 | if ((rc_ext4 = cryptfs_enable_inplace_ext4(crypto_blkdev, real_blkdev, size, |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 541 | set_progress_properties)) == 0) { |
| 542 | LOG(DEBUG) << "cryptfs_enable_inplace_ext4 success"; |
| 543 | return 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 544 | } |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 545 | LOG(DEBUG) << "cryptfs_enable_inplace_ext4()=" << rc_ext4; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 546 | |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 547 | if ((rc_f2fs = cryptfs_enable_inplace_f2fs(crypto_blkdev, real_blkdev, size, |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 548 | set_progress_properties)) == 0) { |
| 549 | LOG(DEBUG) << "cryptfs_enable_inplace_f2fs success"; |
| 550 | return 0; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 551 | } |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 552 | LOG(DEBUG) << "cryptfs_enable_inplace_f2fs()=" << rc_f2fs; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 553 | |
Paul Crowley | 0fd2626 | 2018-01-30 09:48:19 -0800 | [diff] [blame] | 554 | rc_full = |
Eric Biggers | c01995e | 2020-11-03 14:11:00 -0800 | [diff] [blame] | 555 | cryptfs_enable_inplace_full(crypto_blkdev, real_blkdev, size, set_progress_properties); |
Paul Crowley | 772cc85 | 2018-02-01 09:53:27 -0800 | [diff] [blame] | 556 | LOG(DEBUG) << "cryptfs_enable_inplace_full()=" << rc_full; |
Paul Crowley | f71ace3 | 2016-06-02 11:01:19 -0700 | [diff] [blame] | 557 | return rc_full; |
| 558 | } |