-
Notifications
You must be signed in to change notification settings - Fork 10
Improve restore error handling #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve restore error handling #106
Conversation
compress.c
Outdated
| ret = _write(fd, &dst_len, sizeof(dst_len)); | ||
| if (ret != sizeof(dst_len)) | ||
| { | ||
| fprintf(stderr, "%s() write dst_len failed: %d\n", __func__, ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use err() when you write to stderr in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
memcr.c
Outdated
|
|
||
| #ifdef CHECKSUM_MD5 | ||
| if (checksum && ret > 0) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part is already in pull request 105, please rebase once it is merged
| return -1; | ||
| } | ||
|
|
||
| dumped_vm_size -= vmr->len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what case dumped_vm_size helps with? is checking control sum for each vmr insufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this useful to limit the amount of memory returned back to PID. In case of corruption/hack od dump file, memcr can try to return to PID more than platform can stand causing OOM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The control sum is verified only after the memory is returned to the PID, which means the system may already be affected by excessive data written to the PID's virtual memory
memcr.c
Outdated
|
|
||
| ret = dump_write(fd, vmr, sizeof(struct vm_region)); | ||
| if (ret != sizeof(struct vm_region)) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put the opening brace at the end of "if" line - as commented in previous commit
compress.c
Outdated
|
|
||
| ret = _write(fd, dst, dst_len); | ||
| if (ret != dst_len) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put the opening brace at the end of "if" line - as commented in previous commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
acfcd6a to
6018d8f
Compare
|
It would be good to add an error print as well on read ail in libencrypt.c: lib__read() |
6018d8f to
be7335c
Compare
Err log added here as well |
libencrypt.c
Outdated
|
|
||
| if (!cipher) | ||
| if (!cipher) { | ||
| err("cipher not initialized\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not an error, !cipher here means that lib__read() executes but encryption was not enabled with -e opt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, removed this change as not needed
libencrypt.c
Outdated
|
|
||
| if (!cipher) | ||
| if (!cipher) { | ||
| err("cipher not initialized\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
* Log what failed and for which VM * Kill PID on error * Verify restored VM size
be7335c to
b66c271
Compare
No description provided.