Skip to content
Commit 5e0edf15 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Kader Bava
Browse files

f2fs, dm-default-key: should skip dm-default-key only for FBE blocks



GC moves data blocks when they require post_read_process. If the blocks
were encrypted by FBE, we had to skip another encryption by dm-default-key. [1]

Fsverity borrows the above IO flow when moving the blocks, but we missed that
we shoud move plain blocks if they're not FBE blocks, since dm-default-key
will use original LBA for DUN when decrypting the moved block like below.

1. GC w/o this patch (bi_crypt_skip=1)

FS: Verity non-FBE block   LBA#1                 ->    LBA#2
    (block A)
                           Encrypted_DUN(LBA#1)  ->    Encrypted_DUN(LBA#1)
                           |                           |
DM:                        Encrypted_DUN(LBA#1)        Encrypted_DUN(LBA#1)

When reading LBA#2, the block is decrypted by DUN#LAB#1, which is wrong.

2. GC w/ this patch (bi_crypt_skip=0)

FS: Verity non-FBE block   LBA#1                 ->    LBA#2
    (block A)
                           Decrypted(block A)    ->    Decrypted(block A)
                           |                           |
DM:                        Encrypted_DUN(LBA#1)        Encrypted_DUN(LBA#2)

[1] commit af4ef71b89c5 ("dm-default-key, f2fs, ICE: support dm-default-key with f2fs/ICE")

Change-Id: I0ed594749f4037a675e636bdb55a6a318960f44d
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
Signed-off-by: default avatarimprobir <ghosh_probir@yahoo.com>
parent b5a14a44
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment