X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Ftests%2Fuserprog%2Fsc-boundary-3.c;fp=src%2Ftests%2Fuserprog%2Fsc-boundary-3.c;h=b2e24ca4ddcf846d8c07325b42d91f1a3e7ea84a;hp=0000000000000000000000000000000000000000;hb=16c7d34d02045bc7e6165a13c549a7968e074d4b;hpb=bffccc54acc0560186b8c38bc4a66897de5158eb diff --git a/src/tests/userprog/sc-boundary-3.c b/src/tests/userprog/sc-boundary-3.c new file mode 100644 index 0000000..b2e24ca --- /dev/null +++ b/src/tests/userprog/sc-boundary-3.c @@ -0,0 +1,20 @@ +/* Invokes a system call with the system call number positioned + such that its first byte is valid but the remaining bytes of + the number are in invalid memory. Must kill process. */ + +#include +#include "tests/userprog/boundary.h" +#include "tests/lib.h" +#include "tests/main.h" + +void +test_main (void) +{ + char *p = get_bad_boundary (); + p--; + *p = 100; + + /* Invoke the system call. */ + asm volatile ("movl %0, %%esp; int $0x30" : : "g" (p)); + fail ("should have killed process"); +}