From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1570660D07 for ; Mon, 19 Oct 2020 16:15:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 084AC2D98A for ; Mon, 19 Oct 2020 16:15:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E7B4A2D980 for ; Mon, 19 Oct 2020 16:15:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AAE4045E10 for ; Mon, 19 Oct 2020 16:15:26 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 19 Oct 2020 16:15:25 +0200 Message-Id: <20201019141525.5480-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.495 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] partially fix #3056: namespace vzdump tmpdir with vmid X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2020 14:15:28 -0000 this fixes an issue where a rogue running backup would upload the vm config of a later backup in a backup job instead now that directory gets deleted and the config is not available anymore we cannot really keep those directories around until the end of the backup job, since we temporarily save ct contents there, which could get large very fast Signed-off-by: Dominik Csapak --- PVE/VZDump.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index 542228d6..cdcb658f 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -769,10 +769,11 @@ sub exec_backup_task { $task->{vmtype} = $vmtype; + my $pid = $$; if ($opts->{tmpdir}) { - $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp$$"; + $task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp${pid}_$vmid/"; } elsif ($self->{opts}->{pbs}) { - $task->{tmpdir} = "/var/tmp/vzdumptmp$$"; #fixme + $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid"; } else { # dumpdir is posix? then use it as temporary dir my $info = get_mount_info($opts->{dumpdir}); @@ -780,7 +781,7 @@ sub exec_backup_task { grep ($_ eq $info->{fstype}, @posix_filesystems)) { $task->{tmpdir} = "$opts->{dumpdir}/$basename.tmp"; } else { - $task->{tmpdir} = "/var/tmp/vzdumptmp$$"; + $task->{tmpdir} = "/var/tmp/vzdumptmp${pid}_$vmid"; debugmsg ('info', "filesystem type on dumpdir is '$info->{fstype}' -" . "using $task->{tmpdir} for temporary files", $logfd); } -- 2.20.1