PKUOS - Pintos
Pintos source browser for PKU Operating System course
src
tests
userprog
exec-bound-2.c
Go to the documentation of this file.
1
/** Invokes an exec system call with the exec string pointer argument
2
positioned such that only its first byte is valid memory (bytes 1-3
3
of the pointer are invalid). Must kill process. */
4
5
#include <
syscall-nr.h
>
6
#include "
tests/userprog/boundary.h
"
7
#include "
tests/lib.h
"
8
#include "
tests/main.h
"
9
10
void
11
test_main
(
void
)
12
{
13
char
*p =
get_bad_boundary
() - 5;
14
*((
int
*) p) =
SYS_EXEC
;
15
p[4] =
'!'
;
16
17
/* Invoke the system call. */
18
asm
volatile
(
"movl %0, %%esp; int $0x30"
: :
"g"
(p));
19
fail
(
"should have killed process"
);
20
}
get_bad_boundary
void * get_bad_boundary(void)
Returns an address that is invalid, but the preceding bytes are all valid (the highest address in the...
Definition:
boundary.c:42
boundary.h
test_main
void test_main(void)
Invokes an exec system call with the exec string pointer argument positioned such that only its first...
Definition:
exec-bound-2.c:11
fail
void fail(const char *format,...)
Definition:
lib.c:40
lib.h
main.h
syscall-nr.h
SYS_EXEC
@ SYS_EXEC
Start another process.
Definition:
syscall-nr.h:10
Generated on Thu Nov 4 2021 19:31:01 for PKUOS - Pintos by
1.9.2