Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
4lDO2
acid
Commits
6234cb4d
Verified
Commit
6234cb4d
authored
Jul 30, 2019
by
jD91mZM2
Browse files
Test ignoring signals
parent
05ba8757
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main.rs
View file @
6234cb4d
...
...
@@ -170,10 +170,16 @@ pub fn ptrace() -> Result<(), String> {
mov rsi, 10 // SIGUSR1
syscall
// aaand again
// and again
mov rax, 37 // SYS_KILL
syscall
// aaaaand yet again...
mov rax, 37 // SYS_KILL
syscall
mov rax, 158 // SYS_KILL
syscall
// Test behavior if tracer aborts a breakpoint before it's reached
call wait_for_a_while
...
...
@@ -366,6 +372,11 @@ pub fn ptrace() -> Result<(), String> {
}
}
println!
(
"Testing ignoring signals"
);
assert_eq!
(
e
(
e
(
next
(
&
mut
tracer
,
Flags
::
STOP_SIGNAL
))
?
.regs
.get_int
())
?
.rax
,
syscall
::
SYS_KILL
);
assert_eq!
(
e
(
e
(
next
(
&
mut
tracer
,
Flags
::
FLAG_IGNORE
|
Flags
::
STOP_PRE_SYSCALL
))
?
.regs
.get_int
())
?
.rax
,
syscall
::
SYS_YIELD
);
assert_eq!
(
e
(
e
(
next
(
&
mut
tracer
,
Flags
::
STOP_POST_SYSCALL
))
?
.regs
.get_int
())
?
.rax
,
0
);
// Activate nonblock
let
mut
tracer
=
e
(
tracer
.nonblocking
())
?
;
...
...
@@ -403,7 +414,7 @@ pub fn ptrace() -> Result<(), String> {
let
mut
tracer
=
e
(
tracer
.blocking
())
?
;
println!
(
"Checking exit syscall..."
);
e
(
next
(
&
mut
tracer
,
Flags
::
STOP_PRE_SYSCALL
|
Flags
::
FLAG_
SYSEMU
))
?
;
e
(
next
(
&
mut
tracer
,
Flags
::
STOP_PRE_SYSCALL
|
Flags
::
FLAG_
IGNORE
))
?
;
let
regs
=
e
(
tracer
.regs
.get_int
())
?
;
assert_eq!
(
regs
.rax
,
syscall
::
SYS_EXIT
);
assert_eq!
(
regs
.rdi
,
123
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment