diff options
Diffstat (limited to 'tests/dlext_test.cpp')
-rw-r--r-- | tests/dlext_test.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp index b702725a1..d078e500b 100644 --- a/tests/dlext_test.cpp +++ b/tests/dlext_test.cpp @@ -31,7 +31,6 @@ #include <android-base/test_utils.h> #include <sys/mman.h> -#include <sys/stat.h> #include <sys/types.h> #include <sys/vfs.h> #include <sys/wait.h> @@ -2047,11 +2046,6 @@ TEST(dlext, ns_anonymous) { -1, 0)); ASSERT_TRUE(reinterpret_cast<void*>(reserved_addr) != MAP_FAILED); - struct stat file_stat; - int ret = TEMP_FAILURE_RETRY(stat(private_library_absolute_path.c_str(), &file_stat)); - ASSERT_EQ(ret, 0) << "Failed to stat library"; - size_t file_size = file_stat.st_size; - for (const auto& rec : maps_to_copy) { uintptr_t offset = rec.addr_start - addr_start; size_t size = rec.addr_end - rec.addr_start; @@ -2059,11 +2053,7 @@ TEST(dlext, ns_anonymous) { void* map = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); ASSERT_TRUE(map != MAP_FAILED); - // Attempting the below memcpy from a portion of the map that is off the end of - // the backing file will cause the kernel to throw a SIGBUS - size_t _size = ::android::procinfo::MappedFileSize(rec.addr_start, rec.addr_end, - rec.offset, file_size); - memcpy(map, reinterpret_cast<void*>(rec.addr_start), _size); + memcpy(map, reinterpret_cast<void*>(rec.addr_start), size); mprotect(map, size, rec.perms); } |