Chromium Code Reviews| Index: tests/mmap/mmap_test.cc |
| diff --git a/tests/mmap/mmap_test.cc b/tests/mmap/mmap_test.cc |
| index 81598a969f64fbefe2108c30f795533ea7a17b48..9ea767b192963a340173f9948a35c9d8e22f4bb8 100644 |
| --- a/tests/mmap/mmap_test.cc |
| +++ b/tests/mmap/mmap_test.cc |
| @@ -269,21 +269,18 @@ bool test_mprotect() { |
| MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
| assert(addr != MAP_FAILED); |
| printf("mmap done\n"); |
| - /* |
| - * Change the protection to make the page unreadable. TODO(phosek): use |
| - * the mprotect() wrapper function once mprotect() is added to the IRT. |
| - */ |
| - int rc = NACL_SYSCALL(mprotect)(addr, map_size, PROT_NONE); |
| + /* Change the protection to make the page unreadable. */ |
| + int rc = mprotect(addr, map_size, PROT_NONE); |
|
Mark Seaborn
2012/10/14 00:47:16
For this to work, you'll need to add an mprotect()
Petr Hosek
2012/10/14 00:53:21
Undone.
|
| assert(rc == 0); |
| assert_addr_is_unreadable(addr); |
| assert_addr_is_unreadable(addr + 0x1000); |
| assert_addr_is_unreadable(addr + 0x10000); |
| /* Change the protection to make the page accessible again. */ |
| - rc = NACL_SYSCALL(mprotect)(addr, map_size, PROT_READ | PROT_WRITE); |
| + rc = mprotect(addr, map_size, PROT_READ | PROT_WRITE); |
| assert(rc == 0); |
| addr[0] = '5'; |
| /* Change the protection to make the page read-only. */ |
| - rc = NACL_SYSCALL(mprotect)(addr, map_size, PROT_READ); |
| + rc = mprotect(addr, map_size, PROT_READ); |
| assert(rc == 0); |
| assert_addr_is_unwritable(addr, '9'); |
| assert('5' == addr[0]); |
| @@ -315,12 +312,9 @@ bool test_mprotect_unmapped_memory() { |
| int rc = munmap(addr, map_size); |
| assert(rc == 0); |
| printf("munmap done\n"); |
| - /* |
| - * Change the protection to make the page unreadable. TODO(phosek): use |
| - * the mprotect() wrapper function once mprotect() is added to the IRT. |
| - */ |
| - rc = NACL_SYSCALL(mprotect)(addr, map_size, PROT_NONE); |
| - if (-EACCES == rc) { |
| + /* Change the protection to make the page unreadable. */ |
| + rc = mprotect(addr, map_size, PROT_NONE); |
| + if (-1 == rc && EACCES == errno) { |
| printf("mprotect good (failed as expected)\n"); |
| return true; |
| } |