Add more tests for system calls to deal with bad buffers given to read and write

This commit is contained in:
sBubshait
2024-11-13 16:21:12 +00:00
parent 8bcd0a467c
commit 30e49846b5
12 changed files with 103 additions and 27 deletions

View File

@@ -0,0 +1,17 @@
/* Passes a buffer to the write system call that starts in valid memory, but runs into kernel space.
The process must be terminated with -1 exit code.
*/
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle;
CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
write (handle, (char *) 0xbffffff0, 32);
fail ("should have exited with -1");
}