Merge "Replace bx lr with update of pc from the stack."
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index dbdb180..e260e97 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -87,6 +87,7 @@
     // We can only use const static allocated string for mapped region name, as Android kernel
     // uses the string pointer directly when dumping /proc/pid/maps.
     prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ss.ss_sp, ss.ss_size, "thread signal stack");
+    prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, stack_base, PAGE_SIZE, "thread signal stack guard page");
   }
 }
 
@@ -140,6 +141,7 @@
     munmap(space, mmap_size);
     return NULL;
   }
+  prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, space, stack_guard_size, "thread stack guard page");
 
   return space;
 }
diff --git a/libc/dns/net/gethnamaddr.c b/libc/dns/net/gethnamaddr.c
index 8f5800a..42f0d0a 100644
--- a/libc/dns/net/gethnamaddr.c
+++ b/libc/dns/net/gethnamaddr.c
@@ -640,6 +640,9 @@
 		ptr += size;
 	}
 
+	// Fix alignment after variable-length data.
+	ptr = (char*)ALIGN(ptr);
+
 	int aliases_len = ((int)(aliases - aliases_ptrs) + 1) * sizeof(*hp->h_aliases);
 	if (ptr + aliases_len > hbuf_end) {
 		goto nospc;
@@ -674,6 +677,9 @@
 		ptr += size;
 	}
 
+	// Fix alignment after variable-length data.
+	ptr = (char*)ALIGN(ptr);
+
 	int addrs_len = ((int)(addr_p - addr_ptrs) + 1) * sizeof(*hp->h_addr_list);
 	if (ptr + addrs_len > hbuf_end) {
 		goto nospc;
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 04613f4..7df8b60 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -520,6 +520,11 @@
 #include <android/api-level.h>
 
 /* glibc compatibility. */
+#if __POSIX_VISIBLE >= 200809
+#define __USE_ISOC99 1
+#define __USE_XOPEN2K 1
+#define __USE_XOPEN2K8 1
+#endif
 #if __LP64__
 #define __WORDSIZE 64
 #else