-
Notifications
You must be signed in to change notification settings - Fork 1.3k
executor: refactor struct cover_t #5809
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
base: master
Are you sure you want to change the base?
Conversation
b542ac4
to
5ea9679
Compare
Instead of having a single `void *data` pointer that is used to both allocate the memory and access the trace, split it into: - `void *alloc` of size `mmap_alloc_size`, used by mmap/munmap to manage the memory for kcov (may contain other data apart from the trace) - `void *trace` of size `trace_size`, used to access the collected trace Future patches will introduce other collection modes that may relocate the trace, so `alloc` and `trace` won't be interchangeable anymore. Also rename `trace_offset` to `trace_skip`. From now on, `XXX_offset` is the offset of `XXX` from the beginning of `alloc`, and `trace_skip` is the number of bytes to skip from the beginning of the trace to get to the actual PCs. I tried my best to not break Darwin and BSD, but I didn't test them.
5ea9679
to
25a61fe
Compare
FTR: there might happen some conflict between the changes from this PR and #5799 |
Thanks for the heads-up! I will incorporate their changes once they land. |
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.
Generally looks good to me.
void* alloc; | ||
// Buffer used by kcov for collecting PCs. | ||
char* trace; | ||
uint32 trace_size; |
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.
Let's keep only trace_end
.
cov->data_offset = is_kernel_64_bit ? sizeof(uint64_t) : sizeof(uint32_t); | ||
cov->trace_offset = 0; | ||
cov->trace = (char*)cov->alloc; | ||
// TODO(glider): trace size and may be different from mmap_alloc_size in the future. |
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 does not look useful as TODO in the code.
Instead of having a single void *data pointer that is used to both allocate the memory and access the trace, split it into:
Future patches will introduce other collection modes that may relocate the trace, so *alloc and *trace won't be interchangeable anymore.
I tried my best to not break Darwin and BSD, but I didn't test them.
Before sending a pull request, please review Contribution Guidelines:
https://github.com/google/syzkaller/blob/master/docs/contributing.md