diff options
| author | klaar36 <klas.arvidsson@liu.se> | 2016-05-25 14:05:22 +0200 |
|---|---|---|
| committer | klaar36 <klas.arvidsson@liu.se> | 2016-05-25 14:05:22 +0200 |
| commit | 569371aca6667c0509a404d371a85e4fd5654731 (patch) | |
| tree | 7f5a6c316ad061ee417da0d96525c7dc3bb149fc /src | |
| parent | 9cb696c142769e29d4bac21475431d2c235a0ad4 (diff) | |
| parent | f03411fa9c4c8d47ba8ec1d200f57b6a10612852 (diff) | |
| download | pintos-rs-569371aca6667c0509a404d371a85e4fd5654731.tar.gz | |
Merge branch 'sc-bad-write-fix' into 'master'
Fixed sc-bad-write once again...
It seems that the BSS segment got larger than one page for some reason,
which caused the test to be useless as the boundary to nonmapped memory
were not located where the test thought. Now, it uses some linker script
magic to define the symbol _bss_end, the address of which is after the
end of the bss segment. This seems to be a fool-proof way of detecting
where the real boundary to unmapped memory is.
Signed-off-by: Filip Strömbäck <filip.stromback@liu.se>
See merge request !7
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/user/user.lds | 6 | ||||
| -rw-r--r-- | src/tests/filst/sc-bad-write.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/user/user.lds b/src/lib/user/user.lds index cc6d6c0..27ea4be 100644 --- a/src/lib/user/user.lds +++ b/src/lib/user/user.lds @@ -16,7 +16,11 @@ SECTIONS . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); .data : { *(.data) } - .bss : { *(.bss) } + .bss : { + *(.bss) + /* Get the end of the bss segment as a symbol linkable from C */ + _end_bss = .; + } /* Stabs debugging sections. */ .stab 0 : { *(.stab) } diff --git a/src/tests/filst/sc-bad-write.c b/src/tests/filst/sc-bad-write.c index 28e0409..4d04155 100644 --- a/src/tests/filst/sc-bad-write.c +++ b/src/tests/filst/sc-bad-write.c @@ -19,14 +19,14 @@ static inline void *pg_round_up (const void *va) { } /** - * A global variable that will give us an address in the BSS segment. + * External symbol which address is the first address after all data in the BSS segment. */ -int global = 3; +extern int _end_bss; void test_main(void) { // Get the addres of the first unmapped page in the system. - unsigned page = (unsigned)pg_round_up(&global); + unsigned page = (unsigned)pg_round_up(&_end_bss); // Reserve space for 4 parameters. unsigned base = page - sizeof(int) * 4; |
