-
Notifications
You must be signed in to change notification settings - Fork 3
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
Kernel object improvements #162
base: main
Are you sure you want to change the base?
Conversation
https://blogs.oracle.com/linux/post/whats-inside-a-linux-kernel-core-dump was invaluable to understand where to read the kernel ASLR offset from. Test Plan ========= Checked a couple of symbols on 3 different machines (Ubuntu, RHEL, Fedora) and the KASLR offset was calculated correctly. Everything worked on x86 and arm64 too.
d928f58
to
7c62d67
Compare
Fixes #116 |
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 LGTM, just one question
@@ -4,9 +4,17 @@ use std::fmt::Display; | |||
use std::fmt::Formatter; | |||
use std::str; | |||
|
|||
use anyhow::Result; |
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.
@@ -65,7 +58,7 @@ impl ObjectFile { | |||
|
|||
/// Returns an identifier for the executable using the first 8 bytes of the build id. | |||
pub fn id(&self) -> Result<ExecutableId> { | |||
Ok(u64::from_ne_bytes(self.build_id.data[..8].try_into()?)) | |||
self.build_id.id() |
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.
noice
let mut data = Vec::new(); | ||
file.read_to_end(&mut data)?; | ||
|
||
parse_gnu_build_id_from_notes(&data) |
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.
Looking at it, would it make sense to pass the reader directly to the parse_gnu_build_id_from_notes()
? Or does the iterator not work on readers?
let mut data = Vec::new(); | ||
file.read_to_end(&mut data)?; | ||
|
||
parse_gnu_build_id_from_notes(&data) |
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
See individual commits but the general one
https://blogs.oracle.com/linux/post/whats-inside-a-linux-kernel-core-dump
was invaluable to understand where to read the kernel ASLR offset from.
Test Plan
Checked a couple of symbols on 3 different machines (Ubuntu, RHEL,
Fedora) and the KASLR offset was calculated correctly. Everything worked
on x86 and arm64 too.