Compare commits
31 Commits
android-4.
...
android-4.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
081db840be | ||
![]() |
04583ce9b9 | ||
![]() |
abf91850f9 | ||
![]() |
806f3bd7aa | ||
![]() |
5fddfb8915 | ||
![]() |
5ab8d33aa6 | ||
![]() |
be662187aa | ||
![]() |
8e39d2f9f4 | ||
![]() |
fbefb252b0 | ||
![]() |
ac6bc31942 | ||
![]() |
f87684eea1 | ||
![]() |
303f08b439 | ||
![]() |
3fce401590 | ||
![]() |
e1fe52ccf1 | ||
![]() |
21f5927605 | ||
![]() |
33f6390064 | ||
![]() |
34c2a9fc37 | ||
![]() |
f4af911065 | ||
![]() |
7bfef355b1 | ||
![]() |
6d1f85dcdc | ||
![]() |
e0d1d4cf49 | ||
![]() |
6ebc24fcc3 | ||
![]() |
d3f9e8155b | ||
![]() |
5d0ad38c72 | ||
![]() |
ca2c6f75a8 | ||
![]() |
592c07084b | ||
![]() |
b30f6eb026 | ||
![]() |
9e6104d54f | ||
![]() |
05292dd65b | ||
![]() |
cc7f0dc5a1 | ||
![]() |
9a74e36f48 |
@@ -74,8 +74,10 @@ ENTRY(MEMCPY_BASE)
|
||||
cmp r2, #16
|
||||
blo .L_copy_less_than_16_unknown_align
|
||||
|
||||
cmp r2, #832
|
||||
bge .L_check_alignment
|
||||
// TODO: The aligned copy code is extremely slow copying some large
|
||||
// buffers so always go through the unaligned path for now.
|
||||
//cmp r2, #832
|
||||
//bge .L_check_alignment
|
||||
|
||||
.L_copy_unknown_alignment:
|
||||
// Unknown alignment of src and dst.
|
||||
|
@@ -79,7 +79,7 @@ ENTRY(MEMCPY_BASE)
|
||||
1: /* The main loop copies 64 bytes at a time */
|
||||
vld1.8 {d0 - d3}, [r1]!
|
||||
vld1.8 {d4 - d7}, [r1]!
|
||||
pld [r1, #(32*2)]
|
||||
pld [r1, #(32*8)]
|
||||
subs r2, r2, #64
|
||||
vst1.8 {d0 - d3}, [r0, :128]!
|
||||
vst1.8 {d4 - d7}, [r0, :128]!
|
||||
|
@@ -1852,9 +1852,7 @@ static void _remove_pidiface_info_locked(int pid);
|
||||
static struct resolv_pidiface_info* _get_pid_iface_info_locked(int pid);
|
||||
|
||||
/* remove a resolv_pidiface_info structure from _res_uidiface_list */
|
||||
static int _remove_uidiface_info_locked(int uid_start, int uid_end);
|
||||
/* check if a range [low,high] overlaps with any already existing ranges in the uid=>iface map*/
|
||||
static int _resolv_check_uid_range_overlap_locked(int uid_start, int uid_end);
|
||||
static int _remove_uidiface_info_locked(const char* iface, int uid_start, int uid_end);
|
||||
/* get a resolv_uidiface_info structure from _res_uidiface_list with a certain uid */
|
||||
static struct resolv_uidiface_info* _get_uid_iface_info_locked(int uid);
|
||||
|
||||
@@ -2433,11 +2431,11 @@ _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen)
|
||||
}
|
||||
|
||||
static int
|
||||
_remove_uidiface_info_locked(int uid_start, int uid_end) {
|
||||
_remove_uidiface_info_locked(const char* ifname, int uid_start, int uid_end) {
|
||||
struct resolv_uidiface_info* result = _res_uidiface_list.next;
|
||||
struct resolv_uidiface_info* prev = &_res_uidiface_list;
|
||||
|
||||
while (result != NULL && result->uid_start != uid_start && result->uid_end != uid_end) {
|
||||
while (result != NULL && !(result->uid_start == uid_start && result->uid_end == uid_end &&
|
||||
!strcmp(result->ifname, ifname))) {
|
||||
prev = result;
|
||||
result = result->next;
|
||||
}
|
||||
@@ -2461,19 +2459,6 @@ _get_uid_iface_info_locked(int uid)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
_resolv_check_uid_range_overlap_locked(int uid_start, int uid_end)
|
||||
{
|
||||
struct resolv_uidiface_info* cur = _res_uidiface_list.next;
|
||||
while (cur != NULL) {
|
||||
if (cur->uid_start <= uid_end && cur->uid_end >= uid_start) {
|
||||
return -1;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_resolv_clear_iface_uid_range_mapping()
|
||||
{
|
||||
@@ -2518,28 +2503,21 @@ _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
|
||||
return -1;
|
||||
}
|
||||
pthread_mutex_lock(&_res_uidiface_list_lock);
|
||||
//check that we aren't adding an overlapping range
|
||||
if (!_resolv_check_uid_range_overlap_locked(uid_start, uid_end)) {
|
||||
uidiface_info = calloc(sizeof(*uidiface_info), 1);
|
||||
if (uidiface_info) {
|
||||
uidiface_info->uid_start = uid_start;
|
||||
uidiface_info->uid_end = uid_end;
|
||||
int len = sizeof(uidiface_info->ifname);
|
||||
strncpy(uidiface_info->ifname, ifname, len - 1);
|
||||
uidiface_info->ifname[len - 1] = '\0';
|
||||
uidiface_info = calloc(sizeof(*uidiface_info), 1);
|
||||
if (uidiface_info) {
|
||||
uidiface_info->uid_start = uid_start;
|
||||
uidiface_info->uid_end = uid_end;
|
||||
int len = sizeof(uidiface_info->ifname);
|
||||
strncpy(uidiface_info->ifname, ifname, len - 1);
|
||||
uidiface_info->ifname[len - 1] = '\0';
|
||||
|
||||
uidiface_info->next = _res_uidiface_list.next;
|
||||
_res_uidiface_list.next = uidiface_info;
|
||||
uidiface_info->next = _res_uidiface_list.next;
|
||||
_res_uidiface_list.next = uidiface_info;
|
||||
|
||||
XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", uid_start, uid_end,
|
||||
ifname);
|
||||
} else {
|
||||
XLOG("_resolv_set_iface_for_uid_range failing calloc\n");
|
||||
rv = -1;
|
||||
errno = EINVAL;
|
||||
}
|
||||
XLOG("_resolv_set_iface_for_uid_range: [%d,%d], iface %s\n", uid_start, uid_end,
|
||||
ifname);
|
||||
} else {
|
||||
XLOG("_resolv_set_iface_for_uid_range range [%d,%d] overlaps\n", uid_start, uid_end);
|
||||
XLOG("_resolv_set_iface_for_uid_range failing calloc\n");
|
||||
rv = -1;
|
||||
errno = EINVAL;
|
||||
}
|
||||
@@ -2549,14 +2527,14 @@ _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
|
||||
}
|
||||
|
||||
int
|
||||
_resolv_clear_iface_for_uid_range(int uid_start, int uid_end)
|
||||
_resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end)
|
||||
{
|
||||
pthread_once(&_res_cache_once, _res_cache_init);
|
||||
pthread_mutex_lock(&_res_uidiface_list_lock);
|
||||
|
||||
int rv = _remove_uidiface_info_locked(uid_start, uid_end);
|
||||
int rv = _remove_uidiface_info_locked(ifname, uid_start, uid_end);
|
||||
|
||||
XLOG("_resolv_clear_iface_for_uid_range: [%d,%d]\n", uid_start, uid_end);
|
||||
XLOG("_resolv_clear_iface_for_uid_range: [%d,%d] iface %s\n", uid_start, uid_end, ifname);
|
||||
|
||||
pthread_mutex_unlock(&_res_uidiface_list_lock);
|
||||
|
||||
|
@@ -272,6 +272,15 @@ res_nsearch(res_state statp,
|
||||
(dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
|
||||
int done = 0;
|
||||
|
||||
/* Unfortunately we need to load interface info
|
||||
* (dns servers, search domains) before
|
||||
* the domain stuff is tried. Will have a better
|
||||
* fix after thread pools are used as this will
|
||||
* be loaded once for the thread instead of each
|
||||
* time a query is tried.
|
||||
*/
|
||||
_resolv_populate_res_for_iface(statp);
|
||||
|
||||
for (domain = (const char * const *)statp->dnsrch;
|
||||
*domain && !done;
|
||||
domain++) {
|
||||
|
@@ -79,13 +79,12 @@ extern void _resolv_clear_iface_pid_mapping();
|
||||
extern int _resolv_get_pids_associated_interface(int pid, char* buff, int buffLen);
|
||||
|
||||
|
||||
/** set a uid range to use the name servers of the specified interface
|
||||
* If [low,high] overlaps with an already existing rule -1 is returned */
|
||||
/** set a uid range to use the name servers of the specified interface */
|
||||
extern int _resolv_set_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
|
||||
|
||||
/* clear a uid range from being associated with an interface
|
||||
* If the range given is not mapped -1 is returned. */
|
||||
extern int _resolv_clear_iface_for_uid_range(int uid_start, int uid_end);
|
||||
/** Remove a mapping added by _resolv_set_iface_for_uid_range.
|
||||
* If no such rule exists -1 is returned. */
|
||||
extern int _resolv_clear_iface_for_uid_range(const char* ifname, int uid_start, int uid_end);
|
||||
|
||||
/* clear the entire mapping of uid ranges to interfaces. */
|
||||
extern void _resolv_clear_iface_uid_range_mapping();
|
||||
@@ -94,6 +93,7 @@ extern void _resolv_clear_iface_uid_range_mapping();
|
||||
* On error, -1 is returned.
|
||||
* If no interface is found, 0 is returned and buff is set to empty ('\0').
|
||||
* If an interface is found, the name is copied to buff and the length of the name is returned.
|
||||
* If there are multiple rules covering uid the most recently added rule will be returned.
|
||||
* Arguments: uid The uid to find an interface for
|
||||
* buff A buffer to copy the result to
|
||||
* buffLen Length of buff. An interface is at most IF_NAMESIZE in length */
|
||||
|
Binary file not shown.
@@ -122,13 +122,36 @@ include $(BUILD_NATIVE_TEST)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := bionic-unit-tests-static
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||
LOCAL_CFLAGS += $(test_c_flags)
|
||||
LOCAL_FORCE_STATIC_EXECUTABLE := true
|
||||
LOCAL_SRC_FILES := $(test_src_files)
|
||||
LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc bionic-unit-tests-unwind-test-impl
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := $(test_fortify_static_libraries)
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += libBionicTests
|
||||
LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
|
||||
include $(BUILD_NATIVE_TEST)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# We build the static unit tests as a library so they can be used both for
|
||||
# bionic-unit-tests-static and also as part of CTS.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libBionicTests
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||
LOCAL_CFLAGS += $(test_c_flags)
|
||||
LOCAL_SRC_FILES := $(test_src_files)
|
||||
LOCAL_CFLAGS += \
|
||||
-DGTEST_OS_LINUX_ANDROID \
|
||||
-DGTEST_HAS_STD_STRING \
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
bionic bionic/libstdc++/include \
|
||||
external/gtest/include \
|
||||
external/stlport/stlport \
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
$(test_fortify_static_libraries) \
|
||||
bionic-unit-tests-unwind-test-impl \
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Test library for the unit tests.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@@ -32,10 +32,10 @@ struct LocalPropertyTestState {
|
||||
LocalPropertyTestState(int nprops) : nprops(nprops), valid(false) {
|
||||
static const char prop_name_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_";
|
||||
|
||||
char dir_template[] = "/data/nativetest/prop-XXXXXX";
|
||||
char dir_template[] = "/data/local/tmp/prop-XXXXXX";
|
||||
char *dirname = mkdtemp(dir_template);
|
||||
if (!dirname) {
|
||||
perror("making temp file for test state failed (is /data/nativetest writable?)");
|
||||
perror("making temp file for test state failed (is /data/local/tmp writable?)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ TEST(statvfs, statvfs) {
|
||||
#endif
|
||||
|
||||
#if __BIONIC__
|
||||
ASSERT_EQ(0, statvfs("/data/data", &sb));
|
||||
ASSERT_EQ(0, statvfs("/data/local/tmp", &sb));
|
||||
ASSERT_NE(0U, sb.f_bfree);
|
||||
ASSERT_NE(0U, sb.f_ffree);
|
||||
ASSERT_NE(0U, sb.f_fsid);
|
||||
@@ -59,7 +59,7 @@ TEST(statvfs, fstatvfs) {
|
||||
#endif
|
||||
|
||||
#if __BIONIC__
|
||||
fd = open("/data/data", O_RDONLY);
|
||||
fd = open("/data/local/tmp", O_RDONLY);
|
||||
ASSERT_EQ(0, fstatvfs(fd, &sb));
|
||||
close(fd);
|
||||
ASSERT_NE(0U, sb.f_bfree);
|
||||
|
@@ -28,10 +28,10 @@ extern void *__system_property_area__;
|
||||
|
||||
struct LocalPropertyTestState {
|
||||
LocalPropertyTestState() : valid(false) {
|
||||
char dir_template[] = "/data/nativetest/prop-XXXXXX";
|
||||
char dir_template[] = "/data/local/tmp/prop-XXXXXX";
|
||||
char *dirname = mkdtemp(dir_template);
|
||||
if (!dirname) {
|
||||
perror("making temp file for test state failed (is /data/nativetest writable?)");
|
||||
perror("making temp file for test state failed (is /data/local/tmp writable?)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user