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

refactor(target_arch): pass arch via feature flags instead #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kakoc
Copy link

@kakoc kakoc commented Sep 11, 2020

Related to: #102
It's not clear to me: should the new Arch enum be used anywhere now?

@@ -24,17 +24,17 @@ pub use writemem::WriteMemory;

lazy_static::lazy_static! {
pub static ref PAGE_SIZE: usize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };
#[cfg(target_arch="x86_64")]
#[cfg(feature="x86_64")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Ptrace can only work with the local arch, so using target_arch makes more sense to me. Also enabling the x86_64 feature on other archs won't compile, as libc won't jave a u_debugreg field for the libc::user struct.

@@ -1,5 +1,5 @@
// FIXME make this work on other systems too.
#![cfg(all(target_arch = "x86_64", target_os = "linux"))]
#![cfg(all(feature = "x86_64", target_os = "linux"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

headcrab_inject directly uses the rip and rsp fields of libc::user_regs, so it won't compile for other archs.

@bjorn3
Copy link
Contributor

bjorn3 commented Sep 11, 2020

headcrab_inject could be made to work with multiple archs, but that would likely require #87 first.

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