From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-backup-qemu v2 3/3] fix #2866: invalidate bitmap on crypt_mode change
Date: Fri, 24 Jul 2020 11:53:35 +0200 [thread overview]
Message-ID: <20200724095335.2869192-4-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20200724095335.2869192-1-f.gruenbichler@proxmox.com>
signed and plain backups share chunks, so bitmap reusal is okay for
those combinations. switching from encrypted to not encrypted or
vice-versa could have pretty fatal consequences - either referencing
plain-text chunks in 'encrypted' backups, or referencing encrypted
chunks in 'unencrypted' backups without still having the corresponding
keys..
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/backup.rs | 5 ++++-
src/commands.rs | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/backup.rs b/src/backup.rs
index dab1da0..9e3d66a 100644
--- a/src/backup.rs
+++ b/src/backup.rs
@@ -203,7 +203,10 @@ impl BackupTask {
size: u64,
) -> bool {
match self.last_manifest() {
- Some(ref manifest) => check_last_incremental_csum(manifest.clone(), &device_name, size),
+ Some(ref manifest) => {
+ check_last_incremental_csum(manifest.clone(), &device_name, size)
+ && check_last_encryption_mode(manifest.clone(), &device_name, self.crypt_mode)
+ },
None => false,
}
}
diff --git a/src/commands.rs b/src/commands.rs
index e2584ab..c59ee1b 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -94,6 +94,29 @@ pub(crate) fn check_last_incremental_csum(
}
}
+pub(crate) fn check_last_encryption_mode(
+ manifest: Arc<BackupManifest>,
+ device_name: &str,
+ crypt_mode: CryptMode,
+) -> bool {
+ match manifest.lookup_file_info(&archive_name(device_name)) {
+ Ok(file) => {
+ match file.crypt_mode {
+ CryptMode::Encrypt => match crypt_mode {
+ CryptMode::Encrypt => true,
+ _ => false,
+ },
+ CryptMode::SignOnly | CryptMode::None => match crypt_mode {
+ CryptMode::Encrypt => false,
+ _ => true,
+ },
+ }
+ },
+ _ => false,
+ }
+}
+
+
pub(crate) async fn register_image(
client: Arc<BackupWriter>,
crypt_config: Option<Arc<CryptConfig>>,
--
2.20.1
next prev parent reply other threads:[~2020-07-24 9:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 9:53 [pve-devel] [PATCH proxmox-backup-qemu v2 0/3] " Fabian Grünbichler
2020-07-24 9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 1/3] refactor incremental checks Fabian Grünbichler
2020-07-24 9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 2/3] add archive_name helper Fabian Grünbichler
2020-07-24 9:53 ` Fabian Grünbichler [this message]
2020-08-13 7:35 ` [pve-devel] applied: [PATCH proxmox-backup-qemu v2 0/3] fix #2866: invalidate bitmap on crypt_mode change Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200724095335.2869192-4-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox