PKUOS - Pintos
Pintos source browser for PKU Operating System course
Functions
boundary.c File Reference
#include <inttypes.h>
#include <round.h>
#include <string.h>
#include "tests/userprog/boundary.h"
Include dependency graph for boundary.c:

Go to the source code of this file.

Functions

static char dst[8192] __attribute__ ((section(".testEndmem,\"aw\",@nobits#")))
 Utility function for tests that try to break system calls by passing them data that crosses from one virtual page to another. More...
 
void * get_boundary_area (void)
 Returns the beginning of a page. More...
 
char * copy_string_across_boundary (const char *src)
 Returns a copy of SRC split across the boundary between two pages. More...
 
void * get_bad_boundary (void)
 Returns an address that is invalid, but the preceding bytes are all valid (the highest address in the bss segment). More...
 

Function Documentation

◆ __attribute__()

static char dst[8192] __attribute__ ( (section(".testEndmem,\"aw\",@nobits#"))  )
static

Utility function for tests that try to break system calls by passing them data that crosses from one virtual page to another.

Together with statements in src/lib/user/user.lds, arranges for the following array to be at the very end of the .bss segment (needed for get_bad_boundary below).

◆ copy_string_across_boundary()

char * copy_string_across_boundary ( const char *  src)

Returns a copy of SRC split across the boundary between two pages.

Definition at line 29 of file boundary.c.

References get_boundary_area(), strlcpy(), and strlen().

Referenced by test_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 bss segment).

tests/userprog/boundary.h

Used to position information such that the first byte of the information is valid, but not all the information is valid.

Definition at line 42 of file boundary.c.

References ROUND_UP.

Referenced by test_main().

Here is the caller graph for this function:

◆ get_boundary_area()

void * get_boundary_area ( void  )

Returns the beginning of a page.

There are at least 2048 modifiable bytes on either side of the pointer returned.

Definition at line 18 of file boundary.c.

References ROUND_UP.

Referenced by copy_string_across_boundary(), and test_main().

Here is the caller graph for this function: