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

Fix the build #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: test

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
Copy link
Author

Choose a reason for hiding this comment

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

This means for PRs it doesn't build both the PR and the push, only the PR


env:
CARGO_TERM_COLOR: always
Expand Down
4 changes: 2 additions & 2 deletions src/ptrace/mock_ptrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ impl Tracer for MockPtrace {

fn get_ptrace(
&mut self,
data_ptr: *mut from_c::ptrace_syscall_info,
data_ptr: *mut from_c::struct_ptrace_syscall_info,
) -> Result<GetPtraceInfo, TraceError> {
// safety: mock_ptrace is used only in fuzz-testing of the library, not at production build
let slice = unsafe {
std::slice::from_raw_parts_mut(
data_ptr as *mut u8,
mem::size_of::<from_c::ptrace_syscall_info>(),
mem::size_of::<from_c::struct_ptrace_syscall_info>(),
)
};

Expand Down
2 changes: 1 addition & 1 deletion src/ptrace/syscall_ptrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Tracer for SyscallPtrace {

let ret_bytes = unsafe {
libc::ptrace(
from_c::PTRACE_GET_SYSCALL_INFO,
from_c::__ptrace_request_PTRACE_GET_SYSCALL_INFO,
libc::pid_t::from(Pid::from_raw(self.current_pid as i32)),
mem::size_of::<from_c::ptrace_syscall_info>(),
data_ptr,
Expand Down
34 changes: 33 additions & 1 deletion src/wrapper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
// Tracing
#include <linux/ptrace.h>
#include <sys/ptrace.h>

// From strace
# if defined HAVE_STRUCT_PTRACE_SYSCALL_INFO
typedef struct ptrace_syscall_info struct_ptrace_syscall_info;
# elif defined HAVE_STRUCT___PTRACE_SYSCALL_INFO
typedef struct __ptrace_syscall_info struct_ptrace_syscall_info;
# else
#include <stdint.h>
struct ptrace_syscall_info {
uint8_t op;
uint8_t pad[3];
uint32_t arch;
uint64_t instruction_pointer;
uint64_t stack_pointer;
union {
struct {
uint64_t nr;
uint64_t args[6];
} entry;
struct {
int64_t rval;
uint8_t is_error;
} exit;
struct {
uint64_t nr;
uint64_t args[6];
uint32_t ret_data;
} seccomp;
};
};
typedef struct ptrace_syscall_info struct_ptrace_syscall_info;
# endif

// Syscalls
#include <sys/utsname.h>
Expand Down