Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

javierhonduco
Copy link
Owner

@javierhonduco javierhonduco commented Feb 11, 2025

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.

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.
@javierhonduco javierhonduco force-pushed the kernel-object-improvements branch from d928f58 to 7c62d67 Compare February 11, 2025 16:41
@javierhonduco
Copy link
Owner Author

Fixes #116

Copy link
Collaborator

@rdelfin rdelfin left a 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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bull_bull_derivative

(this is actually fine I just needed an excuse to use the gif)

@@ -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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice

Comment on lines +75 to +78
let mut data = Vec::new();
file.read_to_end(&mut data)?;

parse_gnu_build_id_from_notes(&data)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

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