am 36f5a95b
: Merge "Get ANDROID_DATA dir from enviroment"
* commit '36f5a95b833db0b2a48e6ab2064716c58062ab3f': Get ANDROID_DATA dir from enviroment
This commit is contained in:
commit
61c62389e7
@ -40,7 +40,6 @@
|
|||||||
typedef int (*fn)(void);
|
typedef int (*fn)(void);
|
||||||
#define LIBNAME "libdlext_test.so"
|
#define LIBNAME "libdlext_test.so"
|
||||||
#define LIBSIZE 1024*1024 // how much address space to reserve for it
|
#define LIBSIZE 1024*1024 // how much address space to reserve for it
|
||||||
#define RELRO_FILE "/data/local/tmp/libdlext_test.relro"
|
|
||||||
|
|
||||||
|
|
||||||
class DlExtTest : public ::testing::Test {
|
class DlExtTest : public ::testing::Test {
|
||||||
@ -154,7 +153,11 @@ TEST_F(DlExtTest, RelroShareChildWrites) {
|
|||||||
extinfo.reserved_size = LIBSIZE;
|
extinfo.reserved_size = LIBSIZE;
|
||||||
|
|
||||||
int relro_fd;
|
int relro_fd;
|
||||||
relro_fd = open(RELRO_FILE, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
char relro_file[PATH_MAX];
|
||||||
|
const char* android_data = getenv("ANDROID_DATA");
|
||||||
|
ASSERT_TRUE(android_data != NULL);
|
||||||
|
snprintf(relro_file, sizeof(relro_file), "%s/local/tmp/libdlext_test.relro", android_data);
|
||||||
|
relro_fd = open(relro_file, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
extinfo.flags = ANDROID_DLEXT_RESERVED_ADDRESS | ANDROID_DLEXT_WRITE_RELRO;
|
extinfo.flags = ANDROID_DLEXT_RESERVED_ADDRESS | ANDROID_DLEXT_WRITE_RELRO;
|
||||||
ASSERT_NOERROR(relro_fd);
|
ASSERT_NOERROR(relro_fd);
|
||||||
extinfo.relro_fd = relro_fd;
|
extinfo.relro_fd = relro_fd;
|
||||||
@ -178,7 +181,7 @@ TEST_F(DlExtTest, RelroShareChildWrites) {
|
|||||||
ASSERT_TRUE(WIFEXITED(status));
|
ASSERT_TRUE(WIFEXITED(status));
|
||||||
ASSERT_EQ(0, WEXITSTATUS(status));
|
ASSERT_EQ(0, WEXITSTATUS(status));
|
||||||
|
|
||||||
relro_fd = open(RELRO_FILE, O_RDONLY);
|
relro_fd = open(relro_file, O_RDONLY);
|
||||||
ASSERT_NOERROR(relro_fd);
|
ASSERT_NOERROR(relro_fd);
|
||||||
extinfo.flags = ANDROID_DLEXT_RESERVED_ADDRESS | ANDROID_DLEXT_USE_RELRO;
|
extinfo.flags = ANDROID_DLEXT_RESERVED_ADDRESS | ANDROID_DLEXT_USE_RELRO;
|
||||||
extinfo.relro_fd = relro_fd;
|
extinfo.relro_fd = relro_fd;
|
||||||
|
Loading…
Reference in New Issue
Block a user