Sitelet https://github.com/DiscUtils/DiscUtils/pull/48
Skip to content

fix LVM2 creation_time > DateTime.MaxValue - #48

Merged
LordMike merged 1 commit into
DiscUtils:masterfrom
ahdde:lvm2
Jul 20, 2017
Merged

LordMike merged 1 commit into
DiscUtils:masterfrom
ahdde:lvm2

Conversation

@zivillian

Copy link
Copy Markdown
Contributor

The BitDefender GravityZone Virtual Disk contains an LVM2 which has an invalid creation time. This PR adds a check against DateTime.MaxValue to prevent an exception for this case.

swap { ...
creation_time = 13815016539583152127
} 
root { ...
creation_time = 9268243417079996778
} ...
# Generated by LVM2 version 2.02.145(2) (2016-03-04): Tue Mar 15 10:18:18 2016
...
creation_host = "rescuecd"	# Linux rescuecd 4.4.5-gentoo-x86 #1 SMP Fri Mar 11 13:59:43 UTC 2016 i686
...

…side BitDefender GravityZone (LVM2 2.02.145(2) (2016-03-04) on 4.4.5-gentoo-x86))
@LordMike

Copy link
Copy Markdown
Member

Note: I've scheduled a rebuild. Nuget timed out.

@LordMike

Copy link
Copy Markdown
Member

@zivillian what is the exact value of the LVM2 volume in Bitdefenders case?

@zivillian

Copy link
Copy Markdown
Contributor Author

I've attached the raw metadata as read from the disk:
metadata.txt

The relevant part part was already quoted in the initial description.

@LordMike

Copy link
Copy Markdown
Member

Those are completely insane times. I'm looking at my own LVM setup currently, and as seen by lvmdump, I have times like:

			creation_time = 1484343074	# 2017-01-13 22:31:14 +0100
			creation_time = 1484343076	# 2017-01-13 22:31:16 +0100
			creation_time = 1484343082	# 2017-01-13 22:31:22 +0100

Would it be possible for you to double check, and run lvs or similar on the gravity zone host, to check if LVM's own tools are failing with this?

Sidenote: The LVM header is all text .. ? .. Damn.. Let's hope it's always newline seperated...

@zivillian

Copy link
Copy Markdown
Contributor Author

I don't have the credentials for this image, but I've attached the disk to an ubuntu 16.04 host and ran vgcfgbackup. This replaced one of the two timestamps by Int64.MaxValue. I guess, that the lvm was created by a broken version, but I wasn't able to find a specific patch or fix at the lvm2 repository.
ubuntu1604.txt

@LordMike

Copy link
Copy Markdown
Member

I've been reading some of the LVM2 tools code, and from what I gather, they'll just use the invalid time as is. They'll read it into an uint64, and then write it back out as is.

If they ever use it for display, they'll get stuff like (null).

Example C code:

#include <stdio.h>
#include <time.h>
#include <stdint.h>

int main ()
{
   uint64_t curtime = 9223372036854775807;

   printf("Current time = %s", ctime(&curtime));

   return(0);
}

It prints: Current time = (null)

@LordMike
LordMike merged commit 43038f1 into DiscUtils:master Jul 20, 2017
@zivillian
zivillian deleted the lvm2 branch July 22, 2017 12:24
LordMike added a commit that referenced this pull request Aug 16, 2017
Includes PRs:
#17, #18, #21, #22, #23, #27, #30, #31, #33, #34, #35, #36, #38, #39, #40, #41, #48, #51, #52, #55, #60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants