Merge "Update to android-mainline kernel headers v5.4."
diff --git a/libc/Android.bp b/libc/Android.bp
index 26cd3a3..ae5f39e 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -20,13 +20,8 @@
     "stdlib/exit.c",
 ]
 
-// Various kinds of cruft.
+// off64_t/time64_t support on LP32.
 // ========================================================
-libc_common_src_files += [
-    "bionic/ndk_cruft.cpp",
-    "bionic/ndk_cruft_data.cpp",
-]
-
 libc_common_src_files_32 = [
     "bionic/legacy_32_bit_support.cpp",
     "bionic/time64.c",
@@ -1609,6 +1604,8 @@
         "bionic/malloc_common_dynamic.cpp",
         "bionic/malloc_heapprofd.cpp",
         "bionic/malloc_limit.cpp",
+        "bionic/ndk_cruft.cpp",
+        "bionic/ndk_cruft_data.cpp",
         "bionic/NetdClient.cpp",
         "arch-common/bionic/crtend_so.S",
     ],
diff --git a/libc/NOTICE b/libc/NOTICE
index 63da17c..e2afdbf 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -1030,7 +1030,7 @@
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/libc/arch-x86/generic/string/wmemset.c b/libc/arch-x86/generic/string/wmemset.c
index eff533c..35d489f 100644
--- a/libc/arch-x86/generic/string/wmemset.c
+++ b/libc/arch-x86/generic/string/wmemset.c
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/libc/bionic/bionic_allocator.cpp b/libc/bionic/bionic_allocator.cpp
index 168d6ba..7fd7067 100644
--- a/libc/bionic/bionic_allocator.cpp
+++ b/libc/bionic/bionic_allocator.cpp
@@ -40,8 +40,8 @@
 #include <async_safe/log.h>
 #include <async_safe/CHECK.h>
 
+#include "platform/bionic/page.h"
 #include "private/bionic_macros.h"
-#include "private/bionic_page.h"
 
 //
 // BionicAllocator is a general purpose allocator designed to provide the same
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 5c1d27e..d2a5334 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -39,11 +39,11 @@
 #include "libc_init_common.h"
 #include "pthread_internal.h"
 
+#include "platform/bionic/page.h"
 #include "private/bionic_call_ifunc_resolver.h"
 #include "private/bionic_elf_tls.h"
 #include "private/bionic_globals.h"
 #include "private/bionic_macros.h"
-#include "private/bionic_page.h"
 #include "private/bionic_tls.h"
 #include "private/KernelArgumentBlock.h"
 
diff --git a/libc/private/bionic_page.h b/libc/platform/bionic/page.h
similarity index 92%
rename from libc/private/bionic_page.h
rename to libc/platform/bionic/page.h
index 0beb708..d063a98 100644
--- a/libc/private/bionic_page.h
+++ b/libc/platform/bionic/page.h
@@ -14,8 +14,7 @@
  * limitations under the License.
  */
 
-#ifndef _BIONIC_PAGE_H_
-#define _BIONIC_PAGE_H_
+#pragma once
 
 // Get PAGE_SIZE and PAGE_MASK.
 #include <sys/user.h>
@@ -29,5 +28,3 @@
 // Returns the address of the next page after address 'x', unless 'x' is
 // itself at the start of a page.
 #define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
-
-#endif // _BIONIC_PAGE_H_
diff --git a/libc/private/CFIShadow.h b/libc/private/CFIShadow.h
index 1423d86..84fbea5 100644
--- a/libc/private/CFIShadow.h
+++ b/libc/private/CFIShadow.h
@@ -19,7 +19,7 @@
 
 #include <stdint.h>
 
-#include "private/bionic_page.h"
+#include "platform/bionic/page.h"
 #include "private/bionic_macros.h"
 
 constexpr unsigned kLibraryAlignmentBits = 18;
diff --git a/linker/linker.cpp b/linker/linker.cpp
index e09b2a4..2f52327 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -95,7 +95,7 @@
 static const char* const kLdConfigFilePath = "/system/etc/ld.config.txt";
 static const char* const kLdConfigVndkLiteFilePath = "/system/etc/ld.config.vndk_lite.txt";
 
-static const char* const kLdGeneratedConfigFilePath = "/dev/linkerconfig/ld.config.txt";
+static const char* const kLdGeneratedConfigFilePath = "/linkerconfig/ld.config.txt";
 
 #if defined(__LP64__)
 static const char* const kSystemLibDir        = "/system/lib64";
diff --git a/linker/linker.h b/linker/linker.h
index 89390b3..789640c 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "private/bionic_page.h"
+#include "platform/bionic/page.h"
 #include "linked_list.h"
 #include "linker_common_types.h"
 #include "linker_logger.h"
diff --git a/linker/linker_cfi.cpp b/linker/linker_cfi.cpp
index 782ebc6..435bb1a 100644
--- a/linker/linker_cfi.cpp
+++ b/linker/linker_cfi.cpp
@@ -30,7 +30,7 @@
 
 #include "linker_debug.h"
 #include "linker_globals.h"
-#include "private/bionic_page.h"
+#include "platform/bionic/page.h"
 
 #include <sys/mman.h>
 #include <sys/prctl.h>
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index d508077..05bba05 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -280,8 +280,7 @@
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
   if (!is_debuggable_build()) {
-    // LD_CONFIG_FILE is not supported on user build
-    return;
+    GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
   std::string helper = GetTestlibRoot() +
       "/ld_config_test_helper/ld_config_test_helper";
@@ -303,8 +302,7 @@
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
   if (!is_debuggable_build()) {
-    // LD_CONFIG_FILE is not supported on user build
-    return;
+    GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
   std::string helper = GetTestlibRoot() +
       "/ld_config_test_helper/ld_config_test_helper";
@@ -328,14 +326,15 @@
   if (getuid() == 0) {
     // when executed from the shell (e.g. not as part of CTS), skip the test.
     // This test is only for CTS.
-    return;
+    GTEST_SKIP() << "test is not supported with root uid";
   }
   if (is_debuggable_build()) {
-    // Skip the test for non production devices
-    return;
+    GTEST_SKIP() << "test is not supported on debuggable build";
   }
 
-  std::string error_message = "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() + "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" not found\n";
+  std::string error_message = std::string("CANNOT LINK EXECUTABLE ") +
+      "\"" + GetTestlibRoot() + "/ld_config_test_helper/ld_config_test_helper\": " +
+      "library \"ld_config_test_helper_lib1.so\" not found: needed by main executable\n";
   std::string helper = GetTestlibRoot() +
       "/ld_config_test_helper/ld_config_test_helper";
   TemporaryFile config_file;
diff --git a/tests/sys_ptrace_test.cpp b/tests/sys_ptrace_test.cpp
index 15e9a24..f17f80c 100644
--- a/tests/sys_ptrace_test.cpp
+++ b/tests/sys_ptrace_test.cpp
@@ -92,8 +92,14 @@
                        feature == HwFeature::Watchpoint ? NT_ARM_HW_WATCH : NT_ARM_HW_BREAK, &iov);
   if (result == -1) {
     ASSERT_EQ(EINVAL, errno);
+    GTEST_SKIP() << "Hardware support missing";
+  } else if ((dreg_state.dbg_info & 0xff) == 0) {
+    if (feature == HwFeature::Watchpoint) {
+      GTEST_SKIP() << "Kernel reports zero hardware watchpoints";
+    } else {
+      GTEST_SKIP() << "Kernel reports zero hardware breakpoints";
+    }
   }
-  if ((dreg_state.dbg_info & 0xff) == 0) GTEST_SKIP() << "hardware support missing";
 #else
   // We assume watchpoints and breakpoints are always supported on x86.
   UNUSED(child);