[automerger skipped] Don't test pw_shell for old vendor images am: 4785c13549 -s ours

am skip reason: Change-Id Ie485bd019b3826e71ad19131effcbb002f888d52 with SHA-1 b9fa04d805 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/12133446

Change-Id: I456220a914c602b5fc6b88dccf8dcfbcae0a3f8c
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 11d9fe6..b4223ea 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,8 +1,9 @@
-[Hook Scripts]
-notice = tools/update_notice.sh
-
 [Builtin Hooks]
 clang_format = true
 
 [Builtin Hooks Options]
 clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
+
+[Hook Scripts]
+aosp_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "."
+notice = tools/update_notice.sh
diff --git a/apex/Android.bp b/apex/Android.bp
index f62f930..ce9d82b 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -28,9 +28,47 @@
     ],
     multilib: {
         both: {
-            binaries: ["linker"],
+            binaries: [
+                "crash_dump",
+                "linker",
+            ],
         },
     },
     key: "com.android.runtime.key",
     certificate: ":com.android.runtime.certificate",
 }
+
+sdk {
+    name: "runtime-module-sdk",
+    defaults: ["linux_bionic_supported"],
+
+    native_header_libs: [
+        "bionic_libc_platform_headers",
+        "libc_headers",
+    ],
+    native_shared_libs: [
+        "libc",
+        "libdl",
+        "libdl_android",
+        "libm",
+    ],
+    native_static_libs: [
+        "libasync_safe",
+    ],
+    native_objects: [
+        "crtbegin_dynamic",
+        "crtbegin_so",
+        "crtend_android",
+        "crtend_so",
+    ],
+}
+
+module_exports {
+    name: "runtime-module-host-exports",
+    defaults: ["linux_bionic_supported"],
+    device_supported: false,
+
+    native_binaries: [
+        "linker",
+    ],
+}
diff --git a/benchmarks/linker_relocation/regen/gen_bench.py b/benchmarks/linker_relocation/regen/gen_bench.py
index 61156ce..7482319 100755
--- a/benchmarks/linker_relocation/regen/gen_bench.py
+++ b/benchmarks/linker_relocation/regen/gen_bench.py
@@ -62,7 +62,7 @@
 ])
 
 # Skip these symbols so the benchmark runs on multiple C libraries (glibc, Bionic, musl).
-kBionicSymbolBlacklist: Set[str] = set([
+kBionicIgnoredSymbols: Set[str] = set([
     '__FD_ISSET_chk',
     '__FD_SET_chk',
     '__assert',
@@ -169,7 +169,7 @@
         nonlocal defs
         d = defs.get(name)
         if d is not None and d.soname in kBionicSonames:
-            if name in kBionicSymbolBlacklist: return None
+            if name in kBionicIgnoredSymbols: return None
             # Discard relocations to newer Bionic symbols, because there aren't many of them, and
             # they would limit where the benchmark can run.
             if ver == 'LIBC': return name
diff --git a/docs/32-bit-abi.md b/docs/32-bit-abi.md
index 81afd14..3be6b1a 100644
--- a/docs/32-bit-abi.md
+++ b/docs/32-bit-abi.md
@@ -81,13 +81,23 @@
 in the 64-bit ABI even though they're identical to the non-`64` names.
 
 
-## `time_t` is 32-bit
+## `time_t` is 32-bit on LP32 (y2038)
 
-On 32-bit Android, `time_t` is 32-bit. The header `<time64.h>` and type
-`time64_t` exist as a workaround, but the kernel interfaces exposed on 32-bit
-Android all use the 32-bit `time_t`.
+On 32-bit Android, `time_t` is 32-bit, which will overflow in 2038.
 
-In the 64-bit ABI, `time_t` is 64-bit.
+In the 64-bit ABI, `time_t` is 64-bit, which will not overflow until
+long after the death of the star around which we currently circle.
+
+The header `<time64.h>` and type `time64_t` exist as a workaround,
+but the kernel interfaces exposed on 32-bit Android all use the 32-bit
+`time_t` and `struct timespec`/`struct timeval`. Linux 5.x kernels
+do offer extra interfaces so that 32-bit processes can pass 64-bit
+times to/from the kernel, but we do not plan on adding support for
+these to the C library. Convenient use of the new calls would require
+an equivalent to `_FILE_OFFSET_BITS=64`, which we wouldn't be able
+to globally flip for reasons similar to `_FILE_OFFSET_BITS`, mentioned
+above. All apps are already required to offer 64-bit variants, and we
+expect 64-bit-only devices within the next few years.
 
 
 ## `pthread_mutex_t` is too small for large pids
diff --git a/libc/Android.bp b/libc/Android.bp
index d3271ae..48c9dd0 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -4,6 +4,7 @@
     "async_safe/async_safe_log.cpp",
     "bionic/ether_aton.c",
     "bionic/ether_ntoa.c",
+    "bionic/exit.cpp",
     "bionic/fts.c",
     "bionic/initgroups.c",
     "bionic/isatty.c",
@@ -17,7 +18,6 @@
     "stdio/stdio_ext.cpp",
     "stdio/vfscanf.cpp",
     "stdio/vfwscanf.c",
-    "stdlib/exit.c",
 ]
 
 // off64_t/time64_t support on LP32.
@@ -65,7 +65,13 @@
         "bionic/libc/async_safe/include",
     ],
 
-    header_libs: ["gwp_asan_headers"],
+    header_libs: [
+        "libc_headers",
+        "gwp_asan_headers",
+    ],
+    export_header_lib_headers: [
+        "libc_headers",
+    ],
 
     stl: "none",
     system_shared_libs: [],
@@ -88,6 +94,12 @@
         experimental_mte: {
             cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
         },
+        malloc_zero_contents: {
+            cflags: ["-DSCUDO_ZERO_CONTENTS"],
+        },
+        malloc_pattern_fill_contents: {
+            cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
+        },
     },
 }
 
@@ -608,6 +620,7 @@
         arm64: {
             exclude_srcs: [
                 "upstream-openbsd/lib/libc/string/memchr.c",
+                "upstream-openbsd/lib/libc/string/memrchr.c",
                 "upstream-openbsd/lib/libc/string/stpcpy.c",
                 "upstream-openbsd/lib/libc/string/strcpy.c",
                 "upstream-openbsd/lib/libc/string/strncmp.c",
@@ -777,6 +790,7 @@
         "bionic/android_set_abort_message.cpp",
 
         "bionic/strchr.cpp",
+        "bionic/strchrnul.cpp",
         "bionic/strnlen.c",
         "bionic/strrchr.cpp",
     ],
@@ -837,28 +851,11 @@
         },
         arm64: {
             srcs: [
-                "arch-arm64/generic/bionic/memcmp.S",
                 "arch-arm64/generic/bionic/memcpy.S",
                 "arch-arm64/generic/bionic/memmove.S",
                 "arch-arm64/generic/bionic/memset.S",
-                "arch-arm64/generic/bionic/stpcpy.S",
-                "arch-arm64/generic/bionic/strcpy.S",
                 "arch-arm64/generic/bionic/wmemmove.S",
 
-                "arch-arm64/default/bionic/memchr.S",
-                "arch-arm64/default/bionic/strchr.S",
-                "arch-arm64/default/bionic/strcmp.S",
-                "arch-arm64/default/bionic/strlen.S",
-                "arch-arm64/default/bionic/strncmp.S",
-                "arch-arm64/default/bionic/strnlen.S",
-
-                "arch-arm64/mte/bionic/memchr.c",
-                "arch-arm64/mte/bionic/strchr.cpp",
-                "arch-arm64/mte/bionic/strcmp.c",
-                "arch-arm64/mte/bionic/strlen.c",
-                "arch-arm64/mte/bionic/strncmp.c",
-                "arch-arm64/mte/bionic/strnlen.c",
-
                 "arch-arm64/bionic/__bionic_clone.S",
                 "arch-arm64/bionic/_exit_with_stack_teardown.S",
                 "arch-arm64/bionic/setjmp.S",
@@ -868,7 +865,9 @@
             exclude_srcs: [
                 "bionic/__memcpy_chk.cpp",
                 "bionic/strchr.cpp",
+                "bionic/strchrnul.cpp",
                 "bionic/strnlen.c",
+                "bionic/strrchr.cpp",
             ],
         },
 
@@ -911,6 +910,7 @@
                 "arch-x86/bionic/setjmp.S",
                 "arch-x86/bionic/syscall.S",
                 "arch-x86/bionic/vfork.S",
+                "arch-x86/bionic/__x86.get_pc_thunk.S",
 
                 // ssse3 functions
                 "arch-x86/atom/string/ssse3-strcat-atom.S",
@@ -1121,7 +1121,6 @@
         "bionic/spawn.cpp",
         "bionic/stat.cpp",
         "bionic/stdlib_l.cpp",
-        "bionic/strchrnul.cpp",
         "bionic/strerror.cpp",
         "bionic/string_l.cpp",
         "bionic/strings_l.cpp",
@@ -1358,6 +1357,7 @@
 
     whole_static_libs: [
         "gwp_asan",
+        "libarm-optimized-routines-string",
         "libc_bionic_ndk",
         "libc_bootstrap",
         "libc_fortify",
@@ -1388,6 +1388,7 @@
     name: "libc_nopthread",
 
     whole_static_libs: [
+        "libarm-optimized-routines-string",
         "libc_bionic",
         "libc_bionic_ndk",
         "libc_bootstrap",
@@ -1580,7 +1581,6 @@
     ],
     name: "libc",
     static_ndk_lib: true,
-    export_include_dirs: ["include"],
     product_variables: {
         platform_sdk_version: {
             asflags: ["-DPLATFORM_SDK_VERSION=%d"],
@@ -1643,6 +1643,8 @@
                 srcs: [":libc_sources_shared_arm"],
                 // special for arm
                 cflags: ["-DCRT_LEGACY_WORKAROUND"],
+
+                whole_static_libs: [ "libunwind_llvm" ],
             },
 
             // Arm 32 bit does not produce complete exidx unwind information
@@ -1652,8 +1654,6 @@
             strip: {
                 keep_symbols_and_debug_frame: true,
             },
-
-            whole_static_libs: [ "libunwind_llvm" ],
         },
         arm64: {
             version_script: ":libc.arm64.map",
@@ -1664,7 +1664,9 @@
                 keep_symbols: true,
             },
 
-            whole_static_libs: [ "libgcc_stripped" ],
+            shared: {
+                whole_static_libs: [ "libgcc_stripped" ],
+            },
         },
         x86: {
             // TODO: This is to work around b/24465209. Remove after root cause is fixed.
@@ -1679,7 +1681,9 @@
                 keep_symbols: true,
             },
 
-            whole_static_libs: [ "libgcc_stripped" ],
+            shared: {
+                whole_static_libs: [ "libgcc_stripped" ],
+            },
         },
         x86_64: {
             version_script: ":libc.x86_64.map",
@@ -1690,7 +1694,9 @@
                 keep_symbols: true,
             },
 
-            whole_static_libs: [ "libgcc_stripped" ],
+            shared: {
+                whole_static_libs: [ "libgcc_stripped" ],
+            },
         },
     },
 
@@ -1748,6 +1754,7 @@
 // Headers that only other parts of the platform can include.
 cc_library_headers {
     name: "bionic_libc_platform_headers",
+    defaults: ["linux_bionic_supported"],
     visibility: [
         "//art:__subpackages__",
         "//bionic:__subpackages__",
@@ -1757,9 +1764,10 @@
         "//external/perfetto:__subpackages__",
         "//external/scudo:__subpackages__",
         "//system/core/debuggerd:__subpackages__",
+        "//system/core/libunwindstack:__subpackages__",
         "//system/memory/libmemunreachable:__subpackages__",
+        "//tools/security/sanitizer-status:__subpackages__",
     ],
-    host_supported: true,
     vendor_available: true,
     ramdisk_available: true,
     recovery_available: true,
@@ -1779,9 +1787,13 @@
     ],
 }
 
-// libc_headers for libasync_safe and libpropertyinfoparser
 cc_library_headers {
-    name: "libc_headers",
+    // Internal lib for use in libc_headers. Since we cannot intersect arch{}
+    // and target{} in the same module, this one specifies the arch-dependent
+    // include paths, and then libc_headers filters by target so that the
+    // headers only are included for Bionic targets.
+    name: "libc_headers_arch",
+    visibility: ["//visibility:private"],
 
     host_supported: true,
     vendor_available: true,
@@ -1794,14 +1806,6 @@
     ],
     // used by most APEXes indirectly via libunwind_llvm
     min_sdk_version: "apex_inherit",
-    visibility: [
-        ":__subpackages__", // visible to bionic
-        // ... and only to these places (b/152668052)
-        "//external/gwp_asan",
-        "//external/libunwind_llvm",
-        "//system/core/property_service/libpropertyinfoparser",
-        "//system/extras/toolchain-extras",
-    ],
 
     no_libcrt: true,
     stl: "none",
@@ -1815,36 +1819,77 @@
     // is correct because the headers can support any sdk_version.
     sdk_version: "1",
 
-    export_include_dirs: [
+    export_system_include_dirs: [
         "include",
         "kernel/uapi",
+        "kernel/android/scsi",
         "kernel/android/uapi",
     ],
 
     arch: {
         arm: {
-            export_include_dirs: [
-                "kernel/uapi/asm-arm",
-            ],
+            export_system_include_dirs: ["kernel/uapi/asm-arm"],
         },
         arm64: {
-            export_include_dirs: [
-                "kernel/uapi/asm-arm64",
-            ],
+            export_system_include_dirs: ["kernel/uapi/asm-arm64"],
         },
         x86: {
-            export_include_dirs: [
-                "kernel/uapi/asm-x86",
-            ],
+            export_system_include_dirs: ["kernel/uapi/asm-x86"],
         },
         x86_64: {
-            export_include_dirs: [
-                "kernel/uapi/asm-x86",
-            ],
+            export_system_include_dirs: ["kernel/uapi/asm-x86"],
         },
     },
 }
 
+cc_library_headers {
+    name: "libc_headers",
+    host_supported: true,
+    native_bridge_supported: true,
+    vendor_available: true,
+    ramdisk_available: true,
+    recovery_available: true,
+    sdk_version: "1",
+
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+    // used by most APEXes indirectly via libunwind_llvm
+    min_sdk_version: "apex_inherit",
+    visibility: [
+        "//bionic:__subpackages__", // visible to bionic
+        // ... and only to these places (b/152668052)
+        "//external/arm-optimized-routines",
+        "//external/gwp_asan",
+        "//external/jemalloc_new",
+        "//external/libunwind_llvm",
+        "//external/scudo",
+        "//system/core/property_service/libpropertyinfoparser",
+        "//system/extras/toolchain-extras",
+        // TODO(b/153662223): Clean up these users that needed visibility when
+        // the implicit addition of system Bionic paths was removed.
+        "//art/tools/cpp-define-generator",
+        "//external/boringssl",
+        "//external/minijail",
+    ],
+
+    stl: "none",
+    no_libcrt: true,
+    system_shared_libs: [],
+
+    target: {
+        android: {
+            header_libs: ["libc_headers_arch"],
+            export_header_lib_headers: ["libc_headers_arch"],
+        },
+        linux_bionic: {
+            header_libs: ["libc_headers_arch"],
+            export_header_lib_headers: ["libc_headers_arch"],
+        },
+    }
+}
+
 // ========================================================
 // libstdc++.so and libstdc++.a.
 // ========================================================
@@ -2315,11 +2360,11 @@
     ],
 }
 
-// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
+// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
 genrule {
-    name: "generate_app_zygote_blacklist",
-    out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
-    srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
+    name: "generate_app_zygote_blocklist",
+    out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
+    srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
     cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
 }
 
@@ -2332,11 +2377,11 @@
 
     srcs: [
         "SYSCALLS.TXT",
-        "SECCOMP_WHITELIST_COMMON.TXT",
-        "SECCOMP_WHITELIST_APP.TXT",
-        "SECCOMP_BLACKLIST_COMMON.TXT",
+        "SECCOMP_ALLOWLIST_COMMON.TXT",
+        "SECCOMP_ALLOWLIST_APP.TXT",
+        "SECCOMP_BLOCKLIST_COMMON.TXT",
         "SECCOMP_PRIORITY.TXT",
-        ":generate_app_zygote_blacklist",
+        ":generate_app_zygote_blocklist",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
         ":libseccomp_gen_syscall_nrs_x86",
@@ -2360,10 +2405,10 @@
 
     srcs: [
         "SYSCALLS.TXT",
-        "SECCOMP_WHITELIST_COMMON.TXT",
-        "SECCOMP_WHITELIST_APP.TXT",
-        "SECCOMP_BLACKLIST_COMMON.TXT",
-        "SECCOMP_BLACKLIST_APP.TXT",
+        "SECCOMP_ALLOWLIST_COMMON.TXT",
+        "SECCOMP_ALLOWLIST_APP.TXT",
+        "SECCOMP_BLOCKLIST_COMMON.TXT",
+        "SECCOMP_BLOCKLIST_APP.TXT",
         "SECCOMP_PRIORITY.TXT",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
@@ -2388,9 +2433,9 @@
 
     srcs: [
         "SYSCALLS.TXT",
-        "SECCOMP_WHITELIST_COMMON.TXT",
-        "SECCOMP_WHITELIST_SYSTEM.TXT",
-        "SECCOMP_BLACKLIST_COMMON.TXT",
+        "SECCOMP_ALLOWLIST_COMMON.TXT",
+        "SECCOMP_ALLOWLIST_SYSTEM.TXT",
+        "SECCOMP_BLOCKLIST_COMMON.TXT",
         "SECCOMP_PRIORITY.TXT",
         ":libseccomp_gen_syscall_nrs_arm",
         ":libseccomp_gen_syscall_nrs_arm64",
@@ -2433,75 +2478,6 @@
     },
 }
 
-// This is a temporary library that will use scudo as the native memory
-// allocator. To use it, add it as the first shared library.
-cc_defaults {
-    name: "libc_scudo_wrapper_defaults",
-    srcs: [
-        "bionic/gwp_asan_wrappers.cpp",
-        "bionic/heap_tagging.cpp",
-        "bionic/malloc_common.cpp",
-        "bionic/malloc_common_dynamic.cpp",
-        "bionic/malloc_heapprofd.cpp",
-        "bionic/malloc_limit.cpp",
-        "bionic/scudo_wrapper.cpp",
-        "bionic/__set_errno.cpp",
-    ],
-    cflags: [
-        "-DUSE_SCUDO",
-        "-fno-emulated-tls", // Required for GWP-ASan.
-    ],
-    shared_libs: ["libscudo_wrapper"],
-
-    header_libs: [
-        "libc_headers",
-        "gwp_asan_headers",
-    ],
-
-    static_libs: [
-        "libasync_safe",
-        "gwp_asan",
-    ],
-
-    arch: {
-        arm: {
-            srcs: [":syscalls-arm.S"],
-        },
-        arm64: {
-            srcs: [":syscalls-arm64.S"],
-        },
-        x86: {
-            srcs: [
-                "arch-x86/bionic/__libc_init_sysinfo.cpp",
-                ":syscalls-x86.S",
-            ],
-        },
-        x86_64: {
-            srcs: [":syscalls-x86_64.S"],
-        },
-    },
-
-    // Mark this library as global so it overrides all the allocation
-    // definitions properly.
-    ldflags: ["-Wl,-z,global"],
-}
-
-cc_library_shared {
-    name: "libc_scudo",
-    vendor_available: true,
-    stl: "none",
-    system_shared_libs: [],
-
-    allow_undefined_symbols: true,
-    // Like libc, disable native coverage for libc_scudo.
-    native_coverage: false,
-    apex_available: [
-        "//apex_available:platform",
-        "com.android.media.swcodec",
-    ],
-    min_sdk_version: "apex_inherit",
-}
-
 subdirs = [
     "bionic/scudo",
 ]
diff --git a/libc/NOTICE b/libc/NOTICE
index 8245ff8..2fd674b 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -1,60 +1,3 @@
-   Copyright (c) 2014, ARM Limited
-   All rights Reserved.
-   Copyright (c) 2014, Linaro Ltd.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the company nor the names of its contributors
-         may be used to endorse or promote products derived from this
-         software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-   Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
  Copyright (c) 1993 John Brezak
  All rights reserved.
 
@@ -5225,34 +5168,6 @@
 
 -------------------------------------------------------------------
 
-Copyright (c) 2012, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
 Copyright (c) 2012-2013, Linaro Limited
    All rights reserved.
 
@@ -5465,33 +5380,6 @@
 
 -------------------------------------------------------------------
 
-Copyright (c) 2013-2015, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-     notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-     notice, this list of conditions and the following disclaimer in the
-     documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-     names of its contributors may be used to endorse or promote products
-     derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
--------------------------------------------------------------------
-
 Copyright (c) 2014, Intel Corporation
 All rights reserved.
 
@@ -5632,34 +5520,6 @@
 
 -------------------------------------------------------------------
 
-Copyright (c) 2017 ARM Ltd
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. The name of the company may not be used to endorse or promote
-   products derived from this software without specific prior written
-   permission.
-
-THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
 Copyright (c)1999 Citrus Project,
 All rights reserved.
 
diff --git a/libc/SECCOMP_WHITELIST_APP.TXT b/libc/SECCOMP_ALLOWLIST_APP.TXT
similarity index 96%
rename from libc/SECCOMP_WHITELIST_APP.TXT
rename to libc/SECCOMP_ALLOWLIST_APP.TXT
index dc48715..ba40b60 100644
--- a/libc/SECCOMP_WHITELIST_APP.TXT
+++ b/libc/SECCOMP_ALLOWLIST_APP.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
 # Note that the resultant policy is applied only to zygote spawned processes.
 #
 # This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_WHITELIST_COMMON.TXT b/libc/SECCOMP_ALLOWLIST_COMMON.TXT
similarity index 98%
rename from libc/SECCOMP_WHITELIST_COMMON.TXT
rename to libc/SECCOMP_ALLOWLIST_COMMON.TXT
index 56f9d1d..804676e 100644
--- a/libc/SECCOMP_WHITELIST_COMMON.TXT
+++ b/libc/SECCOMP_ALLOWLIST_COMMON.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
 # Note that the resultant policy is applied only to zygote spawned processes.
 #
 # This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_WHITELIST_SYSTEM.TXT b/libc/SECCOMP_ALLOWLIST_SYSTEM.TXT
similarity index 78%
rename from libc/SECCOMP_WHITELIST_SYSTEM.TXT
rename to libc/SECCOMP_ALLOWLIST_SYSTEM.TXT
index 266fe30..756affe 100644
--- a/libc/SECCOMP_WHITELIST_SYSTEM.TXT
+++ b/libc/SECCOMP_ALLOWLIST_SYSTEM.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
 # Note that the resultant policy is applied only to zygote spawned processes.
 #
 # This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_BLACKLIST_COMMON.TXT b/libc/SECCOMP_BLACKLIST_COMMON.TXT
deleted file mode 100644
index 8ae21c1..0000000
--- a/libc/SECCOMP_BLACKLIST_COMMON.TXT
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
-# Note that the resultant policy is applied only to zygote spawned processes.
-#
-# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
-# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
-#
-# This file is processed by a python script named genseccomp.py.
-
-int     swapon(const char*, int) all
-int     swapoff(const char*) all
diff --git a/libc/SECCOMP_BLACKLIST_APP.TXT b/libc/SECCOMP_BLOCKLIST_APP.TXT
similarity index 89%
rename from libc/SECCOMP_BLACKLIST_APP.TXT
rename to libc/SECCOMP_BLOCKLIST_APP.TXT
index 40ca222..f14e11c 100644
--- a/libc/SECCOMP_BLACKLIST_APP.TXT
+++ b/libc/SECCOMP_BLOCKLIST_APP.TXT
@@ -1,8 +1,8 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
 # Note that the resultant policy is applied only to zygote spawned processes.
 #
-# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
-# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
+# The final seccomp allowlist is SYSCALLS.TXT - SECCOMP_BLOCKLIST.TXT + SECCOMP_ALLOWLIST.TXT
+# Any entry in the blocklist must be in the syscalls file and not be in the allowlist file
 #
 # This file is processed by a python script named genseccomp.py.
 
diff --git a/libc/SECCOMP_BLOCKLIST_COMMON.TXT b/libc/SECCOMP_BLOCKLIST_COMMON.TXT
new file mode 100644
index 0000000..22c9844
--- /dev/null
+++ b/libc/SECCOMP_BLOCKLIST_COMMON.TXT
@@ -0,0 +1,10 @@
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# Note that the resultant policy is applied only to zygote spawned processes.
+#
+# The final seccomp allowlist is SYSCALLS.TXT - SECCOMP_BLOCKLIST.TXT + SECCOMP_ALLOWLIST.TXT
+# Any entry in the blocklist must be in the syscalls file and not be in the allowlist file
+#
+# This file is processed by a python script named genseccomp.py.
+
+int     swapon(const char*, int) all
+int     swapoff(const char*) all
diff --git a/libc/SECCOMP_PRIORITY.TXT b/libc/SECCOMP_PRIORITY.TXT
index fb5ad4a..bccc426 100644
--- a/libc/SECCOMP_PRIORITY.TXT
+++ b/libc/SECCOMP_PRIORITY.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
 # Note that the resultant policy is applied only to zygote spawned processes.
 #
 # This file is processed by a python script named genseccomp.py.
diff --git a/libc/arch-arm64/default/bionic/memchr.S b/libc/arch-arm64/default/bionic/memchr.S
deleted file mode 100644
index 7fbcc8f..0000000
--- a/libc/arch-arm64/default/bionic/memchr.S
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
-   Copyright (c) 2014, ARM Limited
-   All rights Reserved.
-   Copyright (c) 2014, Linaro Ltd.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the company nor the names of its contributors
-         may be used to endorse or promote products derived from this
-         software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- * Neon Available.
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define chrin		w1
-#define cntin		x2
-
-#define result		x0
-
-#define src		x3
-#define	tmp		x4
-#define wtmp2		w5
-#define synd		x6
-#define soff		x9
-#define cntrem		x10
-
-#define vrepchr		v0
-#define vdata1		v1
-#define vdata2		v2
-#define vhas_chr1	v3
-#define vhas_chr2	v4
-#define vrepmask	v5
-#define vend		v6
-
-/*
- * Core algorithm:
- *
- * For each 32-byte chunk we calculate a 64-bit syndrome value, with two bits
- * per byte. For each tuple, bit 0 is set if the relevant byte matched the
- * requested character and bit 1 is not used (faster than using a 32bit
- * syndrome). Since the bits in the syndrome reflect exactly the order in which
- * things occur in the original string, counting trailing zeros allows to
- * identify exactly which byte has matched.
- */
-
-ENTRY(memchr_default)
-	/*
-	 * Magic constant 0x40100401 allows us to identify which lane matches
-	 * the requested byte.
-	 */
-	cbz	cntin, .Lzero_length
-	mov	wtmp2, #0x0401
-	movk	wtmp2, #0x4010, lsl #16
-	dup	vrepchr.16b, chrin
-	/* Work with aligned 32-byte chunks */
-	bic	src, srcin, #31
-	dup	vrepmask.4s, wtmp2
-	ands	soff, srcin, #31
-	and	cntrem, cntin, #31
-	b.eq	.Lloop
-
-	/*
-	 * Input string is not 32-byte aligned. We calculate the syndrome
-	 * value for the aligned 32 bytes block containing the first bytes
-	 * and mask the irrelevant part.
-	 */
-
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	sub	tmp, soff, #32
-	adds	cntin, cntin, tmp
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
-	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
-	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
-	mov	synd, vend.d[0]
-	/* Clear the soff*2 lower bits */
-	lsl	tmp, soff, #1
-	lsr	synd, synd, tmp
-	lsl	synd, synd, tmp
-	/* The first block can also be the last */
-	b.ls	.Lmasklast
-	/* Have we found something already? */
-	cbnz	synd, .Ltail
-
-.Lloop:
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	subs	cntin, cntin, #32
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	/* If we're out of data we finish regardless of the result */
-	b.ls	.Lend
-	/* Use a fast check for the termination condition */
-	orr	vend.16b, vhas_chr1.16b, vhas_chr2.16b
-	addp	vend.2d, vend.2d, vend.2d
-	mov	synd, vend.d[0]
-	/* We're not out of data, loop if we haven't found the character */
-	cbz	synd, .Lloop
-
-.Lend:
-	/* Termination condition found, let's calculate the syndrome value */
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
-	addp	vend.16b, vhas_chr1.16b, vhas_chr2.16b		/* 256->128 */
-	addp	vend.16b, vend.16b, vend.16b			/* 128->64 */
-	mov	synd, vend.d[0]
-	/* Only do the clear for the last possible block */
-	b.hi	.Ltail
-
-.Lmasklast:
-	/* Clear the (32 - ((cntrem + soff) % 32)) * 2 upper bits */
-	add	tmp, cntrem, soff
-	and	tmp, tmp, #31
-	sub	tmp, tmp, #32
-	neg	tmp, tmp, lsl #1
-	lsl	synd, synd, tmp
-	lsr	synd, synd, tmp
-
-.Ltail:
-	/* Count the trailing zeros using bit reversing */
-	rbit	synd, synd
-	/* Compensate the last post-increment */
-	sub	src, src, #32
-	/* Check that we have found a character */
-	cmp	synd, #0
-	/* And count the leading zeros */
-	clz	synd, synd
-	/* Compute the potential result */
-	add	result, src, synd, lsr #1
-	/* Select result or NULL */
-	csel	result, xzr, result, eq
-	ret
-
-.Lzero_length:
-	mov	result, xzr
-	ret
-END(memchr_default)
diff --git a/libc/arch-arm64/default/bionic/strchr.S b/libc/arch-arm64/default/bionic/strchr.S
deleted file mode 100644
index f8cb724..0000000
--- a/libc/arch-arm64/default/bionic/strchr.S
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
-   Copyright (c) 2014, ARM Limited
-   All rights Reserved.
-   Copyright (c) 2014, Linaro Ltd.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the company nor the names of its contributors
-         may be used to endorse or promote products derived from this
-         software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- * Neon Available.
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define chrin		w1
-
-#define result		x0
-
-#define src		x2
-#define	tmp1		x3
-#define wtmp2		w4
-#define tmp3		x5
-
-#define vrepchr		v0
-#define vdata1		v1
-#define vdata2		v2
-#define vhas_nul1	v3
-#define vhas_nul2	v4
-#define vhas_chr1	v5
-#define vhas_chr2	v6
-#define vrepmask_0	v7
-#define vrepmask_c	v16
-#define vend1		v17
-#define vend2		v18
-
-/* Core algorithm.
-
-   For each 32-byte hunk we calculate a 64-bit syndrome value, with
-   two bits per byte (LSB is always in bits 0 and 1, for both big
-   and little-endian systems).  For each tuple, bit 0 is set iff
-   the relevant byte matched the requested character; bit 1 is set
-   iff the relevant byte matched the NUL end of string (we trigger
-   off bit0 for the special case of looking for NUL).  Since the bits
-   in the syndrome reflect exactly the order in which things occur
-   in the original string a count_trailing_zeros() operation will
-   identify exactly which byte is causing the termination, and why.  */
-
-/* Locals and temporaries.  */
-
-ENTRY(strchr_default)
-	/* Magic constant 0x40100401 to allow us to identify which lane
-	   matches the requested byte.  Magic constant 0x80200802 used
-	   similarly for NUL termination.  */
-	mov	wtmp2, #0x0401
-	movk	wtmp2, #0x4010, lsl #16
-	dup	vrepchr.16b, chrin
-	bic	src, srcin, #31		/* Work with aligned 32-byte hunks.  */
-	dup	vrepmask_c.4s, wtmp2
-	ands	tmp1, srcin, #31
-	add	vrepmask_0.4s, vrepmask_c.4s, vrepmask_c.4s /* equiv: lsl #1 */
-	b.eq	.Lloop
-
-	/* Input string is not 32-byte aligned.  Rather than forcing
-	   the padding bytes to a safe value, we calculate the syndrome
-	   for all the bytes, but then mask off those bits of the
-	   syndrome that are related to the padding.  */
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	neg	tmp1, tmp1
-	cmeq	vhas_nul1.16b, vdata1.16b, #0
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_nul2.16b, vdata2.16b, #0
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
-	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	lsl	tmp1, tmp1, #1
-	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
-	mov	tmp3, #~0
-	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
-	lsr	tmp1, tmp3, tmp1
-
-	mov	tmp3, vend1.d[0]
-	bic	tmp1, tmp3, tmp1	// Mask padding bits.
-	cbnz	tmp1, .Ltail
-
-.Lloop:
-	ld1	{vdata1.16b, vdata2.16b}, [src], #32
-	cmeq	vhas_nul1.16b, vdata1.16b, #0
-	cmeq	vhas_chr1.16b, vdata1.16b, vrepchr.16b
-	cmeq	vhas_nul2.16b, vdata2.16b, #0
-	cmeq	vhas_chr2.16b, vdata2.16b, vrepchr.16b
-	/* Use a fast check for the termination condition.  */
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	orr	vend1.16b, vend1.16b, vend2.16b
-	addp	vend1.2d, vend1.2d, vend1.2d
-	mov	tmp1, vend1.d[0]
-	cbz	tmp1, .Lloop
-
-	/* Termination condition found.  Now need to establish exactly why
-	   we terminated.  */
-	and	vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
-	and	vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
-	and	vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
-	and	vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
-	orr	vend1.16b, vhas_nul1.16b, vhas_chr1.16b
-	orr	vend2.16b, vhas_nul2.16b, vhas_chr2.16b
-	addp	vend1.16b, vend1.16b, vend2.16b		// 256->128
-	addp	vend1.16b, vend1.16b, vend2.16b		// 128->64
-
-	mov	tmp1, vend1.d[0]
-.Ltail:
-	/* Count the trailing zeros, by bit reversing...  */
-	rbit	tmp1, tmp1
-	/* Re-bias source.  */
-	sub	src, src, #32
-	clz	tmp1, tmp1	/* And counting the leading zeros.  */
-	/* Tmp1 is even if the target charager was found first.  Otherwise
-	   we've found the end of string and we weren't looking for NUL.  */
-	tst	tmp1, #1
-	add	result, src, tmp1, lsr #1
-	csel	result, result, xzr, eq
-	ret
-END(strchr_default)
diff --git a/libc/arch-arm64/default/bionic/strcmp.S b/libc/arch-arm64/default/bionic/strcmp.S
deleted file mode 100644
index dfac7c4..0000000
--- a/libc/arch-arm64/default/bionic/strcmp.S
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright (c) 2012, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-#define L(label) .L ## label
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-/* Parameters and result.  */
-#define src1		x0
-#define src2		x1
-#define result		x0
-
-/* Internal variables.  */
-#define data1		x2
-#define data1w		w2
-#define data2		x3
-#define data2w		w3
-#define has_nul		x4
-#define diff		x5
-#define syndrome	x6
-#define tmp1		x7
-#define tmp2		x8
-#define tmp3		x9
-#define zeroones	x10
-#define pos		x11
-
-	/* Start of performance-critical section  -- one 64B cache line.  */
-ENTRY(strcmp_default)
-.p2align  6
-	eor	tmp1, src1, src2
-	mov	zeroones, #REP8_01
-	tst	tmp1, #7
-	b.ne	L(misaligned8)
-	ands	tmp1, src1, #7
-	b.ne	L(mutual_align)
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-L(loop_aligned):
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-L(start_realigned):
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	orr	syndrome, diff, has_nul
-	cbz	syndrome, L(loop_aligned)
-	/* End of performance-critical section  -- one 64B cache line.  */
-
-L(end):
-#ifndef	__AARCH64EB__
-	rev	syndrome, syndrome
-	rev	data1, data1
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	clz	pos, syndrome
-	rev	data2, data2
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#else
-	/* For big-endian we cannot use the trick with the syndrome value
-	   as carry-propagation can corrupt the upper bits if the trailing
-	   bytes in the string contain 0x01.  */
-	/* However, if there is no NUL byte in the dword, we can generate
-	   the result directly.  We can't just subtract the bytes as the
-	   MSB might be significant.  */
-	cbnz	has_nul, 1f
-	cmp	data1, data2
-	cset	result, ne
-	cneg	result, result, lo
-	ret
-1:
-	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
-	rev	tmp3, data1
-	sub	tmp1, tmp3, zeroones
-	orr	tmp2, tmp3, #REP8_7f
-	bic	has_nul, tmp1, tmp2
-	rev	has_nul, has_nul
-	orr	syndrome, diff, has_nul
-	clz	pos, syndrome
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#endif
-
-L(mutual_align):
-	/* Sources are mutually aligned, but are not currently at an
-	   alignment boundary.  Round down the addresses and then mask off
-	   the bytes that preceed the start point.  */
-	bic	src1, src1, #7
-	bic	src2, src2, #7
-	lsl	tmp1, tmp1, #3		/* Bytes beyond alignment -> bits.  */
-	ldr	data1, [src1], #8
-	neg	tmp1, tmp1		/* Bits to alignment -64.  */
-	ldr	data2, [src2], #8
-	mov	tmp2, #~0
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp1	/* Shift (tmp1 & 63).  */
-#endif
-	orr	data1, data1, tmp2
-	orr	data2, data2, tmp2
-	b	L(start_realigned)
-
-L(misaligned8):
-	/* Align SRC1 to 8 bytes and then compare 8 bytes at a time, always
-	   checking to make sure that we don't access beyond page boundary in
-	   SRC2.  */
-	tst	src1, #7
-	b.eq	L(loop_misaligned)
-L(do_misaligned):
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	cmp	data1w, #1
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.ne	L(done)
-	tst	src1, #7
-	b.ne	L(do_misaligned)
-
-L(loop_misaligned):
-	/* Test if we are within the last dword of the end of a 4K page.  If
-	   yes then jump back to the misaligned loop to copy a byte at a time.  */
-	and	tmp1, src2, #0xff8
-	eor	tmp1, tmp1, #0xff8
-	cbz	tmp1, L(do_misaligned)
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bic	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	orr	syndrome, diff, has_nul
-	cbz	syndrome, L(loop_misaligned)
-	b	L(end)
-
-L(done):
-	sub	result, data1, data2
-	ret
-END(strcmp_default)
diff --git a/libc/arch-arm64/default/bionic/strlen.S b/libc/arch-arm64/default/bionic/strlen.S
deleted file mode 100644
index 07c5294..0000000
--- a/libc/arch-arm64/default/bionic/strlen.S
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (c) 2013-2015, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-	 notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-	 notice, this list of conditions and the following disclaimer in the
-	 documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-	 names of its contributors may be used to endorse or promote products
-	 derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
- */
-
-#include <private/bionic_asm.h>
-
-/* To test the page crossing code path more thoroughly, compile with
-   -DTEST_PAGE_CROSS - this will force all calls through the slower
-   entry path.  This option is not intended for production use.	 */
-
-/* Arguments and results.  */
-#define srcin		x0
-#define len		x0
-
-/* Locals and temporaries.  */
-#define src		x1
-#define data1		x2
-#define data2		x3
-#define has_nul1	x4
-#define has_nul2	x5
-#define tmp1		x4
-#define tmp2		x5
-#define tmp3		x6
-#define tmp4		x7
-#define zeroones	x8
-
-#define L(l) .L ## l
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word. A faster check
-	   (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
-	   false hits for characters 129..255.	*/
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-#ifdef TEST_PAGE_CROSS
-# define MIN_PAGE_SIZE 15
-#else
-# define MIN_PAGE_SIZE 4096
-#endif
-
-	/* Since strings are short on average, we check the first 16 bytes
-	   of the string for a NUL character.  In order to do an unaligned ldp
-	   safely we have to do a page cross check first.  If there is a NUL
-	   byte we calculate the length from the 2 8-byte words using
-	   conditional select to reduce branch mispredictions (it is unlikely
-	   strlen will be repeatedly called on strings with the same length).
-
-	   If the string is longer than 16 bytes, we align src so don't need
-	   further page cross checks, and process 32 bytes per iteration
-	   using the fast NUL check.  If we encounter non-ASCII characters,
-	   fallback to a second loop using the full NUL check.
-
-	   If the page cross check fails, we read 16 bytes from an aligned
-	   address, remove any characters before the string, and continue
-	   in the main loop using aligned loads.  Since strings crossing a
-	   page in the first 16 bytes are rare (probability of
-	   16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
-
-	   AArch64 systems have a minimum page size of 4k.  We don't bother
-	   checking for larger page sizes - the cost of setting up the correct
-	   page size is just not worth the extra gain from a small reduction in
-	   the cases taking the slow path.  Note that we only care about
-	   whether the first fetch, which may be misaligned, crosses a page
-	   boundary.  */
-
-ENTRY(strlen_default)
-	and	tmp1, srcin, MIN_PAGE_SIZE - 1
-	mov	zeroones, REP8_01
-	cmp	tmp1, MIN_PAGE_SIZE - 16
-	b.gt	L(page_cross)
-	ldp	data1, data2, [srcin]
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul1/2 directly.
-	   Since we expect strings to be small and early-exit,
-	   byte-swap the data now so has_null1/2 will be correct.  */
-	rev	data1, data1
-	rev	data2, data2
-#endif
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(main_loop_entry)
-
-	/* Enter with C = has_nul1 == 0.  */
-	csel	has_nul1, has_nul1, has_nul2, cc
-	mov	len, 8
-	rev	has_nul1, has_nul1
-	clz	tmp1, has_nul1
-	csel	len, xzr, len, cc
-	add	len, len, tmp1, lsr 3
-	ret
-
-	/* The inner loop processes 32 bytes per iteration and uses the fast
-	   NUL check.  If we encounter non-ASCII characters, use a second
-	   loop with the accurate NUL check.  */
-	.p2align 4
-L(main_loop_entry):
-	bic	src, srcin, 15
-	sub	src, src, 16
-L(main_loop):
-	ldp	data1, data2, [src, 32]!
-.Lpage_cross_entry:
-	sub	tmp1, data1, zeroones
-	sub	tmp3, data2, zeroones
-	orr	tmp2, tmp1, tmp3
-	tst	tmp2, zeroones, lsl 7
-	bne	1f
-	ldp	data1, data2, [src, 16]
-	sub	tmp1, data1, zeroones
-	sub	tmp3, data2, zeroones
-	orr	tmp2, tmp1, tmp3
-	tst	tmp2, zeroones, lsl 7
-	beq	L(main_loop)
-	add	src, src, 16
-1:
-	/* The fast check failed, so do the slower, accurate NUL check.	 */
-	orr	tmp2, data1, REP8_7f
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(nonascii_loop)
-
-	/* Enter with C = has_nul1 == 0.  */
-L(tail):
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul1/2 directly.  The
-	   easiest way to get the correct byte is to byte-swap the data
-	   and calculate the syndrome a second time.  */
-	csel	data1, data1, data2, cc
-	rev	data1, data1
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	bic	has_nul1, tmp1, tmp2
-#else
-	csel	has_nul1, has_nul1, has_nul2, cc
-#endif
-	sub	len, src, srcin
-	rev	has_nul1, has_nul1
-	add	tmp2, len, 8
-	clz	tmp1, has_nul1
-	csel	len, len, tmp2, cc
-	add	len, len, tmp1, lsr 3
-	ret
-
-L(nonascii_loop):
-	ldp	data1, data2, [src, 16]!
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	bne	L(tail)
-	ldp	data1, data2, [src, 16]!
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, REP8_7f
-	bics	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	ccmp	has_nul2, 0, 0, eq
-	beq	L(nonascii_loop)
-	b	L(tail)
-
-	/* Load 16 bytes from [srcin & ~15] and force the bytes that precede
-	   srcin to 0x7f, so we ignore any NUL bytes before the string.
-	   Then continue in the aligned loop.  */
-L(page_cross):
-	bic	src, srcin, 15
-	ldp	data1, data2, [src]
-	lsl	tmp1, srcin, 3
-	mov	tmp4, -1
-#ifdef __AARCH64EB__
-	/* Big-endian.	Early bytes are at MSB.	 */
-	lsr	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsl	tmp1, tmp4, tmp1	/* Shift (tmp1 & 63).  */
-#endif
-	orr	tmp1, tmp1, REP8_80
-	orn	data1, data1, tmp1
-	orn	tmp2, data2, tmp1
-	tst	srcin, 8
-	csel	data1, data1, tmp4, eq
-	csel	data2, data2, tmp2, eq
-	b	L(page_cross_entry)
-
-END(strlen_default)
diff --git a/libc/arch-arm64/default/bionic/strncmp.S b/libc/arch-arm64/default/bionic/strncmp.S
deleted file mode 100644
index 5432b73..0000000
--- a/libc/arch-arm64/default/bionic/strncmp.S
+++ /dev/null
@@ -1,280 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-/* Parameters and result.  */
-#define src1		x0
-#define src2		x1
-#define limit		x2
-#define result		x0
-
-/* Internal variables.  */
-#define data1		x3
-#define data1w		w3
-#define data2		x4
-#define data2w		w4
-#define has_nul		x5
-#define diff		x6
-#define syndrome	x7
-#define tmp1		x8
-#define tmp2		x9
-#define tmp3		x10
-#define zeroones	x11
-#define pos		x12
-#define limit_wd	x13
-#define mask		x14
-#define endloop		x15
-#define count		mask
-
-	.text
-	.p2align 6
-	.rep 7
-	nop	/* Pad so that the loop below fits a cache line.  */
-	.endr
-ENTRY(strncmp_default)
-	cbz	limit, .Lret0
-	eor	tmp1, src1, src2
-	mov	zeroones, #REP8_01
-	tst	tmp1, #7
-	and	count, src1, #7
-	b.ne	.Lmisaligned8
-	cbnz	count, .Lmutual_align
-	/* Calculate the number of full and partial words -1.  */
-	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
-	lsr	limit_wd, limit_wd, #3	/* Convert to Dwords.  */
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-	/* Start of performance-critical section  -- one 64B cache line.  */
-.Lloop_aligned:
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-.Lstart_realigned:
-	subs	limit_wd, limit_wd, #1
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	csinv	endloop, diff, xzr, pl	/* Last Dword or differences.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	endloop, #0, #0, eq
-	b.eq	.Lloop_aligned
-	/* End of performance-critical section  -- one 64B cache line.  */
-
-	/* Not reached the limit, must have found the end or a diff.  */
-	tbz	limit_wd, #63, .Lnot_limit
-
-	/* Limit % 8 == 0 => all bytes significant.  */
-	ands	limit, limit, #7
-	b.eq	.Lnot_limit
-
-	lsl	limit, limit, #3	/* Bits -> bytes.  */
-	mov	mask, #~0
-#ifdef __AARCH64EB__
-	lsr	mask, mask, limit
-#else
-	lsl	mask, mask, limit
-#endif
-	bic	data1, data1, mask
-	bic	data2, data2, mask
-
-	/* Make sure that the NUL byte is marked in the syndrome.  */
-	orr	has_nul, has_nul, mask
-
-.Lnot_limit:
-	orr	syndrome, diff, has_nul
-
-#ifndef	__AARCH64EB__
-	rev	syndrome, syndrome
-	rev	data1, data1
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	clz	pos, syndrome
-	rev	data2, data2
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#else
-	/* For big-endian we cannot use the trick with the syndrome value
-	   as carry-propagation can corrupt the upper bits if the trailing
-	   bytes in the string contain 0x01.  */
-	/* However, if there is no NUL byte in the dword, we can generate
-	   the result directly.  We can't just subtract the bytes as the
-	   MSB might be significant.  */
-	cbnz	has_nul, 1f
-	cmp	data1, data2
-	cset	result, ne
-	cneg	result, result, lo
-	ret
-1:
-	/* Re-compute the NUL-byte detection, using a byte-reversed value.  */
-	rev	tmp3, data1
-	sub	tmp1, tmp3, zeroones
-	orr	tmp2, tmp3, #REP8_7f
-	bic	has_nul, tmp1, tmp2
-	rev	has_nul, has_nul
-	orr	syndrome, diff, has_nul
-	clz	pos, syndrome
-	/* The MS-non-zero bit of the syndrome marks either the first bit
-	   that is different, or the top bit of the first zero byte.
-	   Shifting left now will bring the critical information into the
-	   top bits.  */
-	lsl	data1, data1, pos
-	lsl	data2, data2, pos
-	/* But we need to zero-extend (char is unsigned) the value and then
-	   perform a signed 32-bit subtraction.  */
-	lsr	data1, data1, #56
-	sub	result, data1, data2, lsr #56
-	ret
-#endif
-
-.Lmutual_align:
-	/* Sources are mutually aligned, but are not currently at an
-	   alignment boundary.  Round down the addresses and then mask off
-	   the bytes that precede the start point.
-	   We also need to adjust the limit calculations, but without
-	   overflowing if the limit is near ULONG_MAX.  */
-	bic	src1, src1, #7
-	bic	src2, src2, #7
-	ldr	data1, [src1], #8
-	neg	tmp3, count, lsl #3	/* 64 - bits(bytes beyond align). */
-	ldr	data2, [src2], #8
-	mov	tmp2, #~0
-	sub	limit_wd, limit, #1	/* limit != 0, so no underflow.  */
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp3	/* Shift (count & 63).  */
-#endif
-	and	tmp3, limit_wd, #7
-	lsr	limit_wd, limit_wd, #3
-	/* Adjust the limit. Only low 3 bits used, so overflow irrelevant.  */
-	add	limit, limit, count
-	add	tmp3, tmp3, count
-	orr	data1, data1, tmp2
-	orr	data2, data2, tmp2
-	add	limit_wd, limit_wd, tmp3, lsr #3
-	b	.Lstart_realigned
-
-	.p2align 6
-	/* Don't bother with dwords for up to 16 bytes.  */
-.Lmisaligned8:
-	cmp	limit, #16
-	b.hs	.Ltry_misaligned_words
-
-.Lbyte_loop:
-	/* Perhaps we can do better than this.  */
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	subs	limit, limit, #1
-	ccmp	data1w, #1, #0, hi	/* NZCV = 0b0000.  */
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.eq	.Lbyte_loop
-.Ldone:
-	sub	result, data1, data2
-	ret
-	/* Align the SRC1 to a dword by doing a bytewise compare and then do
-	   the dword loop.  */
-.Ltry_misaligned_words:
-	lsr	limit_wd, limit, #3
-	cbz	count, .Ldo_misaligned
-
-	neg	count, count
-	and	count, count, #7
-	sub	limit, limit, count
-	lsr	limit_wd, limit, #3
-
-.Lpage_end_loop:
-	ldrb	data1w, [src1], #1
-	ldrb	data2w, [src2], #1
-	cmp	data1w, #1
-	ccmp	data1w, data2w, #0, cs	/* NZCV = 0b0000.  */
-	b.ne	.Ldone
-	subs	count, count, #1
-	b.hi	.Lpage_end_loop
-
-.Ldo_misaligned:
-	/* Prepare ourselves for the next page crossing.  Unlike the aligned
-	   loop, we fetch 1 less dword because we risk crossing bounds on
-	   SRC2.  */
-	mov	count, #8
-	subs	limit_wd, limit_wd, #1
-	b.lo	.Ldone_loop
-.Lloop_misaligned:
-	and	tmp2, src2, #0xff8
-	eor	tmp2, tmp2, #0xff8
-	cbz	tmp2, .Lpage_end_loop
-
-	ldr	data1, [src1], #8
-	ldr	data2, [src2], #8
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	diff, #0, #0, eq
-	b.ne	.Lnot_limit
-	subs	limit_wd, limit_wd, #1
-	b.pl	.Lloop_misaligned
-
-.Ldone_loop:
-	/* We found a difference or a NULL before the limit was reached.  */
-	and	limit, limit, #7
-	cbz	limit, .Lnot_limit
-	/* Read the last word.  */
-	sub	src1, src1, 8
-	sub	src2, src2, 8
-	ldr	data1, [src1, limit]
-	ldr	data2, [src2, limit]
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	eor	diff, data1, data2	/* Non-zero if differences found.  */
-	bics	has_nul, tmp1, tmp2	/* Non-zero if NUL terminator.  */
-	ccmp	diff, #0, #0, eq
-	b.ne	.Lnot_limit
-
-.Lret0:
-	mov	result, #0
-	ret
-END(strncmp_default)
diff --git a/libc/arch-arm64/default/bionic/strnlen.S b/libc/arch-arm64/default/bionic/strnlen.S
deleted file mode 100644
index 1694532..0000000
--- a/libc/arch-arm64/default/bionic/strnlen.S
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#define srcin		x0
-#define len		x0
-#define limit		x1
-
-/* Locals and temporaries.  */
-#define src		x2
-#define data1		x3
-#define data2		x4
-#define data2a		x5
-#define has_nul1	x6
-#define has_nul2	x7
-#define tmp1		x8
-#define tmp2		x9
-#define tmp3		x10
-#define tmp4		x11
-#define zeroones	x12
-#define pos		x13
-#define limit_wd	x14
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-	.text
-	.p2align	6
-.Lstart:
-	/* Pre-pad to ensure critical loop begins an icache line.  */
-	.rep 7
-	nop
-	.endr
-	/* Put this code here to avoid wasting more space with pre-padding.  */
-.Lhit_limit:
-	mov	len, limit
-	ret
-
-ENTRY(strnlen_default)
-	cbz	limit, .Lhit_limit
-	mov	zeroones, #REP8_01
-	bic	src, srcin, #15
-	ands	tmp1, srcin, #15
-	b.ne	.Lmisaligned
-	/* Calculate the number of full and partial words -1.  */
-	sub	limit_wd, limit, #1	/* Limit != 0, so no underflow.  */
-	lsr	limit_wd, limit_wd, #4	/* Convert to Qwords.  */
-
-	/* NUL detection works on the principle that (X - 1) & (~X) & 0x80
-	   (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-	   can be done in parallel across the entire word.  */
-	/* The inner loop deals with two Dwords at a time.  This has a
-	   slightly higher start-up cost, but we should win quite quickly,
-	   especially on cores with a high number of issue slots per
-	   cycle, as we get much better parallelism out of the operations.  */
-
-	/* Start of critial section -- keep to one 64Byte cache line.  */
-.Lloop:
-	ldp	data1, data2, [src], #16
-.Lrealigned:
-	sub	tmp1, data1, zeroones
-	orr	tmp2, data1, #REP8_7f
-	sub	tmp3, data2, zeroones
-	orr	tmp4, data2, #REP8_7f
-	bic	has_nul1, tmp1, tmp2
-	bic	has_nul2, tmp3, tmp4
-	subs	limit_wd, limit_wd, #1
-	orr	tmp1, has_nul1, has_nul2
-	ccmp	tmp1, #0, #0, pl	/* NZCV = 0000  */
-	b.eq	.Lloop
-	/* End of critical section -- keep to one 64Byte cache line.  */
-
-	orr	tmp1, has_nul1, has_nul2
-	cbz	tmp1, .Lhit_limit	/* No null in final Qword.  */
-
-	/* We know there's a null in the final Qword.  The easiest thing
-	   to do now is work out the length of the string and return
-	   MIN (len, limit).  */
-
-	sub	len, src, srcin
-	cbz	has_nul1, .Lnul_in_data2
-#ifdef __AARCH64EB__
-	mov	data2, data1
-#endif
-	sub	len, len, #8
-	mov	has_nul2, has_nul1
-.Lnul_in_data2:
-#ifdef __AARCH64EB__
-	/* For big-endian, carry propagation (if the final byte in the
-	   string is 0x01) means we cannot use has_nul directly.  The
-	   easiest way to get the correct byte is to byte-swap the data
-	   and calculate the syndrome a second time.  */
-	rev	data2, data2
-	sub	tmp1, data2, zeroones
-	orr	tmp2, data2, #REP8_7f
-	bic	has_nul2, tmp1, tmp2
-#endif
-	sub	len, len, #8
-	rev	has_nul2, has_nul2
-	clz	pos, has_nul2
-	add	len, len, pos, lsr #3		/* Bits to bytes.  */
-	cmp	len, limit
-	csel	len, len, limit, ls		/* Return the lower value.  */
-	ret
-
-.Lmisaligned:
-	/* Deal with a partial first word.
-	   We're doing two things in parallel here;
-	   1) Calculate the number of words (but avoiding overflow if
-	      limit is near ULONG_MAX) - to do this we need to work out
-	      limit + tmp1 - 1 as a 65-bit value before shifting it;
-	   2) Load and mask the initial data words - we force the bytes
-	      before the ones we are interested in to 0xff - this ensures
-	      early bytes will not hit any zero detection.  */
-	sub	limit_wd, limit, #1
-	neg	tmp4, tmp1
-	cmp	tmp1, #8
-
-	and	tmp3, limit_wd, #15
-	lsr	limit_wd, limit_wd, #4
-	mov	tmp2, #~0
-
-	ldp	data1, data2, [src], #16
-	lsl	tmp4, tmp4, #3		/* Bytes beyond alignment -> bits.  */
-	add	tmp3, tmp3, tmp1
-
-#ifdef __AARCH64EB__
-	/* Big-endian.  Early bytes are at MSB.  */
-	lsl	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
-#else
-	/* Little-endian.  Early bytes are at LSB.  */
-	lsr	tmp2, tmp2, tmp4	/* Shift (tmp1 & 63).  */
-#endif
-	add	limit_wd, limit_wd, tmp3, lsr #4
-
-	orr	data1, data1, tmp2
-	orr	data2a, data2, tmp2
-
-	csinv	data1, data1, xzr, le
-	csel	data2, data2, data2a, le
-	b	.Lrealigned
-END(strnlen_default)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
index 37abea4..0fd331f 100644
--- a/libc/arch-arm64/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm64/dynamic_function_dispatch.cpp
@@ -45,54 +45,81 @@
 typedef void* memchr_func(const void*, int, size_t);
 DEFINE_IFUNC_FOR(memchr) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(memchr_func, memchr_mte);
+        RETURN_FUNC(memchr_func, __memchr_aarch64_mte);
     } else {
-        RETURN_FUNC(memchr_func, memchr_default);
+        RETURN_FUNC(memchr_func, __memchr_aarch64);
+    }
+}
+
+typedef int stpcpy_func(char*, const char*);
+DEFINE_IFUNC_FOR(stpcpy) {
+    if (supports_mte(arg->_hwcap2)) {
+        RETURN_FUNC(stpcpy_func, __stpcpy_aarch64_mte);
+    } else {
+        RETURN_FUNC(stpcpy_func, __stpcpy_aarch64);
     }
 }
 
 typedef char* strchr_func(const char*, int);
 DEFINE_IFUNC_FOR(strchr) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strchr_func, strchr_mte);
+        RETURN_FUNC(strchr_func, __strchr_aarch64_mte);
     } else {
-        RETURN_FUNC(strchr_func, strchr_default);
+        RETURN_FUNC(strchr_func, __strchr_aarch64);
+    }
+}
+
+typedef char* strchrnul_func(const char*, int);
+DEFINE_IFUNC_FOR(strchrnul) {
+    if (supports_mte(arg->_hwcap2)) {
+        RETURN_FUNC(strchrnul_func, __strchrnul_aarch64_mte);
+    } else {
+        RETURN_FUNC(strchrnul_func, __strchrnul_aarch64);
     }
 }
 
 typedef int strcmp_func(const char*, const char*);
 DEFINE_IFUNC_FOR(strcmp) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strcmp_func, strcmp_mte);
+        RETURN_FUNC(strcmp_func, __strcmp_aarch64_mte);
     } else {
-        RETURN_FUNC(strcmp_func, strcmp_default);
+        RETURN_FUNC(strcmp_func, __strcmp_aarch64);
+    }
+}
+
+typedef int strcpy_func(char*, const char*);
+DEFINE_IFUNC_FOR(strcpy) {
+    if (supports_mte(arg->_hwcap2)) {
+        RETURN_FUNC(strcpy_func, __strcpy_aarch64_mte);
+    } else {
+        RETURN_FUNC(strcpy_func, __strcpy_aarch64);
     }
 }
 
 typedef size_t strlen_func(const char*);
 DEFINE_IFUNC_FOR(strlen) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strlen_func, strlen_mte);
+        RETURN_FUNC(strlen_func, __strlen_aarch64_mte);
     } else {
-        RETURN_FUNC(strlen_func, strlen_default);
+        RETURN_FUNC(strlen_func, __strlen_aarch64);
     }
 }
 
 typedef int strncmp_func(const char*, const char*, int);
 DEFINE_IFUNC_FOR(strncmp) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strncmp_func, strncmp_mte);
+        RETURN_FUNC(strncmp_func, __strncmp_aarch64_mte);
     } else {
-        RETURN_FUNC(strncmp_func, strncmp_default);
+        RETURN_FUNC(strncmp_func, __strncmp_aarch64);
     }
 }
 
-typedef size_t strnlen_func(const char*, int);
-DEFINE_IFUNC_FOR(strnlen) {
+typedef char* strrchr_func(const char*, int);
+DEFINE_IFUNC_FOR(strrchr) {
     if (supports_mte(arg->_hwcap2)) {
-        RETURN_FUNC(strnlen_func, strnlen_mte);
+        RETURN_FUNC(strrchr_func, __strrchr_aarch64_mte);
     } else {
-        RETURN_FUNC(strnlen_func, strnlen_default);
+        RETURN_FUNC(strrchr_func, __strrchr_aarch64);
     }
 }
 
diff --git a/libc/arch-arm64/generic/bionic/memcmp.S b/libc/arch-arm64/generic/bionic/memcmp.S
deleted file mode 100644
index bff54ae..0000000
--- a/libc/arch-arm64/generic/bionic/memcmp.S
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2017 ARM Ltd
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the company may not be used to endorse or promote
- *    products derived from this software without specific prior written
- *    permission.
- *
- * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64, unaligned accesses.
- */
-
-#include <private/bionic_asm.h>
-
-#define L(l) .L ## l
-
-/* Parameters and result.  */
-#define src1		x0
-#define src2		x1
-#define limit		x2
-#define result		w0
-
-/* Internal variables.  */
-#define data1		x3
-#define data1w		w3
-#define data1h		x4
-#define data2		x5
-#define data2w		w5
-#define data2h		x6
-#define tmp1		x7
-#define tmp2		x8
-
-/* Small inputs of less than 8 bytes are handled separately.  This allows the
-   main code to be speed up using unaligned loads since there are now at least
-   8 bytes to be compared.  If the first 8 bytes are equal, align src1.
-   This ensures each iteration does at most one unaligned access even if both
-   src1 and src2 are unaligned, and mutually aligned inputs behave as if
-   aligned.  After the main loop, process the last 16 bytes using unaligned
-   accesses.  */
-
-ENTRY(memcmp)
-.p2align 6
-	subs	limit, limit, 8
-	b.lo	L(less8)
-
-	/* Limit >= 8, so check first 8 bytes using unaligned loads.  */
-	ldr	data1, [src1], 8
-	ldr	data2, [src2], 8
-	cmp	data1, data2
-	b.ne	L(return)
-
-	subs	limit, limit, 8
-	b.gt	L(more16)
-
-	ldr	data1, [src1, limit]
-	ldr	data2, [src2, limit]
-	b	L(return)
-
-L(more16):
-	ldr	data1, [src1], 8
-	ldr	data2, [src2], 8
-	cmp	data1, data2
-	bne	L(return)
-
-	/* Jump directly to comparing the last 16 bytes for 32 byte (or less)
-	   strings.  */
-	subs	limit, limit, 16
-	b.ls	L(last_bytes)
-
-	/* We overlap loads between 0-32 bytes at either side of SRC1 when we
-	   try to align, so limit it only to strings larger than 128 bytes.  */
-	cmp	limit, 96
-	b.ls	L(loop16)
-
-	/* Align src1 and adjust src2 with bytes not yet done.  */
-	and	tmp1, src1, 15
-	add	limit, limit, tmp1
-	sub	src1, src1, tmp1
-	sub	src2, src2, tmp1
-
-	/* Loop performing 16 bytes per iteration using aligned src1.
-	   Limit is pre-decremented by 16 and must be larger than zero.
-	   Exit if <= 16 bytes left to do or if the data is not equal.  */
-	.p2align 4
-L(loop16):
-	ldp	data1, data1h, [src1], 16
-	ldp	data2, data2h, [src2], 16
-	subs	limit, limit, 16
-	ccmp	data1, data2, 0, hi
-	ccmp	data1h, data2h, 0, eq
-	b.eq	L(loop16)
-
-	cmp	data1, data2
-	bne	L(return)
-	mov	data1, data1h
-	mov	data2, data2h
-	cmp	data1, data2
-	bne	L(return)
-
-	/* Compare last 1-16 bytes using unaligned access.  */
-L(last_bytes):
-	add	src1, src1, limit
-	add	src2, src2, limit
-	ldp	data1, data1h, [src1]
-	ldp	data2, data2h, [src2]
-	cmp     data1, data2
-	bne	L(return)
-	mov	data1, data1h
-	mov	data2, data2h
-	cmp	data1, data2
-
-	/* Compare data bytes and set return value to 0, -1 or 1.  */
-L(return):
-#ifndef __AARCH64EB__
-	rev	data1, data1
-	rev	data2, data2
-#endif
-	cmp     data1, data2
-L(ret_eq):
-	cset	result, ne
-	cneg	result, result, lo
-	ret
-
-	.p2align 4
-	/* Compare up to 8 bytes.  Limit is [-8..-1].  */
-L(less8):
-	adds	limit, limit, 4
-	b.lo	L(less4)
-	ldr	data1w, [src1], 4
-	ldr	data2w, [src2], 4
-	cmp	data1w, data2w
-	b.ne	L(return)
-	sub	limit, limit, 4
-L(less4):
-	adds	limit, limit, 4
-	beq	L(ret_eq)
-L(byte_loop):
-	ldrb	data1w, [src1], 1
-	ldrb	data2w, [src2], 1
-	subs	limit, limit, 1
-	ccmp	data1w, data2w, 0, ne	/* NZCV = 0b0000.  */
-	b.eq	L(byte_loop)
-	sub	result, data1w, data2w
-	ret
-
-END(memcmp)
diff --git a/libc/arch-arm64/generic/bionic/stpcpy.S b/libc/arch-arm64/generic/bionic/stpcpy.S
deleted file mode 100644
index e4a7993..0000000
--- a/libc/arch-arm64/generic/bionic/stpcpy.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define STPCPY
-#include "string_copy.S"
diff --git a/libc/arch-arm64/generic/bionic/strcpy.S b/libc/arch-arm64/generic/bionic/strcpy.S
deleted file mode 100644
index 260c321..0000000
--- a/libc/arch-arm64/generic/bionic/strcpy.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define STRCPY
-#include "string_copy.S"
diff --git a/libc/arch-arm64/generic/bionic/string_copy.S b/libc/arch-arm64/generic/bionic/string_copy.S
deleted file mode 100644
index 2bf969d..0000000
--- a/libc/arch-arm64/generic/bionic/string_copy.S
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
-   Copyright (c) 2014, Linaro Limited
-   All rights reserved.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the Linaro nor the
-         names of its contributors may be used to endorse or promote products
-         derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* Assumptions:
- *
- * ARMv8-a, AArch64
- */
-
-#if !defined(STPCPY) && !defined(STRCPY)
-#error "Either STPCPY or STRCPY must be defined."
-#endif
-
-#include <private/bionic_asm.h>
-
-/* Arguments and results.  */
-#if defined(STPCPY)
-#define dst         x0
-#elif defined(STRCPY)
-#define dstin       x0
-#endif
-#define src         x1
-
-/* Locals and temporaries.  */
-#if defined(STRCPY)
-#define dst         x2
-#endif
-#define data1       x3
-#define data1_w     w3
-#define data2       x4
-#define data2_w     w4
-#define has_nul1    x5
-#define has_nul1_w  w5
-#define has_nul2    x6
-#define tmp1        x7
-#define tmp2        x8
-#define tmp3        x9
-#define tmp4        x10
-#define zeroones    x11
-#define zeroones_w  w11
-#define pos         x12
-
-#define REP8_01 0x0101010101010101
-#define REP8_7f 0x7f7f7f7f7f7f7f7f
-#define REP8_80 0x8080808080808080
-
-#if defined(STPCPY)
-ENTRY(stpcpy)
-#elif defined(STRCPY)
-ENTRY(strcpy)
-#endif
-    mov     zeroones, #REP8_01
-#if defined(STRCPY)
-    mov     dst, dstin
-#endif
-    ands    tmp1, src, #15
-    b.ne    .Lmisaligned
-    // NUL detection works on the principle that (X - 1) & (~X) & 0x80
-    // (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
-    // can be done in parallel across the entire word.
-    // The inner loop deals with two Dwords at a time.  This has a
-    // slightly higher start-up cost, but we should win quite quickly,
-    // especially on cores with a high number of issue slots per
-    // cycle, as we get much better parallelism out of the operations.
-.Lloop:
-    ldp     data1, data2, [src], #16
-    sub     tmp1, data1, zeroones
-    orr     tmp2, data1, #REP8_7f
-    bic     has_nul1, tmp1, tmp2
-    cbnz    has_nul1, .Lnul_in_data1
-    sub     tmp3, data2, zeroones
-    orr     tmp4, data2, #REP8_7f
-    bic     has_nul2, tmp3, tmp4
-    cbnz    has_nul2, .Lnul_in_data2
-    // No NUL in either register, copy it in a single instruction.
-    stp     data1, data2, [dst], #16
-    b       .Lloop
-
-.Lnul_in_data1:
-    rev     has_nul1, has_nul1
-    clz     pos, has_nul1
-    add     tmp1, pos, #0x8
-
-    tbz     tmp1, #6, 1f
-#if defined(STPCPY)
-    str     data1, [dst], #7
-#elif defined(STRCPY)
-    str     data1, [dst]
-#endif
-    ret
-1:
-    tbz     tmp1, #5, 1f
-    str     data1_w, [dst], #4
-    lsr     data1, data1, #32
-1:
-    tbz     tmp1, #4, 1f
-    strh    data1_w, [dst], #2
-    lsr     data1, data1, #16
-1:
-    tbz     tmp1, #3, 1f
-    strb    data1_w, [dst]
-#if defined(STPCPY)
-    ret
-#endif
-1:
-#if defined(STPCPY)
-    // Back up one so that dst points to the '\0' string terminator.
-    sub     dst, dst, #1
-#endif
-    ret
-
-.Lnul_in_data2:
-    str     data1, [dst], #8
-    rev     has_nul2, has_nul2
-    clz     pos, has_nul2
-    add     tmp1, pos, #0x8
-
-    tbz     tmp1, #6, 1f
-#if defined(STPCPY)
-    str     data2, [dst], #7
-#elif defined(STRCPY)
-    str     data2, [dst]
-#endif
-    ret
-1:
-    tbz     tmp1, #5, 1f
-    str     data2_w, [dst], #4
-    lsr     data2, data2, #32
-1:
-    tbz     tmp1, #4, 1f
-    strh    data2_w, [dst], #2
-    lsr     data2, data2, #16
-1:
-    tbz     tmp1, #3, 1f
-    strb    data2_w, [dst]
-#if defined(STPCPY)
-    ret
-#endif
-1:
-#if defined(STPCPY)
-    // Back up one so that dst points to the '\0' string terminator.
-    sub     dst, dst, #1
-#endif
-    ret
-
-.Lmisaligned:
-    tbz     src, #0, 1f
-    ldrb    data1_w, [src], #1
-    strb    data1_w, [dst], #1
-    cbnz    data1_w, 1f
-#if defined(STPCPY)
-    // Back up one so that dst points to the '\0' string terminator.
-    sub     dst, dst, #1
-#endif
-    ret
-1:
-    tbz     src, #1, 1f
-    ldrb    data1_w, [src], #1
-    strb    data1_w, [dst], #1
-    cbz     data1_w, .Ldone
-    ldrb    data2_w, [src], #1
-    strb    data2_w, [dst], #1
-    cbnz    data2_w, 1f
-.Ldone:
-#if defined(STPCPY)
-    // Back up one so that dst points to the '\0' string terminator.
-    sub     dst, dst, #1
-#endif
-    ret
-1:
-    tbz     src, #2, 1f
-    ldr     data1_w, [src], #4
-    // Check for a zero.
-    sub     has_nul1_w, data1_w, zeroones_w
-    bic     has_nul1_w, has_nul1_w, data1_w
-    ands    has_nul1_w, has_nul1_w, #0x80808080
-    b.ne    .Lnul_in_data1
-    str     data1_w, [dst], #4
-1:
-    tbz     src, #3, .Lloop
-    ldr     data1, [src], #8
-    // Check for a zero.
-    sub     tmp1, data1, zeroones
-    orr     tmp2, data1, #REP8_7f
-    bics    has_nul1, tmp1, tmp2
-    b.ne    .Lnul_in_data1
-    str     data1, [dst], #8
-    b       .Lloop
-#if defined(STPCPY)
-END(stpcpy)
-#elif defined(STRCPY)
-END(strcpy)
-#endif
diff --git a/libc/arch-arm64/mte/bionic/memchr.c b/libc/arch-arm64/mte/bionic/memchr.c
deleted file mode 100644
index 33b2fc2..0000000
--- a/libc/arch-arm64/mte/bionic/memchr.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define memchr memchr_mte
-#include <upstream-openbsd/lib/libc/string/memchr.c>
diff --git a/libc/arch-arm64/mte/bionic/strchr.cpp b/libc/arch-arm64/mte/bionic/strchr.cpp
deleted file mode 100644
index 7d394df..0000000
--- a/libc/arch-arm64/mte/bionic/strchr.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define strchr strchr_mte
-#include <bionic/strchr.cpp>
diff --git a/libc/arch-arm64/mte/bionic/strcmp.c b/libc/arch-arm64/mte/bionic/strcmp.c
deleted file mode 100644
index 0e134f0..0000000
--- a/libc/arch-arm64/mte/bionic/strcmp.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define strcmp strcmp_mte
-#include <upstream-openbsd/lib/libc/string/strcmp.c>
diff --git a/libc/arch-arm64/mte/bionic/strncmp.c b/libc/arch-arm64/mte/bionic/strncmp.c
deleted file mode 100644
index 54d08e9..0000000
--- a/libc/arch-arm64/mte/bionic/strncmp.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <upstream-openbsd/android/include/openbsd-compat.h>
-
-#define strncmp strncmp_mte
-#include <upstream-openbsd/lib/libc/string/strncmp.c>
diff --git a/libc/arch-arm64/mte/bionic/strnlen.c b/libc/arch-arm64/mte/bionic/strnlen.c
deleted file mode 100644
index 3dc251d..0000000
--- a/libc/arch-arm64/mte/bionic/strnlen.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define strnlen strnlen_mte
-#include <bionic/strnlen.c>
diff --git a/libc/arch-arm64/static_function_dispatch.S b/libc/arch-arm64/static_function_dispatch.S
index 8e3a4c1..65a1492 100644
--- a/libc/arch-arm64/static_function_dispatch.S
+++ b/libc/arch-arm64/static_function_dispatch.S
@@ -33,9 +33,12 @@
     b impl; \
 END(name)
 
-FUNCTION_DELEGATE(memchr, memchr_mte)
-FUNCTION_DELEGATE(strchr, strchr_mte)
-FUNCTION_DELEGATE(strcmp, strcmp_mte)
-FUNCTION_DELEGATE(strlen, strlen_mte)
-FUNCTION_DELEGATE(strncmp, strncmp_mte)
-FUNCTION_DELEGATE(strnlen, strnlen_mte)
+FUNCTION_DELEGATE(memchr, __memchr_aarch64_mte)
+FUNCTION_DELEGATE(stpcpy, __stpcpy_aarch64_mte)
+FUNCTION_DELEGATE(strchr, __strchr_aarch64_mte)
+FUNCTION_DELEGATE(strchrnul, __strchrnul_aarch64_mte)
+FUNCTION_DELEGATE(strcmp, __strcmp_aarch64_mte)
+FUNCTION_DELEGATE(strcpy, __strcpy_aarch64_mte)
+FUNCTION_DELEGATE(strlen, __strlen_aarch64_mte)
+FUNCTION_DELEGATE(strrchr, __strrchr_aarch64_mte)
+FUNCTION_DELEGATE(strncmp, __strncmp_aarch64_mte)
diff --git a/libc/arch-x86/atom/string/sse2-memset-atom.S b/libc/arch-x86/atom/string/sse2-memset-atom.S
index 016c49e..e4cd038 100644
--- a/libc/arch-x86/atom/string/sse2-memset-atom.S
+++ b/libc/arch-x86/atom/string/sse2-memset-atom.S
@@ -77,15 +77,6 @@
     /* We loaded the jump table and adjusted EDX. Go.  */	\
     jmp		*%ebx
 
-	.section	.gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
-	.globl	__x86.get_pc_thunk.bx
-	.hidden	__x86.get_pc_thunk.bx
-	ALIGN(4)
-	.type	__x86.get_pc_thunk.bx,@function
-__x86.get_pc_thunk.bx:
-	movl	(%esp), %ebx
-	ret
-
 ENTRY(__memset_chk_atom)
   ENTRANCE
 
diff --git a/libc/arch-x86/bionic/__x86.get_pc_thunk.S b/libc/arch-x86/bionic/__x86.get_pc_thunk.S
new file mode 100644
index 0000000..58dbb08
--- /dev/null
+++ b/libc/arch-x86/bionic/__x86.get_pc_thunk.S
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+// Typically GCC outputs functions like these into any object file that needs a PIC base register,
+// and one of the copies for each register is used. Clang doesn't use these functions, but some of
+// the quasi-hand-written assembly in the optimized string routines does.
+
+    .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+    .globl __x86.get_pc_thunk.bx
+    .hidden __x86.get_pc_thunk.bx
+    .p2align 4
+    .type __x86.get_pc_thunk.bx,@function
+__x86.get_pc_thunk.bx:
+    .cfi_startproc
+    movl (%esp), %ebx
+    ret
+    .cfi_endproc
+
+    .section .text.__x86.get_pc_thunk.cx,"axG",@progbits,__x86.get_pc_thunk.cx,comdat
+    .globl __x86.get_pc_thunk.cx
+    .hidden __x86.get_pc_thunk.cx
+    .p2align 4
+    .type __x86.get_pc_thunk.cx,@function
+__x86.get_pc_thunk.cx:
+    .cfi_startproc
+    movl (%esp), %ecx
+    ret
+    .cfi_endproc
diff --git a/libc/arch-x86/silvermont/string/sse2-memset-slm.S b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
index adaccae..b7633f5 100644
--- a/libc/arch-x86/silvermont/string/sse2-memset-slm.S
+++ b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
@@ -77,15 +77,6 @@
     /* We loaded the jump table and adjusted EDX. Go.  */	\
     jmp		*%ebx
 
-	.section	.gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
-	.globl	__x86.get_pc_thunk.bx
-	.hidden	__x86.get_pc_thunk.bx
-	ALIGN(4)
-	.type	__x86.get_pc_thunk.bx,@function
-__x86.get_pc_thunk.bx:
-	movl	(%esp), %ebx
-	ret
-
 ENTRY(__memset_chk_generic)
   ENTRANCE
 
diff --git a/libc/async_safe/include/async_safe/CHECK.h b/libc/async_safe/include/async_safe/CHECK.h
index bec89a3..46d460c 100644
--- a/libc/async_safe/include/async_safe/CHECK.h
+++ b/libc/async_safe/include/async_safe/CHECK.h
@@ -36,12 +36,12 @@
 
 // TODO: replace this with something more like <android-base/logging.h>'s family of macros.
 
-#define CHECK(predicate) \
-  do { \
-    if (!(predicate)) { \
-      async_safe_fatal("%s:%d: %s CHECK '" #predicate "' failed", \
-          __FILE__, __LINE__, __FUNCTION__); \
-    } \
-  } while(0)
+#define CHECK(predicate)                                                                \
+  do {                                                                                  \
+    if (!(predicate)) {                                                                 \
+      async_safe_fatal("%s:%d: %s CHECK '%s' failed", __FILE__, __LINE__, __FUNCTION__, \
+                       #predicate);                                                     \
+    }                                                                                   \
+  } while (0)
 
 __END_DECLS
diff --git a/libc/bionic/clock.cpp b/libc/bionic/clock.cpp
index fda0708..31e6c3c 100644
--- a/libc/bionic/clock.cpp
+++ b/libc/bionic/clock.cpp
@@ -35,8 +35,6 @@
 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock.html
 clock_t clock() {
   timespec ts;
-  if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == -1) {
-    return -1;
-  }
+  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
   return (ts.tv_sec * CLOCKS_PER_SEC) + (ts.tv_nsec / (NS_PER_S / CLOCKS_PER_SEC));
 }
diff --git a/libc/bionic/exec.cpp b/libc/bionic/exec.cpp
index 3309585..fd2c401 100644
--- a/libc/bionic/exec.cpp
+++ b/libc/bionic/exec.cpp
@@ -44,9 +44,10 @@
 
 extern "C" char** environ;
 
-enum ExecVariant { kIsExecL, kIsExecLE, kIsExecLP };
+enum { ExecL, ExecLE, ExecLP };
 
-static int __execl(const char* name, const char* argv0, ExecVariant variant, va_list ap) {
+template <int variant>
+static int __execl(const char* name, const char* argv0, va_list ap) {
   // Count the arguments.
   va_list count_ap;
   va_copy(count_ap, ap);
@@ -65,17 +66,17 @@
   }
 
   // Collect the argp too.
-  char** argp = (variant == kIsExecLE) ? va_arg(ap, char**) : environ;
+  char** argp = (variant == ExecLE) ? va_arg(ap, char**) : environ;
 
   va_end(ap);
 
-  return (variant == kIsExecLP) ? execvp(name, argv) : execve(name, argv, argp);
+  return (variant == ExecLP) ? execvp(name, argv) : execve(name, argv, argp);
 }
 
 int execl(const char* name, const char* arg, ...) {
   va_list ap;
   va_start(ap, arg);
-  int result = __execl(name, arg, kIsExecL, ap);
+  int result = __execl<ExecL>(name, arg, ap);
   va_end(ap);
   return result;
 }
@@ -83,7 +84,7 @@
 int execle(const char* name, const char* arg, ...) {
   va_list ap;
   va_start(ap, arg);
-  int result = __execl(name, arg, kIsExecLE, ap);
+  int result = __execl<ExecLE>(name, arg, ap);
   va_end(ap);
   return result;
 }
@@ -91,7 +92,7 @@
 int execlp(const char* name, const char* arg, ...) {
   va_list ap;
   va_start(ap, arg);
-  int result = __execl(name, arg, kIsExecLP, ap);
+  int result = __execl<ExecLP>(name, arg, ap);
   va_end(ap);
   return result;
 }
diff --git a/libc/arch-arm64/mte/bionic/strlen.c b/libc/bionic/exit.cpp
similarity index 78%
rename from libc/arch-arm64/mte/bionic/strlen.c
rename to libc/bionic/exit.cpp
index de88320..a5aed78 100644
--- a/libc/arch-arm64/mte/bionic/strlen.c
+++ b/libc/bionic/exit.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2019 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,17 @@
  * SUCH DAMAGE.
  */
 
-#include <upstream-openbsd/android/include/openbsd-compat.h>
+#include <stdlib.h>
+#include <unistd.h>
 
-#define strlen strlen_mte
-#include <upstream-openbsd/lib/libc/string/strlen.c>
+#include "private/bionic_defs.h"
+
+extern "C" void __cxa_finalize(void* dso_handle);
+extern "C" void __cxa_thread_finalize();
+
+__BIONIC_WEAK_FOR_NATIVE_BRIDGE
+void exit(int status) {
+  __cxa_thread_finalize();
+  __cxa_finalize(nullptr);
+  _exit(status);
+}
diff --git a/libc/bionic/ffs.cpp b/libc/bionic/ffs.cpp
index b2270e5..aa7e504 100644
--- a/libc/bionic/ffs.cpp
+++ b/libc/bionic/ffs.cpp
@@ -26,8 +26,5 @@
  * SUCH DAMAGE.
  */
 
+#define __BIONIC_STRINGS_INLINE /* Out of line. */
 #include <strings.h>
-
-int ffs(int x) {
-  return __builtin_ffs(x);
-}
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp
index 62b5f5c..540372b 100644
--- a/libc/bionic/heap_tagging.cpp
+++ b/libc/bionic/heap_tagging.cpp
@@ -34,19 +34,19 @@
 #include <platform/bionic/mte_kernel.h>
 
 extern "C" void scudo_malloc_disable_memory_tagging();
+extern "C" void scudo_malloc_set_track_allocation_stacks(int);
 
 static HeapTaggingLevel heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
 
 void SetDefaultHeapTaggingLevel() {
 #if defined(__aarch64__)
-#define PR_SET_TAGGED_ADDR_CTRL 55
-#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
 #ifdef ANDROID_EXPERIMENTAL_MTE
   // First, try enabling MTE in asynchronous mode, with tag 0 excluded. This will fail if the kernel
   // or hardware doesn't support MTE, and we will fall back to just enabling tagged pointers in
   // syscall arguments.
   if (prctl(PR_SET_TAGGED_ADDR_CTRL,
-            PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_ASYNC | (1 << PR_MTE_EXCL_SHIFT), 0, 0, 0) == 0) {
+            PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_ASYNC | (0xfffe << PR_MTE_TAG_SHIFT), 0, 0,
+            0) == 0) {
     heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
     return;
   }
@@ -80,34 +80,48 @@
 
   switch (tag_level) {
     case M_HEAP_TAGGING_LEVEL_NONE:
+#if defined(USE_SCUDO)
+      scudo_malloc_disable_memory_tagging();
+#endif
+      if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
+        __libc_globals.mutate([](libc_globals* globals) {
+          // Preserve the untag mask (we still want to untag pointers when passing them to the
+          // allocator), but clear the fixed tag and the check mask, so that pointers are no longer
+          // tagged and checks no longer happen.
+          globals->heap_pointer_tag = static_cast<uintptr_t>(0xffull << UNTAG_SHIFT);
+        });
+      }
       break;
     case M_HEAP_TAGGING_LEVEL_TBI:
     case M_HEAP_TAGGING_LEVEL_ASYNC:
+    case M_HEAP_TAGGING_LEVEL_SYNC:
       if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_NONE) {
         error_log(
             "SetHeapTaggingLevel: re-enabling tagging after it was disabled is not supported");
-      } else {
-        error_log("SetHeapTaggingLevel: switching between TBI and ASYNC is not supported");
+        return false;
+      } else if (tag_level == M_HEAP_TAGGING_LEVEL_TBI ||
+                 heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
+        error_log("SetHeapTaggingLevel: switching between TBI and ASYNC/SYNC is not supported");
+        return false;
       }
-      return false;
+
+      if (tag_level == M_HEAP_TAGGING_LEVEL_ASYNC) {
+#if defined(USE_SCUDO)
+        scudo_malloc_set_track_allocation_stacks(0);
+#endif
+      } else if (tag_level == M_HEAP_TAGGING_LEVEL_SYNC) {
+#if defined(USE_SCUDO)
+        scudo_malloc_set_track_allocation_stacks(1);
+#endif
+      }
+      break;
     default:
       error_log("SetHeapTaggingLevel: unknown tagging level");
       return false;
   }
+
   heap_tagging_level = tag_level;
   info_log("SetHeapTaggingLevel: tag level set to %d", tag_level);
 
-  if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_NONE) {
-#if defined(USE_SCUDO)
-    scudo_malloc_disable_memory_tagging();
-#endif
-    __libc_globals.mutate([](libc_globals* globals) {
-      // Preserve the untag mask (we still want to untag pointers when passing them to the
-      // allocator if we were doing so before), but clear the fixed tag and the check mask,
-      // so that pointers are no longer tagged and checks no longer happen.
-      globals->heap_pointer_tag &= 0xffull << UNTAG_SHIFT;
-    });
-  }
-
   return true;
 }
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index a82ca50..1ede969 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -52,6 +52,8 @@
 #include "pthread_internal.h"
 
 extern "C" int __system_properties_init(void);
+extern "C" void scudo_malloc_set_zero_contents(int);
+extern "C" void scudo_malloc_set_pattern_fill_contents(int);
 
 __LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
 
@@ -83,6 +85,14 @@
   _thread_arc4_lock();
 }
 
+static void __libc_init_malloc_fill_contents() {
+#if defined(SCUDO_PATTERN_FILL_CONTENTS)
+  scudo_malloc_set_pattern_fill_contents(1);
+#elif defined(SCUDO_ZERO_CONTENTS)
+  scudo_malloc_set_zero_contents(1);
+#endif
+}
+
 __BIONIC_WEAK_FOR_NATIVE_BRIDGE
 void __libc_add_main_thread() {
   // Get the main thread from TLS and add it to the thread list.
@@ -106,6 +116,7 @@
   __libc_init_fdsan(); // Requires system properties (for debug.fdsan).
   __libc_init_fdtrack();
 
+  __libc_init_malloc_fill_contents();
   SetDefaultHeapTaggingLevel();
 }
 
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index da87c33..6a82ae3 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -366,6 +366,9 @@
   return true;
 }
 
+extern "C" const char* __scudo_get_stack_depot_addr();
+extern "C" const char* __scudo_get_region_info_addr();
+
 // Initializes memory allocation framework once per process.
 static void MallocInitImpl(libc_globals* globals) {
   char prop[PROP_VALUE_MAX];
@@ -373,6 +376,11 @@
 
   MaybeInitGwpAsanFromLibc(globals);
 
+#if defined(USE_SCUDO)
+  __libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr();
+  __libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr();
+#endif
+
   // Prefer malloc debug since it existed first and is a more complete
   // malloc interceptor than the hooks.
   bool hook_installed = false;
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp
index 51becf0..198bcba 100644
--- a/libc/bionic/malloc_heapprofd.cpp
+++ b/libc/bionic/malloc_heapprofd.cpp
@@ -56,8 +56,8 @@
 // +--->+-------------+------------------+
 // | +->+kInitialState+----------------+ |  malloc functions are not intercepted in any way.
 // | |  +-------+-----+                | |
-// | |          |                      | |
-// | |          v                      | |
+// | |          | HandleHeapprofd      | |
+// | |          v Signal()             | |
 // | |  +-------+----------------+     | |  currently installing the ephemeral hooks.
 // | |  |kInstallingEphemeralHook|<--+ | |
 // | |  +-------+----------------+   | | |
@@ -65,9 +65,9 @@
 // | |          v                    | | |
 // | |  +-------+---------------+    | | |  ephemeral hooks are installed. on the first call to
 // | |  |kEphemeralHookInstalled|    | | |  malloc these hooks spawn a thread that installs the
-// | |  +-------+---------------+    | | |  heapprofd hooks.
-// | |          |                    | | |
-// | |          v                    | | |
+// | |  +-------+---------------+    A B C  heapprofd hooks.
+// | |          | MallocInit         | | |
+// | |          v HeapprofdHook ()   | | |
 // | |  +-------+--------------+     | | |  first call to malloc happened. the hooks are reset to
 // | +--|kRemovingEphemeralHook|     | | |  kInitialState.
 // |    +----------------------+     | | |
@@ -81,7 +81,7 @@
 // |    +-------+------+             |   |  heapprofd hooks are installed. these forward calls to
 // |    |kHookInstalled|-------------+   |  malloc / free / etc. to heapprofd_client.so.
 // |    +-------+------+                 |
-// |            |                        |
+// |            | DispatchReset()        |
 // |            v                        |
 // |    +-------+---------+              |  currently resetting the hooks to default.
 // |----+kUninstallingHook|              |
@@ -92,6 +92,10 @@
 //      |kIncompatibleHooks+<------------+  precendence over heapprofd, so heapprofd will not get
 //      +------------------+                enabled. this is a terminal state.
 //
+//
+// A) HandleHeapprofdSignal()
+// B) HeapprofdInstallHooksAtInit() / InitHeapprofd()
+// C) HeapprofdRememberHookConflict()
 enum MallocHeapprofdState : uint8_t {
   kInitialState,
   kInstallingEphemeralHook,
diff --git a/libc/bionic/pthread_attr.cpp b/libc/bionic/pthread_attr.cpp
index 3c4b169..1551c1f 100644
--- a/libc/bionic/pthread_attr.cpp
+++ b/libc/bionic/pthread_attr.cpp
@@ -30,13 +30,13 @@
 
 #include <inttypes.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/resource.h>
 #include <unistd.h>
 
 #include <async_safe/log.h>
 
 #include "private/bionic_defs.h"
-#include "private/bionic_string_utils.h"
 #include "private/ErrnoRestorer.h"
 #include "pthread_internal.h"
 
diff --git a/libc/bionic/scudo/Android.bp b/libc/bionic/scudo/Android.bp
deleted file mode 100644
index 9b77c06..0000000
--- a/libc/bionic/scudo/Android.bp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright (C) 2019 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// 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
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-cc_library_shared {
-    name: "libscudo_wrapper",
-    vendor_available: true,
-    srcs: ["scudo.cpp"],
-
-    stl: "none",
-    system_shared_libs: [],
-    host_supported: false,
-
-    header_libs: ["libc_headers"],
-    include_dirs: [
-        "bionic/libc",
-        "bionic/libc/bionic",
-    ],
-
-    whole_static_libs: ["libasync_safe"],
-
-    arch: {
-        arm: {
-            whole_static_libs: ["libclang_rt.scudo_minimal-arm-android.static"],
-        },
-        arm64: {
-            whole_static_libs: ["libclang_rt.scudo_minimal-aarch64-android.static"],
-        },
-        x86: {
-            whole_static_libs: ["libclang_rt.scudo_minimal-i686-android.static"],
-        },
-        x86_64: {
-            whole_static_libs: ["libclang_rt.scudo_minimal-x86_64-android.static"],
-        },
-    },
-
-    // Will be referencing other libc code that won't be defined here.
-    allow_undefined_symbols: true,
-
-    multilib: {
-        lib32: {
-            version_script: "exported32.map",
-        },
-        lib64: {
-            version_script: "exported64.map",
-        },
-    },
-
-    // Like libc, disable native coverage for libscudo_wrapper.
-    native_coverage: false,
-}
diff --git a/libc/bionic/scudo/exported32.map b/libc/bionic/scudo/exported32.map
deleted file mode 100644
index 4b6791d..0000000
--- a/libc/bionic/scudo/exported32.map
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBC_SCUDO {
-  global:
-    scudo_aligned_alloc;
-    scudo_calloc;
-    scudo_free;
-    scudo_mallinfo;
-    scudo_malloc;
-    scudo_malloc_usable_size;
-    scudo_memalign;
-    scudo_posix_memalign;
-    scudo_pvalloc;
-    scudo_realloc;
-    scudo_valloc;
-  local:
-    *;
-};
diff --git a/libc/bionic/scudo/exported64.map b/libc/bionic/scudo/exported64.map
deleted file mode 100644
index 1346b4b..0000000
--- a/libc/bionic/scudo/exported64.map
+++ /dev/null
@@ -1,14 +0,0 @@
-LIBC_SCUDO {
-  global:
-    scudo_aligned_alloc;
-    scudo_calloc;
-    scudo_free;
-    scudo_mallinfo;
-    scudo_malloc;
-    scudo_malloc_usable_size;
-    scudo_memalign;
-    scudo_posix_memalign;
-    scudo_realloc;
-  local:
-    *;
-};
diff --git a/libc/bionic/scudo/scudo.cpp b/libc/bionic/scudo/scudo.cpp
deleted file mode 100644
index 2cd36b1..0000000
--- a/libc/bionic/scudo/scudo.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <malloc.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <sys/param.h>
-#include <sys/prctl.h>
-
-#include "platform/bionic/macros.h"
-
-#include "scudo.h"
-
-// Disable Scudo's mismatch allocation check, as it is being triggered
-// by some third party code.
-extern "C" const char *__scudo_default_options() {
-  return "DeallocationTypeMismatch=false";
-}
-
-static inline bool AllocTooBig(size_t bytes) {
-#if defined(__LP64__)
-  if (__predict_false(bytes > 0x10000000000ULL)) {
-#else
-  if (__predict_false(bytes > 0x80000000ULL)) {
-#endif
-    return true;
-  }
-  return false;
-}
-
-void* scudo_aligned_alloc(size_t alignment, size_t size) {
-  if (alignment == 0 || !powerof2(alignment) || (size % alignment) != 0) {
-    errno = EINVAL;
-    return nullptr;
-  }
-  if (AllocTooBig(size)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-
-  return aligned_alloc(alignment, size);
-}
-
-void* scudo_calloc(size_t item_count, size_t item_size) {
-  size_t total;
-  if (__builtin_mul_overflow(item_count, item_size, &total) || AllocTooBig(total)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  return calloc(item_count, item_size);
-}
-
-void scudo_free(void* ptr) {
-  free(ptr);
-}
-
-extern "C" size_t __sanitizer_get_current_allocated_bytes();
-extern "C" size_t __sanitizer_get_heap_size();
-
-struct mallinfo scudo_mallinfo() {
-  struct mallinfo info {};
-  info.uordblks = __sanitizer_get_current_allocated_bytes();
-  info.hblkhd = __sanitizer_get_heap_size();
-  info.usmblks = info.hblkhd;
-  return info;
-}
-
-void* scudo_malloc(size_t byte_count) {
-  if (AllocTooBig(byte_count)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  return malloc(byte_count);
-}
-
-size_t scudo_malloc_usable_size(const void* ptr) {
-  return malloc_usable_size(ptr);
-}
-
-void* scudo_memalign(size_t alignment, size_t byte_count) {
-  if (AllocTooBig(byte_count)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  if (alignment != 0) {
-    if (!powerof2(alignment)) {
-      alignment = BIONIC_ROUND_UP_POWER_OF_2(alignment);
-    }
-  } else {
-    alignment = 1;
-  }
-  return memalign(alignment, byte_count);
-}
-
-void* scudo_realloc(void* ptr, size_t byte_count) {
-  if (AllocTooBig(byte_count)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  return realloc(ptr, byte_count);
-}
-
-int scudo_posix_memalign(void** memptr, size_t alignment, size_t size) {
-  if (alignment < sizeof(void*) || !powerof2(alignment)) {
-    return EINVAL;
-  }
-  if (AllocTooBig(size)) {
-    return ENOMEM;
-  }
-  return posix_memalign(memptr, alignment, size);
-}
-
-#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
-extern "C" void* pvalloc(size_t);
-
-void* scudo_pvalloc(size_t size) {
-  if (AllocTooBig(size)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  return pvalloc(size);
-}
-
-extern "C" void* valloc(size_t);
-
-void* scudo_valloc(size_t size) {
-  if (AllocTooBig(size)) {
-    errno = ENOMEM;
-    return nullptr;
-  }
-  return valloc(size);
-}
-#endif
-
-// Do not try and name the scudo maps by overriding __sanitizer::internal_mmap.
-// There is already a function called MmapNamed that names the maps.
-// Unfortunately, there is no easy way to override MmapNamed because
-// too much of the code is not compiled into functions available in the
-// library, and the code is complicated.
diff --git a/libc/bionic/scudo_wrapper.cpp b/libc/bionic/scudo_wrapper.cpp
deleted file mode 100644
index 1624327..0000000
--- a/libc/bionic/scudo_wrapper.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-
-#include "scudo.h"
-#include "private/bionic_globals.h"
-#include "private/WriteProtected.h"
-
-__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
-
-// Call the libc malloc initialisers.
-__attribute__((constructor(1))) static void __scudo_preinit() {
-  __libc_globals.mutate(__libc_init_malloc);
-}
-
-extern "C" libc_shared_globals* __loader_shared_globals();
-
-__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals() {
-  return __loader_shared_globals();
-}
-
-#if defined(__i386__)
-__LIBC_HIDDEN__ void* __libc_sysinfo = reinterpret_cast<void*>(__libc_int0x80);
-#endif
-
-extern "C" void scudo_malloc_disable_memory_tagging() {}
-
-int scudo_mallopt(int /*param*/, int /*value*/) {
-  return 0;
-}
-
-int scudo_malloc_info(int /*options*/, FILE* /*fp*/) {
-  errno = ENOTSUP;
-  return -1;
-}
-
-int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
-  return 0;
-}
-
-void scudo_malloc_disable() {
-}
-
-void scudo_malloc_enable() {
-}
diff --git a/libc/bionic/sigaction.cpp b/libc/bionic/sigaction.cpp
index 583bf32..1cdb021 100644
--- a/libc/bionic/sigaction.cpp
+++ b/libc/bionic/sigaction.cpp
@@ -85,6 +85,28 @@
 
 extern "C" int __rt_sigaction(int, const struct sigaction64*, struct sigaction64*, size_t);
 
+// sigaction and sigaction64 get interposed in ART: ensure that we don't end up calling
+//     sigchain sigaction -> bionic sigaction -> sigchain sigaction64 -> bionic sigaction64
+// by extracting the implementation of sigaction64 to a static function.
+static int __sigaction64(int signal, const struct sigaction64* bionic_new,
+                         struct sigaction64* bionic_old) {
+  struct sigaction64 kernel_new;
+  if (bionic_new) {
+    kernel_new = *bionic_new;
+#if defined(SA_RESTORER)
+    if (!(kernel_new.sa_flags & SA_RESTORER)) {
+      kernel_new.sa_flags |= SA_RESTORER;
+      kernel_new.sa_restorer = (kernel_new.sa_flags & SA_SIGINFO) ? &__restore_rt : &__restore;
+    }
+#endif
+    // Don't filter signals here; if the caller asked for everything to be blocked, we should obey.
+    kernel_new.sa_mask = kernel_new.sa_mask;
+  }
+
+  return __rt_sigaction(signal, bionic_new ? &kernel_new : nullptr, bionic_old,
+                        sizeof(kernel_new.sa_mask));
+}
+
 int sigaction(int signal, const struct sigaction* bionic_new, struct sigaction* bionic_old) {
   // The 32-bit ABI is broken. struct sigaction includes a too-small sigset_t,
   // so we have to translate to struct sigaction64 first.
@@ -101,7 +123,7 @@
   }
 
   struct sigaction64 kernel_old;
-  int result = sigaction64(signal, bionic_new ? &kernel_new : nullptr, &kernel_old);
+  int result = __sigaction64(signal, bionic_new ? &kernel_new : nullptr, &kernel_old);
   if (bionic_old) {
     *bionic_old = {};
     bionic_old->sa_flags = kernel_old.sa_flags;
@@ -115,23 +137,7 @@
 }
 
 int sigaction64(int signal, const struct sigaction64* bionic_new, struct sigaction64* bionic_old) {
-  struct sigaction64 kernel_new;
-  if (bionic_new) {
-    kernel_new = *bionic_new;
-#if defined(SA_RESTORER)
-    if (!(kernel_new.sa_flags & SA_RESTORER)) {
-      kernel_new.sa_flags |= SA_RESTORER;
-      kernel_new.sa_restorer = (kernel_new.sa_flags & SA_SIGINFO) ? &__restore_rt : &__restore;
-    }
-#endif
-    // Don't filter signals here; if the caller asked for everything to be blocked, we should obey.
-    kernel_new.sa_mask = kernel_new.sa_mask;
-  }
-
-  return __rt_sigaction(signal,
-                        bionic_new ? &kernel_new : nullptr,
-                        bionic_old,
-                        sizeof(kernel_new.sa_mask));
+  return __sigaction64(signal, bionic_new, bionic_old);
 }
 
 #endif
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index 56822ac..212aafc 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -209,7 +209,6 @@
       // mostly for ctl.* properties, but we do try and wait 250
       // ms so callers who do read-after-write can reliably see
       // what they've written.  Most of the time.
-      // TODO: fix the system properties design.
       async_safe_format_log(ANDROID_LOG_WARN, "libc",
                             "Property service has timed out while trying to set \"%s\" to \"%s\"",
                             msg->name, msg->value);
diff --git a/libc/bionic/tmpfile.cpp b/libc/bionic/tmpfile.cpp
index 4378e84..d7ce897 100644
--- a/libc/bionic/tmpfile.cpp
+++ b/libc/bionic/tmpfile.cpp
@@ -31,6 +31,7 @@
  */
 
 #include <errno.h>
+#include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -39,48 +40,48 @@
 #include <unistd.h>
 
 #include "private/ErrnoRestorer.h"
-#include "private/ScopedSignalBlocker.h"
 
-static FILE* __tmpfile_dir(const char* tmp_dir) {
+static FILE* __fd_to_fp(int fd) {
+  FILE* fp = fdopen(fd, "w+");
+  if (fp != nullptr) return fp;
+
+  ErrnoRestorer errno_restorer;
+  close(fd);
+  return nullptr;
+}
+
+static FILE* __tmpfile_dir_legacy(const char* tmp_dir) {
   char* path = nullptr;
   if (asprintf(&path, "%s/tmp.XXXXXXXXXX", tmp_dir) == -1) {
     return nullptr;
   }
 
-  int fd;
-  {
-    ScopedSignalBlocker ssb;
-    fd = mkstemp(path);
-    if (fd == -1) {
-      free(path);
-      return nullptr;
-    }
-
-    // Unlink the file now so that it's removed when closed.
-    unlink(path);
+  int fd = mkstemp(path);
+  if (fd == -1) {
     free(path);
-
-    // Can we still use the file now it's unlinked?
-    // File systems without hard link support won't have the usual Unix semantics.
-    struct stat sb;
-    int rc = fstat(fd, &sb);
-    if (rc == -1) {
-      ErrnoRestorer errno_restorer;
-      close(fd);
-      return nullptr;
-    }
+    return nullptr;
   }
 
-  // Turn the file descriptor into a FILE*.
-  FILE* fp = fdopen(fd, "w+");
-  if (fp != nullptr) {
-    return fp;
+  // Unlink the file now so that it's removed when closed.
+  unlink(path);
+  free(path);
+
+  // Can we still use the file now it's unlinked?
+  // File systems without hard link support won't have the usual Unix semantics.
+  struct stat sb;
+  if (fstat(fd, &sb) == -1) {
+    ErrnoRestorer errno_restorer;
+    close(fd);
+    return nullptr;
   }
 
-  // Failure. Clean up. We already unlinked, so we just need to close.
-  ErrnoRestorer errno_restorer;
-  close(fd);
-  return nullptr;
+  return __fd_to_fp(fd);
+}
+
+static FILE* __tmpfile_dir(const char* tmp_dir) {
+  int fd = open(tmp_dir, O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
+  if (fd == -1) return __tmpfile_dir_legacy(tmp_dir);
+  return __fd_to_fp(fd);
 }
 
 FILE* tmpfile() {
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 1b8af78..50cb61a 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -110,6 +110,9 @@
 /** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */
 #define __ANDROID_API_R__ 30
 
+/** Names the "S" API level (31), for comparison against `__ANDROID_API__`. */
+#define __ANDROID_API_S__ 31
+
 /**
  * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__`
  * if there is no known target SDK version (for code not running in the
diff --git a/libc/include/bits/auxvec.h b/libc/include/bits/auxvec.h
index 4d39477..2d6522a 100644
--- a/libc/include/bits/auxvec.h
+++ b/libc/include/bits/auxvec.h
@@ -37,6 +37,14 @@
 
 #include <linux/auxvec.h>
 
+// AT_HWCAP isn't useful without these constants.
+#if __has_include(<asm/hwcap.h>)
+#include <asm/hwcap.h>
+#endif
+#if __has_include(<asm/hwcap2.h>)
+#include <asm/hwcap2.h>
+#endif
+
 /** Historical SuperH cruft. Irrelevant on Android. */
 #define AT_FPUCW 18
 /** Historical PowerPC cruft. Irrelevant on Android. */
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index aabcaab..0e3014d 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -702,6 +702,9 @@
 #if defined(__NR_openat)
   #define SYS_openat __NR_openat
 #endif
+#if defined(__NR_openat2)
+  #define SYS_openat2 __NR_openat2
+#endif
 #if defined(__NR_pause)
   #define SYS_pause __NR_pause
 #endif
@@ -720,6 +723,9 @@
 #if defined(__NR_personality)
   #define SYS_personality __NR_personality
 #endif
+#if defined(__NR_pidfd_getfd)
+  #define SYS_pidfd_getfd __NR_pidfd_getfd
+#endif
 #if defined(__NR_pidfd_open)
   #define SYS_pidfd_open __NR_pidfd_open
 #endif
diff --git a/libc/include/bits/stdatomic.h b/libc/include/bits/stdatomic.h
index 633cb86..2ce6ee6 100644
--- a/libc/include/bits/stdatomic.h
+++ b/libc/include/bits/stdatomic.h
@@ -41,7 +41,7 @@
  */
 
 #include <stddef.h>  /* For ptrdiff_t. */
-#include <stdint.h>  /* TODO: don't drag in all the macros, just the types. */
+#include <stdint.h>
 // Include uchar.h only when available.  Bionic's stdatomic.h is also used for
 // the host (via a copy in prebuilts/clang) and uchar.h is not available in the
 // glibc used for the host.
diff --git a/libc/include/dirent.h b/libc/include/dirent.h
index d6819f2..2328b1a 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -26,8 +26,12 @@
  * SUCH DAMAGE.
  */
 
-#ifndef _DIRENT_H_
-#define _DIRENT_H_
+#pragma once
+
+/**
+ * @file dirent.h
+ * @brief Directory entry iteration.
+ */
 
 #include <stdint.h>
 #include <sys/cdefs.h>
@@ -35,17 +39,23 @@
 
 __BEGIN_DECLS
 
-#ifndef DT_UNKNOWN
+/** d_type value when the type is not known. */
 #define DT_UNKNOWN 0
+/** d_type value for a FIFO. */
 #define DT_FIFO 1
+/** d_type value for a character device. */
 #define DT_CHR 2
+/** d_type value for a directory. */
 #define DT_DIR 4
+/** d_type value for a block device. */
 #define DT_BLK 6
+/** d_type value for a regular file. */
 #define DT_REG 8
+/** d_type value for a symbolic link. */
 #define DT_LNK 10
+/** d_type value for a socket. */
 #define DT_SOCK 12
 #define DT_WHT 14
-#endif
 
 #if defined(__LP64__)
 #define __DIRENT64_INO_T ino_t
@@ -60,7 +70,9 @@
     unsigned char d_type; \
     char d_name[256]; \
 
+/** The structure returned by readdir(). Identical to dirent64 on Android. */
 struct dirent { __DIRENT64_BODY };
+/** The structure returned by readdir64(). Identical to dirent on Android. */
 struct dirent64 { __DIRENT64_BODY };
 
 #undef __DIRENT64_BODY
@@ -74,29 +86,158 @@
 
 #define d_fileno d_ino
 
+/** The structure returned by opendir()/fopendir(). */
 typedef struct DIR DIR;
 
+/**
+ * [opendir(3)](http://man7.org/linux/man-pages/man3/opendir.3.html)
+ * opens a directory stream for the directory at `__path`.
+ *
+ * Returns null and sets `errno` on failure.
+ */
 DIR* opendir(const char* __path);
+
+/**
+ * [fopendir(3)](http://man7.org/linux/man-pages/man3/opendir.3.html)
+ * opens a directory stream for the directory at `__dir_fd`.
+ *
+ * Returns null and sets `errno` on failure.
+ */
 DIR* fdopendir(int __dir_fd);
+
+/**
+ * [readdir(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
+ * returns the next directory entry in the given directory.
+ *
+ * Returns a pointer to a directory entry on success,
+ * or returns null and leaves `errno` unchanged at the end of the directory,
+ * or returns null and sets `errno` on failure.
+ */
 struct dirent* readdir(DIR* __dir);
+
+/**
+ * [readdir64(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
+ * returns the next directory entry in the given directory.
+ *
+ * Returns a pointer to a directory entry on success,
+ * or returns null and leaves `errno` unchanged at the end of the directory,
+ * or returns null and sets `errno` on failure.
+ */
 struct dirent64* readdir64(DIR* __dir) __INTRODUCED_IN(21);
+
 int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
 int readdir64_r(DIR* __dir, struct dirent64* __entry, struct dirent64** __buffer) __INTRODUCED_IN(21) __attribute__((__deprecated__("readdir64_r is deprecated; use readdir64 instead")));
+
+/**
+ * [closedir(3)](http://man7.org/linux/man-pages/man3/closedir.3.html)
+ * closes a directory stream.
+ *
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
+ */
 int closedir(DIR* __dir);
+
+/**
+ * [rewinddir(3)](http://man7.org/linux/man-pages/man3/rewinddir.3.html)
+ * rewinds a directory stream to the first entry.
+ */
 void rewinddir(DIR* __dir);
+
+/**
+ * [seekdir(3)](http://man7.org/linux/man-pages/man3/seekdir.3.html)
+ * seeks a directory stream to the given entry, which must be a value returned
+ * by telldir().
+ *
+ * Available since API level 23.
+ */
 void seekdir(DIR* __dir, long __location) __INTRODUCED_IN(23);
+
+/**
+ * [telldir(3)](http://man7.org/linux/man-pages/man3/telldir.3.html)
+ * returns a value representing the current position in the directory
+ * for use with seekdir().
+ *
+ * Returns the current position on success and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 23.
+ */
 long telldir(DIR* __dir) __INTRODUCED_IN(23);
+
+/**
+ * [dirfd(3)](http://man7.org/linux/man-pages/man3/dirfd.3.html)
+ * returns the file descriptor backing the given directory stream.
+ *
+ * Returns a file descriptor on success and returns -1 and sets `errno` on failure.
+ */
 int dirfd(DIR* __dir);
+
+/**
+ * [alphasort](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
+ * comparator for use with scandir() that uses strcoll().
+ */
 int alphasort(const struct dirent** __lhs, const struct dirent** __rhs);
+
+/**
+ * [alphasort64](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
+ * comparator for use with scandir64() that uses strcmp().
+ *
+ * Available since API level 21.
+ */
 int alphasort64(const struct dirent64** __lhs, const struct dirent64** __rhs) __INTRODUCED_IN(21);
-int scandir64(const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
+
+/**
+ * [scandir(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
+ * scans all the directory `__path`, filtering entries with `__filter` and
+ * sorting them with qsort() using the given `__comparator`, and storing them
+ * into `__name_list`. Passing NULL as the filter accepts all entries.
+ *
+ * Returns the number of entries returned in the list on success,
+ * and returns -1 and sets `errno` on failure.
+ */
 int scandir(const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**));
 
+/**
+ * [scandir64(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
+ * scans all the directory `__path`, filtering entries with `__filter` and
+ * sorting them with qsort() using the given `__comparator`, and storing them
+ * into `__name_list`. Passing NULL as the filter accepts all entries.
+ *
+ * Returns the number of entries returned in the list on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 21.
+ */
+int scandir64(const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
+
 #if defined(__USE_GNU)
+
+/**
+ * [scandirat64(3)](http://man7.org/linux/man-pages/man3/scandirat.3.html)
+ * scans all the directory referenced by the pair of `__dir_fd` and `__path`,
+ * filtering entries with `__filter` and sorting them with qsort() using the
+ * given `__comparator`, and storing them into `__name_list`. Passing NULL as
+ * the filter accepts all entries.
+ *
+ * Returns the number of entries returned in the list on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 24.
+ */
 int scandirat64(int __dir_fd, const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(24);
+
+/**
+ * [scandirat(3)](http://man7.org/linux/man-pages/man3/scandirat.3.html)
+ * scans all the directory referenced by the pair of `__dir_fd` and `__path`,
+ * filtering entries with `__filter` and sorting them with qsort() using the
+ * given `__comparator`, and storing them into `__name_list`. Passing NULL as
+ * the filter accepts all entries.
+ *
+ * Returns the number of entries returned in the list on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 24.
+ */
 int scandirat(int __dir_fd, const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**)) __INTRODUCED_IN(24);
+
 #endif
 
 __END_DECLS
-
-#endif
diff --git a/libc/include/strings.h b/libc/include/strings.h
index 08c2326..ff6b925 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -49,6 +49,14 @@
 
 #include <bits/strcasecmp.h>
 
+#if !defined(__BIONIC_STRINGS_INLINE)
+#define __BIONIC_STRINGS_INLINE static __inline
+#endif
+
+#undef ffs
+#undef ffsl
+#undef ffsll
+
 __BEGIN_DECLS
 
 /** Deprecated. Use memmove() instead. */
@@ -63,19 +71,41 @@
   __builtin_memset(b, 0, len);
 }
 
-#if !defined(__i386__) || __ANDROID_API__ >= 18
 /**
- * [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the first set bit in `__i`.
+ * [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the
+ * first set bit in `__n`.
  *
- * Returns 0 if no bit is set, or the index of the lowest set bit (counting from 1) otherwise.
+ * Returns 0 if no bit is set, or the index of the lowest set bit (counting
+ * from 1) otherwise.
  */
-int ffs(int __i) __INTRODUCED_IN_X86(18);
-#endif
+__BIONIC_STRINGS_INLINE int ffs(int __n) {
+  return __builtin_ffs(__n);
+}
+
+/**
+ * [ffsl(3)](http://man7.org/linux/man-pages/man3/ffsl.3.html) finds the
+ * first set bit in `__n`.
+ *
+ * Returns 0 if no bit is set, or the index of the lowest set bit (counting
+ * from 1) otherwise.
+ */
+__BIONIC_STRINGS_INLINE int ffsl(long __n) {
+  return __builtin_ffsl(__n);
+}
+
+/**
+ * [ffsll(3)](http://man7.org/linux/man-pages/man3/ffsll.3.html) finds the
+ * first set bit in `__n`.
+ *
+ * Returns 0 if no bit is set, or the index of the lowest set bit (counting
+ * from 1) otherwise.
+ */
+__BIONIC_STRINGS_INLINE int ffsll(long long __n) {
+  return __builtin_ffsll(__n);
+}
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
 #include <bits/fortify/strings.h>
 #endif
 
 __END_DECLS
-
-#include <android/legacy_strings_inlines.h>
diff --git a/libc/include/sys/auxv.h b/libc/include/sys/auxv.h
index c651940..bf70dda 100644
--- a/libc/include/sys/auxv.h
+++ b/libc/include/sys/auxv.h
@@ -40,7 +40,7 @@
 __BEGIN_DECLS
 
 /**
- * [getauxval(3)](http://man7.org/linux/man-pages/man2/personality.2.html) returns values from
+ * [getauxval(3)](http://man7.org/linux/man-pages/man3/getauxval.3.html) returns values from
  * the ELF auxiliary vector passed by the kernel.
  *
  * Returns the corresponding value on success,
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index 92a2139..2c2d001 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -112,6 +112,7 @@
     if arch and arch in kernel_arch_token_replacements:
         blocks.replaceTokens(kernel_arch_token_replacements[arch])
 
+    blocks.removeStructs(kernel_structs_to_remove)
     blocks.optimizeMacros(macros)
     blocks.optimizeIf01()
     blocks.removeVarsAndFuncs(kernel_known_generic_statics)
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 1ada59e..b6a1538 100755
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -30,10 +30,7 @@
 # Note that setting LD_LIBRARY_PATH with os.putenv() sometimes doesn't help.
 clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/sdk/tools/linux/lib64/libclang_android.so'))
 
-from defaults import kCppUndefinedMacro
-from defaults import kernel_remove_config_macros
-from defaults import kernel_struct_replacements
-from defaults import kernel_token_replacements
+from defaults import *
 
 
 debugBlockParser = False
@@ -1198,6 +1195,52 @@
             if b.isIf():
                 b.expr.optimize(macros)
 
+    def removeStructs(self, structs):
+        """Remove structs."""
+        for b in self.blocks:
+            # Have to look in each block for a top-level struct definition.
+            if b.directive:
+                continue
+            num_tokens = len(b.tokens)
+            # A struct definition has at least 5 tokens:
+            #   struct
+            #   ident
+            #   {
+            #   }
+            #   ;
+            if num_tokens < 5:
+                continue
+            # This is a simple struct finder, it might fail if a top-level
+            # structure has an #if type directives that confuses the algorithm
+            # for finding th end of the structure. Or if there is another
+            # structure definition embedded in the structure.
+            i = 0
+            while i < num_tokens - 2:
+                if (b.tokens[i].kind != TokenKind.KEYWORD or
+                    b.tokens[i].id != "struct"):
+                    i += 1
+                    continue
+                if (b.tokens[i + 1].kind == TokenKind.IDENTIFIER and
+                    b.tokens[i + 2].kind == TokenKind.PUNCTUATION and
+                    b.tokens[i + 2].id == "{" and b.tokens[i + 1].id in structs):
+                    # Search forward for the end of the structure.
+                    # Very simple search, look for } and ; tokens. If something
+                    # more complicated is needed we can add it later.
+                    j = i + 3
+                    while j < num_tokens - 1:
+                        if (b.tokens[j].kind == TokenKind.PUNCTUATION and
+                            b.tokens[j].id == "}" and
+                            b.tokens[j + 1].kind == TokenKind.PUNCTUATION and
+                            b.tokens[j + 1].id == ";"):
+                            b.tokens = b.tokens[0:i] + b.tokens[j + 2:num_tokens]
+                            num_tokens = len(b.tokens)
+                            j = i
+                            break
+                        j += 1
+                    i = j
+                    continue
+                i += 1
+
     def optimizeAll(self, macros):
         self.optimizeMacros(macros)
         self.optimizeIf01()
@@ -1755,7 +1798,6 @@
     def parse(self, text, macros=None):
         out = utils.StringOutput()
         blocks = BlockParser().parse(CppStringTokenizer(text))
-        blocks.replaceTokens(kernel_token_replacements)
         blocks.optimizeAll(macros)
         blocks.write(out)
         return out.get()
@@ -1931,8 +1973,8 @@
 #endif /* SIGRTMAX */
 """
         expected = """\
-#ifndef __SIGRTMAX
-#define __SIGRTMAX 123
+#ifndef SIGRTMAX
+#define SIGRTMAX 123
 #endif
 """
         self.assertEqual(self.parse(text), expected)
@@ -1948,6 +1990,146 @@
         expected = ""
         self.assertEqual(self.parse(text), expected)
 
+class RemoveStructsTests(unittest.TestCase):
+    def parse(self, text, structs):
+        out = utils.StringOutput()
+        blocks = BlockParser().parse(CppStringTokenizer(text))
+        blocks.removeStructs(structs)
+        blocks.write(out)
+        return out.get()
+
+    def test_remove_struct_from_start(self):
+        text = """\
+struct remove {
+  int val1;
+  int val2;
+};
+struct something {
+  struct timeval val1;
+  struct timeval val2;
+};
+"""
+        expected = """\
+struct something {
+  struct timeval val1;
+  struct timeval val2;
+};
+"""
+        self.assertEqual(self.parse(text, set(["remove"])), expected)
+
+    def test_remove_struct_from_end(self):
+        text = """\
+struct something {
+  struct timeval val1;
+  struct timeval val2;
+};
+struct remove {
+  int val1;
+  int val2;
+};
+"""
+        expected = """\
+struct something {
+  struct timeval val1;
+  struct timeval val2;
+};
+"""
+        self.assertEqual(self.parse(text, set(["remove"])), expected)
+
+    def test_remove_minimal_struct(self):
+        text = """\
+struct remove {
+};
+"""
+        expected = "";
+        self.assertEqual(self.parse(text, set(["remove"])), expected)
+
+    def test_remove_struct_with_struct_fields(self):
+        text = """\
+struct something {
+  struct remove val1;
+  struct remove val2;
+};
+struct remove {
+  int val1;
+  struct something val3;
+  int val2;
+};
+"""
+        expected = """\
+struct something {
+  struct remove val1;
+  struct remove val2;
+};
+"""
+        self.assertEqual(self.parse(text, set(["remove"])), expected)
+
+    def test_remove_consecutive_structs(self):
+        text = """\
+struct keep1 {
+  struct timeval val1;
+  struct timeval val2;
+};
+struct remove1 {
+  int val1;
+  int val2;
+};
+struct remove2 {
+  int val1;
+  int val2;
+  int val3;
+};
+struct keep2 {
+  struct timeval val1;
+  struct timeval val2;
+};
+"""
+        expected = """\
+struct keep1 {
+  struct timeval val1;
+  struct timeval val2;
+};
+struct keep2 {
+  struct timeval val1;
+  struct timeval val2;
+};
+"""
+        self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
+
+    def test_remove_multiple_structs(self):
+        text = """\
+struct keep1 {
+  int val;
+};
+struct remove1 {
+  int val1;
+  int val2;
+};
+struct keep2 {
+  int val;
+};
+struct remove2 {
+  struct timeval val1;
+  struct timeval val2;
+};
+struct keep3 {
+  int val;
+};
+"""
+        expected = """\
+struct keep1 {
+  int val;
+};
+struct keep2 {
+  int val;
+};
+struct keep3 {
+  int val;
+};
+"""
+        self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
+
+
 class FullPathTest(unittest.TestCase):
     """Test of the full path parsing."""
 
@@ -1956,9 +2138,12 @@
             keep = set()
         out = utils.StringOutput()
         blocks = BlockParser().parse(CppStringTokenizer(text))
+
+        blocks.removeStructs(kernel_structs_to_remove)
         blocks.removeVarsAndFuncs(keep)
         blocks.replaceTokens(kernel_token_replacements)
         blocks.optimizeAll(None)
+
         blocks.write(out)
         return out.get()
 
@@ -2241,6 +2426,38 @@
 """
         self.assertEqual(self.parse(text), expected)
 
+    def test_verify_timeval_itemerval(self):
+        text = """\
+struct __kernel_old_timeval {
+  struct something val;
+};
+struct __kernel_old_itimerval {
+  struct __kernel_old_timeval val;
+};
+struct fields {
+  struct __kernel_old_timeval timeval;
+  struct __kernel_old_itimerval itimerval;
+};
+"""
+        expected = """\
+struct fields {
+  struct timeval timeval;
+  struct itimerval itimerval;
+};
+"""
+        self.assertEqual(self.parse(text), expected)
+
+    def test_token_replacement(self):
+        text = """\
+#define SIGRTMIN 32
+#define SIGRTMAX _NSIG
+"""
+        expected = """\
+#define __SIGRTMIN 32
+#define __SIGRTMAX _KERNEL__NSIG
+"""
+        self.assertEqual(self.parse(text), expected)
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 90b56f5..04eb5f1 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -35,6 +35,17 @@
     "__kernel_old_timeval": "1",
     }
 
+# this is the set of known kernel data structures we want to remove from
+# the final headers
+kernel_structs_to_remove = set(
+        [
+          # Remove the structures since they are still the same as
+          # timeval, itimerval.
+          "__kernel_old_timeval",
+          "__kernel_old_itimerval",
+        ]
+    )
+
 # define to true if you want to remove all defined(CONFIG_FOO) tests
 # from the clean headers. testing shows that this is not strictly necessary
 # but just generates cleaner results
@@ -86,6 +97,8 @@
     # If struct __kernel_old_timeval and struct timeval become different,
     # then a different solution needs to be implemented.
     "__kernel_old_timeval": "timeval",
+    # Do the same for __kernel_old_itimerval as for timeval.
+    "__kernel_old_itimerval": "itimerval",
     }
 
 
diff --git a/libc/kernel/tools/generate_uapi_headers.sh b/libc/kernel/tools/generate_uapi_headers.sh
index 088c12e..4e7d2af 100755
--- a/libc/kernel/tools/generate_uapi_headers.sh
+++ b/libc/kernel/tools/generate_uapi_headers.sh
@@ -264,11 +264,6 @@
                  "${ANDROID_KERNEL_DIR}/uapi/asm-${arch}/asm"
 done
 
-# The arm types.h uapi header is not properly being generated, so copy it
-# directly.
-cp "${KERNEL_DIR}/include/uapi/asm-generic/types.h" \
-   "${ANDROID_KERNEL_DIR}/uapi/asm-arm/asm"
-
 # Verify if modified headers have changed.
 verify_modified_hdrs "${KERNEL_DIR}/include/scsi" \
                      "${ANDROID_KERNEL_DIR}/scsi" \
diff --git a/libc/kernel/uapi/asm-arm/asm/kvm.h b/libc/kernel/uapi/asm-arm/asm/kvm.h
deleted file mode 100644
index 6a6d963..0000000
--- a/libc/kernel/uapi/asm-arm/asm/kvm.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __ARM_KVM_H__
-#define __ARM_KVM_H__
-#include <linux/types.h>
-#include <linux/psci.h>
-#include <asm/ptrace.h>
-#define __KVM_HAVE_GUEST_DEBUG
-#define __KVM_HAVE_IRQ_LINE
-#define __KVM_HAVE_READONLY_MEM
-#define __KVM_HAVE_VCPU_EVENTS
-#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
-#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
-#define KVM_ARM_SVC_sp svc_regs[0]
-#define KVM_ARM_SVC_lr svc_regs[1]
-#define KVM_ARM_SVC_spsr svc_regs[2]
-#define KVM_ARM_ABT_sp abt_regs[0]
-#define KVM_ARM_ABT_lr abt_regs[1]
-#define KVM_ARM_ABT_spsr abt_regs[2]
-#define KVM_ARM_UND_sp und_regs[0]
-#define KVM_ARM_UND_lr und_regs[1]
-#define KVM_ARM_UND_spsr und_regs[2]
-#define KVM_ARM_IRQ_sp irq_regs[0]
-#define KVM_ARM_IRQ_lr irq_regs[1]
-#define KVM_ARM_IRQ_spsr irq_regs[2]
-#define KVM_ARM_FIQ_r8 fiq_regs[0]
-#define KVM_ARM_FIQ_r9 fiq_regs[1]
-#define KVM_ARM_FIQ_r10 fiq_regs[2]
-#define KVM_ARM_FIQ_fp fiq_regs[3]
-#define KVM_ARM_FIQ_ip fiq_regs[4]
-#define KVM_ARM_FIQ_sp fiq_regs[5]
-#define KVM_ARM_FIQ_lr fiq_regs[6]
-#define KVM_ARM_FIQ_spsr fiq_regs[7]
-struct kvm_regs {
-  struct pt_regs usr_regs;
-  unsigned long svc_regs[3];
-  unsigned long abt_regs[3];
-  unsigned long und_regs[3];
-  unsigned long irq_regs[3];
-  unsigned long fiq_regs[8];
-};
-#define KVM_ARM_TARGET_CORTEX_A15 0
-#define KVM_ARM_TARGET_CORTEX_A7 1
-#define KVM_ARM_NUM_TARGETS 2
-#define KVM_ARM_DEVICE_TYPE_SHIFT 0
-#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
-#define KVM_ARM_DEVICE_ID_SHIFT 16
-#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
-#define KVM_ARM_DEVICE_VGIC_V2 0
-#define KVM_VGIC_V2_ADDR_TYPE_DIST 0
-#define KVM_VGIC_V2_ADDR_TYPE_CPU 1
-#define KVM_VGIC_V2_DIST_SIZE 0x1000
-#define KVM_VGIC_V2_CPU_SIZE 0x2000
-#define KVM_VGIC_V3_ADDR_TYPE_DIST 2
-#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3
-#define KVM_VGIC_ITS_ADDR_TYPE 4
-#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION 5
-#define KVM_VGIC_V3_DIST_SIZE SZ_64K
-#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K)
-#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K)
-#define KVM_ARM_VCPU_POWER_OFF 0
-#define KVM_ARM_VCPU_PSCI_0_2 1
-struct kvm_vcpu_init {
-  __u32 target;
-  __u32 features[7];
-};
-struct kvm_sregs {
-};
-struct kvm_fpu {
-};
-struct kvm_guest_debug_arch {
-};
-struct kvm_debug_exit_arch {
-};
-struct kvm_sync_regs {
-  __u64 device_irq_level;
-};
-struct kvm_arch_memory_slot {
-};
-struct kvm_vcpu_events {
-  struct {
-    __u8 serror_pending;
-    __u8 serror_has_esr;
-    __u8 ext_dabt_pending;
-    __u8 pad[5];
-    __u64 serror_esr;
-  } exception;
-  __u32 reserved[12];
-};
-#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000
-#define KVM_REG_ARM_COPROC_SHIFT 16
-#define KVM_REG_ARM_32_OPC2_MASK 0x0000000000000007
-#define KVM_REG_ARM_32_OPC2_SHIFT 0
-#define KVM_REG_ARM_OPC1_MASK 0x0000000000000078
-#define KVM_REG_ARM_OPC1_SHIFT 3
-#define KVM_REG_ARM_CRM_MASK 0x0000000000000780
-#define KVM_REG_ARM_CRM_SHIFT 7
-#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800
-#define KVM_REG_ARM_32_CRN_SHIFT 11
-#define KVM_REG_ARM_SECURE_MASK 0x0000000010000000
-#define KVM_REG_ARM_SECURE_SHIFT 28
-#define ARM_CP15_REG_SHIFT_MASK(x,n) (((x) << KVM_REG_ARM_ ##n ##_SHIFT) & KVM_REG_ARM_ ##n ##_MASK)
-#define __ARM_CP15_REG(op1,crn,crm,op2) (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | ARM_CP15_REG_SHIFT_MASK(crm, CRM) | ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2))
-#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32)
-#define __ARM_CP15_REG64(op1,crm) (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64)
-#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__)
-#define KVM_REG_ARM_PTIMER_CTL ARM_CP15_REG32(0, 14, 2, 1)
-#define KVM_REG_ARM_PTIMER_CNT ARM_CP15_REG64(0, 14)
-#define KVM_REG_ARM_PTIMER_CVAL ARM_CP15_REG64(2, 14)
-#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1)
-#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14)
-#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14)
-#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
-#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4)
-#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT)
-#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00
-#define KVM_REG_ARM_DEMUX_ID_SHIFT 8
-#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT)
-#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF
-#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0
-#define KVM_REG_ARM_VFP (0x0012 << KVM_REG_ARM_COPROC_SHIFT)
-#define KVM_REG_ARM_VFP_MASK 0x000000000000FFFF
-#define KVM_REG_ARM_VFP_BASE_REG 0x0
-#define KVM_REG_ARM_VFP_FPSID 0x1000
-#define KVM_REG_ARM_VFP_FPSCR 0x1001
-#define KVM_REG_ARM_VFP_MVFR1 0x1006
-#define KVM_REG_ARM_VFP_MVFR0 0x1007
-#define KVM_REG_ARM_VFP_FPEXC 0x1008
-#define KVM_REG_ARM_VFP_FPINST 0x1009
-#define KVM_REG_ARM_VFP_FPINST2 0x100A
-#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
-#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
-#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
-#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
-#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
-#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
-#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
-#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32
-#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
-#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32
-#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT)
-#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
-#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
-#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff)
-#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
-#define KVM_DEV_ARM_VGIC_GRP_CTRL 4
-#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
-#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
-#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7
-#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
-#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10
-#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
-#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
-#define VGIC_LEVEL_INFO_LINE_LEVEL 0
-#define KVM_ARM_VCPU_PMU_V3_CTRL 0
-#define KVM_ARM_VCPU_PMU_V3_IRQ 0
-#define KVM_ARM_VCPU_PMU_V3_INIT 1
-#define KVM_ARM_VCPU_TIMER_CTRL 1
-#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
-#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
-#define KVM_DEV_ARM_VGIC_CTRL_INIT 0
-#define KVM_DEV_ARM_ITS_SAVE_TABLES 1
-#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2
-#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3
-#define KVM_DEV_ARM_ITS_CTRL_RESET 4
-#define KVM_ARM_IRQ_VCPU2_SHIFT 28
-#define KVM_ARM_IRQ_VCPU2_MASK 0xf
-#define KVM_ARM_IRQ_TYPE_SHIFT 24
-#define KVM_ARM_IRQ_TYPE_MASK 0xf
-#define KVM_ARM_IRQ_VCPU_SHIFT 16
-#define KVM_ARM_IRQ_VCPU_MASK 0xff
-#define KVM_ARM_IRQ_NUM_SHIFT 0
-#define KVM_ARM_IRQ_NUM_MASK 0xffff
-#define KVM_ARM_IRQ_TYPE_CPU 0
-#define KVM_ARM_IRQ_TYPE_SPI 1
-#define KVM_ARM_IRQ_TYPE_PPI 2
-#define KVM_ARM_IRQ_CPU_IRQ 0
-#define KVM_ARM_IRQ_CPU_FIQ 1
-#define KVM_ARM_IRQ_GIC_MAX 127
-#define KVM_NR_IRQCHIPS 1
-#define KVM_PSCI_FN_BASE 0x95c1ba5e
-#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n))
-#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0)
-#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1)
-#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2)
-#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3)
-#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS
-#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED
-#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS
-#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED
-#endif
diff --git a/libc/kernel/uapi/asm-arm/asm/types.h b/libc/kernel/uapi/asm-arm/asm/types.h
index ea6e7df..461e485 100644
--- a/libc/kernel/uapi/asm-arm/asm/types.h
+++ b/libc/kernel/uapi/asm-arm/asm/types.h
@@ -16,7 +16,19 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _ASM_GENERIC_TYPES_H
-#define _ASM_GENERIC_TYPES_H
+#ifndef _UAPI_ASM_TYPES_H
+#define _UAPI_ASM_TYPES_H
 #include <asm-generic/int-ll64.h>
+#ifdef __INT32_TYPE__
+#undef __INT32_TYPE__
+#define __INT32_TYPE__ int
+#endif
+#ifdef __UINT32_TYPE__
+#undef __UINT32_TYPE__
+#define __UINT32_TYPE__ unsigned int
+#endif
+#ifdef __UINTPTR_TYPE__
+#undef __UINTPTR_TYPE__
+#define __UINTPTR_TYPE__ unsigned long
+#endif
 #endif
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-common.h b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
index 091bd74..261328e 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-common.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
@@ -407,4 +407,6 @@
 #define __NR_fspick (__NR_SYSCALL_BASE + 433)
 #define __NR_pidfd_open (__NR_SYSCALL_BASE + 434)
 #define __NR_clone3 (__NR_SYSCALL_BASE + 435)
+#define __NR_openat2 (__NR_SYSCALL_BASE + 437)
+#define __NR_pidfd_getfd (__NR_SYSCALL_BASE + 438)
 #endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/hwcap.h b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
index 8a38ab7..ebe2fa4 100644
--- a/libc/kernel/uapi/asm-arm64/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
@@ -59,4 +59,12 @@
 #define HWCAP2_SVESM4 (1 << 6)
 #define HWCAP2_FLAGM2 (1 << 7)
 #define HWCAP2_FRINT (1 << 8)
+#define HWCAP2_SVEI8MM (1 << 9)
+#define HWCAP2_SVEF32MM (1 << 10)
+#define HWCAP2_SVEF64MM (1 << 11)
+#define HWCAP2_SVEBF16 (1 << 12)
+#define HWCAP2_I8MM (1 << 13)
+#define HWCAP2_BF16 (1 << 14)
+#define HWCAP2_DGH (1 << 15)
+#define HWCAP2_RNG (1 << 16)
 #endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/kvm.h b/libc/kernel/uapi/asm-arm64/asm/kvm.h
index efe1a9c..7c64817 100644
--- a/libc/kernel/uapi/asm-arm64/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm64/asm/kvm.h
@@ -137,8 +137,8 @@
 #define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2)
 #define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1)
 #define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)
-#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
 #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
+#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
 #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
 #define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
 #define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
diff --git a/libc/kernel/uapi/asm-arm64/asm/ptrace.h b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
index b3e0aea..23ab407 100644
--- a/libc/kernel/uapi/asm-arm64/asm/ptrace.h
+++ b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
@@ -37,6 +37,7 @@
 #define PSR_SSBS_BIT 0x00001000
 #define PSR_PAN_BIT 0x00400000
 #define PSR_UAO_BIT 0x00800000
+#define PSR_DIT_BIT 0x01000000
 #define PSR_V_BIT 0x10000000
 #define PSR_C_BIT 0x20000000
 #define PSR_Z_BIT 0x40000000
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 2128ff5..1b85b30 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -396,8 +396,10 @@
 #ifdef __ARCH_WANT_SYS_CLONE3
 #define __NR_clone3 435
 #endif
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
 #undef __NR_syscalls
-#define __NR_syscalls 436
+#define __NR_syscalls 439
 #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
 #define __NR_fcntl __NR3264_fcntl
 #define __NR_statfs __NR3264_statfs
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index d4865fb..1e88a69 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -324,6 +324,7 @@
 #define KVM_STATE_NESTED_GUEST_MODE 0x00000001
 #define KVM_STATE_NESTED_RUN_PENDING 0x00000002
 #define KVM_STATE_NESTED_EVMCS 0x00000004
+#define KVM_STATE_NESTED_MTF_PENDING 0x00000008
 #define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
 #define KVM_STATE_NESTED_SMM_VMXON 0x00000002
 #define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd.h b/libc/kernel/uapi/asm-x86/asm/unistd.h
index 4bb90cf..8cab383 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd.h
@@ -18,7 +18,7 @@
  ****************************************************************************/
 #ifndef _UAPI_ASM_X86_UNISTD_H
 #define _UAPI_ASM_X86_UNISTD_H
-#define __X32_SYSCALL_BIT 0x40000000UL
+#define __X32_SYSCALL_BIT 0x40000000
 #ifdef __i386__
 #include <asm/unistd_32.h>
 #elif defined(__ILP32__)
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index 06e4a01..bbb0a6c 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -443,4 +443,6 @@
 #define __NR_fspick 433
 #define __NR_pidfd_open 434
 #define __NR_clone3 435
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index bcb6eae..6a59d78 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -365,4 +365,6 @@
 #define __NR_fspick 433
 #define __NR_pidfd_open 434
 #define __NR_clone3 435
+#define __NR_openat2 437
+#define __NR_pidfd_getfd 438
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index 3357bd1..e674447 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -318,6 +318,8 @@
 #define __NR_fspick (__X32_SYSCALL_BIT + 433)
 #define __NR_pidfd_open (__X32_SYSCALL_BIT + 434)
 #define __NR_clone3 (__X32_SYSCALL_BIT + 435)
+#define __NR_openat2 (__X32_SYSCALL_BIT + 437)
+#define __NR_pidfd_getfd (__X32_SYSCALL_BIT + 438)
 #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
 #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
 #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
diff --git a/libc/kernel/uapi/asm-x86/asm/vmx.h b/libc/kernel/uapi/asm-x86/asm/vmx.h
index e218d0d..a0c748d 100644
--- a/libc/kernel/uapi/asm-x86/asm/vmx.h
+++ b/libc/kernel/uapi/asm-x86/asm/vmx.h
@@ -23,7 +23,7 @@
 #define EXIT_REASON_EXTERNAL_INTERRUPT 1
 #define EXIT_REASON_TRIPLE_FAULT 2
 #define EXIT_REASON_INIT_SIGNAL 3
-#define EXIT_REASON_PENDING_INTERRUPT 7
+#define EXIT_REASON_INTERRUPT_WINDOW 7
 #define EXIT_REASON_NMI_WINDOW 8
 #define EXIT_REASON_TASK_SWITCH 9
 #define EXIT_REASON_CPUID 10
@@ -78,7 +78,7 @@
 #define EXIT_REASON_XRSTORS 64
 #define EXIT_REASON_UMWAIT 67
 #define EXIT_REASON_TPAUSE 68
-#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }
+#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_INTERRUPT_WINDOW, "INTERRUPT_WINDOW" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }
 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
diff --git a/libc/kernel/uapi/drm/amdgpu_drm.h b/libc/kernel/uapi/drm/amdgpu_drm.h
index b986d30..429d978 100644
--- a/libc/kernel/uapi/drm/amdgpu_drm.h
+++ b/libc/kernel/uapi/drm/amdgpu_drm.h
@@ -69,7 +69,7 @@
 #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
 #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
 #define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
-#define AMDGPU_GEM_CREATE_MQD_GFX9 (1 << 8)
+#define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8)
 #define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9)
 struct drm_amdgpu_gem_create_in {
   __u64 bo_size;
@@ -205,6 +205,10 @@
 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
+#define AMDGPU_TILING_SCANOUT_SHIFT 63
+#define AMDGPU_TILING_SCANOUT_MASK 0x1
 #define AMDGPU_TILING_SET(field,value) (((__u64) (value) & AMDGPU_TILING_ ##field ##_MASK) << AMDGPU_TILING_ ##field ##_SHIFT)
 #define AMDGPU_TILING_GET(value,field) (((__u64) (value) >> AMDGPU_TILING_ ##field ##_SHIFT) & AMDGPU_TILING_ ##field ##_MASK)
 #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
@@ -428,6 +432,7 @@
 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
 #define AMDGPU_INFO_FW_DMCU 0x12
 #define AMDGPU_INFO_FW_TA 0x13
+#define AMDGPU_INFO_FW_DMCUB 0x14
 #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
 #define AMDGPU_INFO_VRAM_USAGE 0x10
 #define AMDGPU_INFO_GTT_USAGE 0x11
diff --git a/libc/kernel/uapi/drm/drm.h b/libc/kernel/uapi/drm/drm.h
index c78966c..878e899 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -573,6 +573,7 @@
 #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
 #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
+#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
 #define DRM_COMMAND_BASE 0x40
 #define DRM_COMMAND_END 0xA0
 struct drm_event {
diff --git a/libc/kernel/uapi/drm/drm_fourcc.h b/libc/kernel/uapi/drm/drm_fourcc.h
index a316269..898d9ad 100644
--- a/libc/kernel/uapi/drm/drm_fourcc.h
+++ b/libc/kernel/uapi/drm/drm_fourcc.h
@@ -145,6 +145,8 @@
 #define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
 #define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4)
 #define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)
+#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6)
+#define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7)
 #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
 #define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2)
 #define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index 2e61275..41b4dda 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -250,6 +250,7 @@
 #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
 #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
 #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
+#define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)
 #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
 #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
 #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
@@ -441,6 +442,17 @@
   __u32 pad;
   __u64 offset;
 };
+struct drm_i915_gem_mmap_offset {
+  __u32 handle;
+  __u32 pad;
+  __u64 offset;
+  __u64 flags;
+#define I915_MMAP_OFFSET_GTT 0
+#define I915_MMAP_OFFSET_WC 1
+#define I915_MMAP_OFFSET_WB 2
+#define I915_MMAP_OFFSET_UC 3
+  __u64 extensions;
+};
 struct drm_i915_gem_set_domain {
   __u32 handle;
   __u32 read_domains;
@@ -713,6 +725,7 @@
 #define I915_CONTEXT_PARAM_VM 0x9
 #define I915_CONTEXT_PARAM_ENGINES 0xa
 #define I915_CONTEXT_PARAM_PERSISTENCE 0xb
+#define I915_CONTEXT_PARAM_RINGSIZE 0xc
   __u64 value;
 };
 struct drm_i915_gem_context_param_sseu {
diff --git a/libc/kernel/uapi/drm/lima_drm.h b/libc/kernel/uapi/drm/lima_drm.h
index bb70cf7..bd8ba9c 100644
--- a/libc/kernel/uapi/drm/lima_drm.h
+++ b/libc/kernel/uapi/drm/lima_drm.h
@@ -38,6 +38,7 @@
   __u32 pad;
   __u64 value;
 };
+#define LIMA_BO_FLAG_HEAP (1 << 0)
 struct drm_lima_gem_create {
   __u32 size;
   __u32 flags;
diff --git a/libc/kernel/uapi/drm/nouveau_drm.h b/libc/kernel/uapi/drm/nouveau_drm.h
index 186ffcc..150f729 100644
--- a/libc/kernel/uapi/drm/nouveau_drm.h
+++ b/libc/kernel/uapi/drm/nouveau_drm.h
@@ -92,6 +92,7 @@
   __u64 push;
   __u32 suffix0;
   __u32 suffix1;
+#define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0)
   __u64 vram_available;
   __u64 gart_available;
 };
diff --git a/libc/kernel/uapi/drm/vmwgfx_drm.h b/libc/kernel/uapi/drm/vmwgfx_drm.h
index 753192b..982b64f 100644
--- a/libc/kernel/uapi/drm/vmwgfx_drm.h
+++ b/libc/kernel/uapi/drm/vmwgfx_drm.h
@@ -55,6 +55,7 @@
 #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27
 #define DRM_VMW_GB_SURFACE_REF_EXT 28
+#define DRM_VMW_MSG 29
 #define DRM_VMW_PARAM_NUM_STREAMS 0
 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
 #define DRM_VMW_PARAM_3D 2
@@ -70,6 +71,7 @@
 #define DRM_VMW_PARAM_DX 12
 #define DRM_VMW_PARAM_HW_CAPS2 13
 #define DRM_VMW_PARAM_SM4_1 14
+#define DRM_VMW_PARAM_SM5 15
 enum drm_vmw_handle_type {
   DRM_VMW_HANDLE_LEGACY = 0,
   DRM_VMW_HANDLE_PRIME = 1
@@ -329,15 +331,16 @@
 };
 #define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
 enum drm_vmw_surface_version {
-  drm_vmw_gb_surface_v1
+  drm_vmw_gb_surface_v1,
 };
 struct drm_vmw_gb_surface_create_ext_req {
   struct drm_vmw_gb_surface_create_req base;
   enum drm_vmw_surface_version version;
-  uint32_t svga3d_flags_upper_32_bits;
-  SVGA3dMSPattern multisample_pattern;
-  SVGA3dMSQualityLevel quality_level;
-  uint64_t must_be_zero;
+  __u32 svga3d_flags_upper_32_bits;
+  __u32 multisample_pattern;
+  __u32 quality_level;
+  __u32 buffer_byte_stride;
+  __u32 must_be_zero;
 };
 union drm_vmw_gb_surface_create_ext_arg {
   struct drm_vmw_gb_surface_create_rep rep;
@@ -351,6 +354,12 @@
   struct drm_vmw_gb_surface_ref_ext_rep rep;
   struct drm_vmw_surface_arg req;
 };
+struct drm_vmw_msg_arg {
+  __u64 send;
+  __u64 receive;
+  __s32 send_only;
+  __u32 receive_len;
+};
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/linux/audit.h b/libc/kernel/uapi/linux/audit.h
index d14f018..a4bb3b5 100644
--- a/libc/kernel/uapi/linux/audit.h
+++ b/libc/kernel/uapi/linux/audit.h
@@ -81,6 +81,7 @@
 #define AUDIT_FANOTIFY 1331
 #define AUDIT_TIME_INJOFFSET 1332
 #define AUDIT_TIME_ADJNTPVAL 1333
+#define AUDIT_BPF 1334
 #define AUDIT_AVC 1400
 #define AUDIT_SELINUX_ERR 1401
 #define AUDIT_AVC_PATH 1402
diff --git a/libc/kernel/uapi/linux/b1lli.h b/libc/kernel/uapi/linux/b1lli.h
deleted file mode 100644
index 29c7fe8..0000000
--- a/libc/kernel/uapi/linux/b1lli.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _B1LLI_H_
-#define _B1LLI_H_
-typedef struct avmb1_t4file {
-  int len;
-  unsigned char * data;
-} avmb1_t4file;
-typedef struct avmb1_loaddef {
-  int contr;
-  avmb1_t4file t4file;
-} avmb1_loaddef;
-typedef struct avmb1_loadandconfigdef {
-  int contr;
-  avmb1_t4file t4file;
-  avmb1_t4file t4config;
-} avmb1_loadandconfigdef;
-typedef struct avmb1_resetdef {
-  int contr;
-} avmb1_resetdef;
-typedef struct avmb1_getdef {
-  int contr;
-  int cardtype;
-  int cardstate;
-} avmb1_getdef;
-typedef struct avmb1_carddef {
-  int port;
-  int irq;
-} avmb1_carddef;
-#define AVM_CARDTYPE_B1 0
-#define AVM_CARDTYPE_T1 1
-#define AVM_CARDTYPE_M1 2
-#define AVM_CARDTYPE_M2 3
-typedef struct avmb1_extcarddef {
-  int port;
-  int irq;
-  int cardtype;
-  int cardnr;
-} avmb1_extcarddef;
-#define AVMB1_LOAD 0
-#define AVMB1_ADDCARD 1
-#define AVMB1_RESETCARD 2
-#define AVMB1_LOAD_AND_CONFIG 3
-#define AVMB1_ADDCARD_WITH_TYPE 4
-#define AVMB1_GET_CARDINFO 5
-#define AVMB1_REMOVECARD 6
-#define AVMB1_REGISTERCARD_IS_OBSOLETE
-#endif
diff --git a/libc/kernel/uapi/linux/bcache.h b/libc/kernel/uapi/linux/bcache.h
index 1bee0a3..5e5377e 100644
--- a/libc/kernel/uapi/linux/bcache.h
+++ b/libc/kernel/uapi/linux/bcache.h
@@ -56,11 +56,46 @@
 #define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
 #define BCACHE_SB_MAX_VERSION 4
 #define SB_SECTOR 8
+#define SB_OFFSET (SB_SECTOR << SECTOR_SHIFT)
 #define SB_SIZE 4096
 #define SB_LABEL_SIZE 32
 #define SB_JOURNAL_BUCKETS 256U
 #define MAX_CACHES_PER_SET 8
 #define BDEV_DATA_START_DEFAULT 16
+struct cache_sb_disk {
+  __le64 csum;
+  __le64 offset;
+  __le64 version;
+  __u8 magic[16];
+  __u8 uuid[16];
+  union {
+    __u8 set_uuid[16];
+    __le64 set_magic;
+  };
+  __u8 label[SB_LABEL_SIZE];
+  __le64 flags;
+  __le64 seq;
+  __le64 pad[8];
+  union {
+    struct {
+      __le64 nbuckets;
+      __le16 block_size;
+      __le16 bucket_size;
+      __le16 nr_in_set;
+      __le16 nr_this_dev;
+    };
+    struct {
+      __le64 data_offset;
+    };
+  };
+  __le32 last_mount;
+  __le16 first_bucket;
+  union {
+    __le16 njournal_buckets;
+    __le16 keys;
+  };
+  __le64 d[SB_JOURNAL_BUCKETS];
+};
 struct cache_sb {
   __u64 csum;
   __u64 offset;
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index 80a9feb..815fd6a 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -95,6 +95,12 @@
   BPF_MAP_LOOKUP_AND_DELETE_ELEM,
   BPF_MAP_FREEZE,
   BPF_BTF_GET_NEXT_ID,
+  BPF_MAP_LOOKUP_BATCH,
+  BPF_MAP_LOOKUP_AND_DELETE_BATCH,
+  BPF_MAP_UPDATE_BATCH,
+  BPF_MAP_DELETE_BATCH,
+  BPF_LINK_CREATE,
+  BPF_LINK_UPDATE,
 };
 enum bpf_map_type {
   BPF_MAP_TYPE_UNSPEC,
@@ -123,6 +129,7 @@
   BPF_MAP_TYPE_STACK,
   BPF_MAP_TYPE_SK_STORAGE,
   BPF_MAP_TYPE_DEVMAP_HASH,
+  BPF_MAP_TYPE_STRUCT_OPS,
 };
 enum bpf_prog_type {
   BPF_PROG_TYPE_UNSPEC,
@@ -152,6 +159,9 @@
   BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
   BPF_PROG_TYPE_CGROUP_SOCKOPT,
   BPF_PROG_TYPE_TRACING,
+  BPF_PROG_TYPE_STRUCT_OPS,
+  BPF_PROG_TYPE_EXT,
+  BPF_PROG_TYPE_LSM,
 };
 enum bpf_attach_type {
   BPF_CGROUP_INET_INGRESS,
@@ -180,11 +190,14 @@
   BPF_TRACE_RAW_TP,
   BPF_TRACE_FENTRY,
   BPF_TRACE_FEXIT,
+  BPF_MODIFY_RETURN,
+  BPF_LSM_MAC,
   __MAX_BPF_ATTACH_TYPE
 };
 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
 #define BPF_F_ALLOW_OVERRIDE (1U << 0)
 #define BPF_F_ALLOW_MULTI (1U << 1)
+#define BPF_F_REPLACE (1U << 2)
 #define BPF_F_STRICT_ALIGNMENT (1U << 0)
 #define BPF_F_ANY_ALIGNMENT (1U << 1)
 #define BPF_F_TEST_RND_HI32 (1U << 2)
@@ -192,22 +205,25 @@
 #define BPF_PSEUDO_MAP_FD 1
 #define BPF_PSEUDO_MAP_VALUE 2
 #define BPF_PSEUDO_CALL 1
-#define BPF_ANY 0
-#define BPF_NOEXIST 1
-#define BPF_EXIST 2
-#define BPF_F_LOCK 4
-#define BPF_F_NO_PREALLOC (1U << 0)
-#define BPF_F_NO_COMMON_LRU (1U << 1)
-#define BPF_F_NUMA_NODE (1U << 2)
-#define BPF_OBJ_NAME_LEN 16U
-#define BPF_F_RDONLY (1U << 3)
-#define BPF_F_WRONLY (1U << 4)
-#define BPF_F_STACK_BUILD_ID (1U << 5)
-#define BPF_F_ZERO_SEED (1U << 6)
-#define BPF_F_RDONLY_PROG (1U << 7)
-#define BPF_F_WRONLY_PROG (1U << 8)
-#define BPF_F_CLONE (1U << 9)
-#define BPF_F_MMAPABLE (1U << 10)
+enum {
+  BPF_ANY = 0,
+  BPF_NOEXIST = 1,
+  BPF_EXIST = 2,
+  BPF_F_LOCK = 4,
+};
+enum {
+  BPF_F_NO_PREALLOC = (1U << 0),
+  BPF_F_NO_COMMON_LRU = (1U << 1),
+  BPF_F_NUMA_NODE = (1U << 2),
+  BPF_F_RDONLY = (1U << 3),
+  BPF_F_WRONLY = (1U << 4),
+  BPF_F_STACK_BUILD_ID = (1U << 5),
+  BPF_F_ZERO_SEED = (1U << 6),
+  BPF_F_RDONLY_PROG = (1U << 7),
+  BPF_F_WRONLY_PROG = (1U << 8),
+  BPF_F_CLONE = (1U << 9),
+  BPF_F_MMAPABLE = (1U << 10),
+};
 #define BPF_F_QUERY_EFFECTIVE (1U << 0)
 enum bpf_stack_build_id_status {
   BPF_STACK_BUILD_ID_EMPTY = 0,
@@ -223,6 +239,7 @@
     __u64 ip;
   };
 };
+#define BPF_OBJ_NAME_LEN 16U
 union bpf_attr {
   struct {
     __u32 map_type;
@@ -237,6 +254,7 @@
     __u32 btf_fd;
     __u32 btf_key_type_id;
     __u32 btf_value_type_id;
+    __u32 btf_vmlinux_value_type_id;
   };
   struct {
     __u32 map_fd;
@@ -248,6 +266,16 @@
     __u64 flags;
   };
   struct {
+    __aligned_u64 in_batch;
+    __aligned_u64 out_batch;
+    __aligned_u64 keys;
+    __aligned_u64 values;
+    __u32 count;
+    __u32 map_fd;
+    __u64 elem_flags;
+    __u64 flags;
+  } batch;
+  struct {
     __u32 prog_type;
     __u32 insn_cnt;
     __aligned_u64 insns;
@@ -280,6 +308,7 @@
     __u32 attach_bpf_fd;
     __u32 attach_type;
     __u32 attach_flags;
+    __u32 replace_bpf_fd;
   };
   struct {
     __u32 prog_fd;
@@ -340,43 +369,84 @@
     __u64 probe_offset;
     __u64 probe_addr;
   } task_fd_query;
+  struct {
+    __u32 prog_fd;
+    __u32 target_fd;
+    __u32 attach_type;
+    __u32 flags;
+  } link_create;
+  struct {
+    __u32 link_fd;
+    __u32 new_prog_fd;
+    __u32 flags;
+    __u32 old_prog_fd;
+  } link_update;
 } __attribute__((aligned(8)));
-#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str),
+#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str), FN(tcp_send_ack), FN(send_signal_thread), FN(jiffies64), FN(read_branch_records), FN(get_ns_current_pid_tgid), FN(xdp_output), FN(get_netns_cookie), FN(get_current_ancestor_cgroup_id), FN(sk_assign),
 #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
 enum bpf_func_id {
   __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
 };
 #undef __BPF_ENUM_FN
-#define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
-#define BPF_F_INVALIDATE_HASH (1ULL << 1)
-#define BPF_F_HDR_FIELD_MASK 0xfULL
-#define BPF_F_PSEUDO_HDR (1ULL << 4)
-#define BPF_F_MARK_MANGLED_0 (1ULL << 5)
-#define BPF_F_MARK_ENFORCE (1ULL << 6)
-#define BPF_F_INGRESS (1ULL << 0)
-#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
-#define BPF_F_SKIP_FIELD_MASK 0xffULL
-#define BPF_F_USER_STACK (1ULL << 8)
-#define BPF_F_FAST_STACK_CMP (1ULL << 9)
-#define BPF_F_REUSE_STACKID (1ULL << 10)
-#define BPF_F_USER_BUILD_ID (1ULL << 11)
-#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
-#define BPF_F_DONT_FRAGMENT (1ULL << 2)
-#define BPF_F_SEQ_NUMBER (1ULL << 3)
-#define BPF_F_INDEX_MASK 0xffffffffULL
-#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
-#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)
-#define BPF_F_CURRENT_NETNS (- 1L)
-#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)
-#define BPF_ADJ_ROOM_ENCAP_L2_MASK 0xff
-#define BPF_ADJ_ROOM_ENCAP_L2_SHIFT 56
-#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1)
-#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2)
-#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3)
-#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4)
+enum {
+  BPF_F_RECOMPUTE_CSUM = (1ULL << 0),
+  BPF_F_INVALIDATE_HASH = (1ULL << 1),
+};
+enum {
+  BPF_F_HDR_FIELD_MASK = 0xfULL,
+};
+enum {
+  BPF_F_PSEUDO_HDR = (1ULL << 4),
+  BPF_F_MARK_MANGLED_0 = (1ULL << 5),
+  BPF_F_MARK_ENFORCE = (1ULL << 6),
+};
+enum {
+  BPF_F_INGRESS = (1ULL << 0),
+};
+enum {
+  BPF_F_TUNINFO_IPV6 = (1ULL << 0),
+};
+enum {
+  BPF_F_SKIP_FIELD_MASK = 0xffULL,
+  BPF_F_USER_STACK = (1ULL << 8),
+  BPF_F_FAST_STACK_CMP = (1ULL << 9),
+  BPF_F_REUSE_STACKID = (1ULL << 10),
+  BPF_F_USER_BUILD_ID = (1ULL << 11),
+};
+enum {
+  BPF_F_ZERO_CSUM_TX = (1ULL << 1),
+  BPF_F_DONT_FRAGMENT = (1ULL << 2),
+  BPF_F_SEQ_NUMBER = (1ULL << 3),
+};
+enum {
+  BPF_F_INDEX_MASK = 0xffffffffULL,
+  BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK,
+  BPF_F_CTXLEN_MASK = (0xfffffULL << 32),
+};
+enum {
+  BPF_F_CURRENT_NETNS = (- 1L),
+};
+enum {
+  BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0),
+  BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1),
+  BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2),
+  BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3),
+  BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4),
+};
+enum {
+  BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff,
+  BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56,
+};
 #define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64) len & BPF_ADJ_ROOM_ENCAP_L2_MASK) << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
-#define BPF_F_SYSCTL_BASE_NAME (1ULL << 0)
-#define BPF_SK_STORAGE_GET_F_CREATE (1ULL << 0)
+enum {
+  BPF_F_SYSCTL_BASE_NAME = (1ULL << 0),
+};
+enum {
+  BPF_SK_STORAGE_GET_F_CREATE = (1ULL << 0),
+};
+enum {
+  BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0),
+};
 enum bpf_adj_room_mode {
   BPF_ADJ_ROOM_NET,
   BPF_ADJ_ROOM_MAC,
@@ -424,6 +494,7 @@
   __u32 wire_len;
   __u32 gso_segs;
   __bpf_md_ptr(struct bpf_sock *, sk);
+  __u32 gso_size;
 };
 struct bpf_tunnel_key {
   __u32 tunnel_id;
@@ -601,7 +672,7 @@
   __u32 map_flags;
   char name[BPF_OBJ_NAME_LEN];
   __u32 ifindex;
-  __u32 : 32;
+  __u32 btf_vmlinux_value_type_id;
   __u64 netns_dev;
   __u64 netns_ino;
   __u32 btf_id;
@@ -667,11 +738,13 @@
   __u64 bytes_acked;
   __bpf_md_ptr(struct bpf_sock *, sk);
 };
-#define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0)
-#define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1)
-#define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2)
-#define BPF_SOCK_OPS_RTT_CB_FLAG (1 << 3)
-#define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF
+enum {
+  BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0),
+  BPF_SOCK_OPS_RETRANS_CB_FLAG = (1 << 1),
+  BPF_SOCK_OPS_STATE_CB_FLAG = (1 << 2),
+  BPF_SOCK_OPS_RTT_CB_FLAG = (1 << 3),
+  BPF_SOCK_OPS_ALL_CB_FLAGS = 0xF,
+};
 enum {
   BPF_SOCK_OPS_VOID,
   BPF_SOCK_OPS_TIMEOUT_INIT,
@@ -702,18 +775,24 @@
   BPF_TCP_NEW_SYN_RECV,
   BPF_TCP_MAX_STATES
 };
-#define TCP_BPF_IW 1001
-#define TCP_BPF_SNDCWND_CLAMP 1002
+enum {
+  TCP_BPF_IW = 1001,
+  TCP_BPF_SNDCWND_CLAMP = 1002,
+};
 struct bpf_perf_event_value {
   __u64 counter;
   __u64 enabled;
   __u64 running;
 };
-#define BPF_DEVCG_ACC_MKNOD (1ULL << 0)
-#define BPF_DEVCG_ACC_READ (1ULL << 1)
-#define BPF_DEVCG_ACC_WRITE (1ULL << 2)
-#define BPF_DEVCG_DEV_BLOCK (1ULL << 0)
-#define BPF_DEVCG_DEV_CHAR (1ULL << 1)
+enum {
+  BPF_DEVCG_ACC_MKNOD = (1ULL << 0),
+  BPF_DEVCG_ACC_READ = (1ULL << 1),
+  BPF_DEVCG_ACC_WRITE = (1ULL << 2),
+};
+enum {
+  BPF_DEVCG_DEV_BLOCK = (1ULL << 0),
+  BPF_DEVCG_DEV_CHAR = (1ULL << 1),
+};
 struct bpf_cgroup_dev_ctx {
   __u32 access_type;
   __u32 major;
@@ -722,8 +801,10 @@
 struct bpf_raw_tracepoint_args {
   __u64 args[0];
 };
-#define BPF_FIB_LOOKUP_DIRECT (1U << 0)
-#define BPF_FIB_LOOKUP_OUTPUT (1U << 1)
+enum {
+  BPF_FIB_LOOKUP_DIRECT = (1U << 0),
+  BPF_FIB_LOOKUP_OUTPUT = (1U << 1),
+};
 enum {
   BPF_FIB_LKUP_RET_SUCCESS,
   BPF_FIB_LKUP_RET_BLACKHOLE,
@@ -768,9 +849,11 @@
   BPF_FD_TYPE_UPROBE,
   BPF_FD_TYPE_URETPROBE,
 };
-#define BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG (1U << 0)
-#define BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL (1U << 1)
-#define BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP (1U << 2)
+enum {
+  BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0),
+  BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1),
+  BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2),
+};
 struct bpf_flow_keys {
   __u16 nhoff;
   __u16 thoff;
@@ -823,4 +906,8 @@
   __s32 optlen;
   __s32 retval;
 };
+struct bpf_pidns_info {
+  __u32 pid;
+  __u32 tgid;
+};
 #endif
diff --git a/libc/kernel/uapi/linux/btf.h b/libc/kernel/uapi/linux/btf.h
index 21e7596..f22d637 100644
--- a/libc/kernel/uapi/linux/btf.h
+++ b/libc/kernel/uapi/linux/btf.h
@@ -91,7 +91,13 @@
 };
 enum {
   BTF_VAR_STATIC = 0,
-  BTF_VAR_GLOBAL_ALLOCATED,
+  BTF_VAR_GLOBAL_ALLOCATED = 1,
+  BTF_VAR_GLOBAL_EXTERN = 2,
+};
+enum btf_func_linkage {
+  BTF_FUNC_STATIC = 0,
+  BTF_FUNC_GLOBAL = 1,
+  BTF_FUNC_EXTERN = 2,
 };
 struct btf_var {
   __u32 linkage;
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index 684b295..45e5572 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -34,7 +34,8 @@
 #define BTRFS_SUBVOL_RDONLY (1ULL << 1)
 #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
 #define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
-#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED (BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT | BTRFS_DEVICE_SPEC_BY_ID)
+#define BTRFS_SUBVOL_SPEC_BY_ID (1ULL << 4)
+#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT | BTRFS_DEVICE_SPEC_BY_ID | BTRFS_SUBVOL_SPEC_BY_ID)
 #define BTRFS_FSID_SIZE 16
 #define BTRFS_UUID_SIZE 16
 #define BTRFS_UUID_UNPARSED_SIZE 37
@@ -64,6 +65,9 @@
   __u64 qgroupid;
   struct btrfs_qgroup_limit lim;
 };
+#define BTRFS_DEVICE_REMOVE_ARGS_MASK (BTRFS_DEVICE_SPEC_BY_ID)
+#define BTRFS_SUBVOL_CREATE_ARGS_MASK (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT)
+#define BTRFS_SUBVOL_DELETE_ARGS_MASK (BTRFS_SUBVOL_SPEC_BY_ID)
 struct btrfs_ioctl_vol_args_v2 {
   __s64 fd;
   __u64 transid;
@@ -78,6 +82,7 @@
   union {
     char name[BTRFS_SUBVOL_NAME_MAX + 1];
     __u64 devid;
+    __u64 subvolid;
   };
 };
 struct btrfs_scrub_progress {
@@ -517,4 +522,5 @@
 #define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, struct btrfs_ioctl_get_subvol_info_args)
 #define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, struct btrfs_ioctl_get_subvol_rootref_args)
 #define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, struct btrfs_ioctl_ino_lookup_user_args)
+#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2)
 #endif
diff --git a/libc/kernel/uapi/linux/coresight-stm.h b/libc/kernel/uapi/linux/coresight-stm.h
index 2eac7e1..9d89dd6 100644
--- a/libc/kernel/uapi/linux/coresight-stm.h
+++ b/libc/kernel/uapi/linux/coresight-stm.h
@@ -18,8 +18,9 @@
  ****************************************************************************/
 #ifndef __UAPI_CORESIGHT_STM_H_
 #define __UAPI_CORESIGHT_STM_H_
-#define STM_FLAG_TIMESTAMPED BIT(3)
-#define STM_FLAG_GUARANTEED BIT(7)
+#include <linux/const.h>
+#define STM_FLAG_TIMESTAMPED _BITUL(3)
+#define STM_FLAG_GUARANTEED _BITUL(7)
 enum {
   STM_OPTION_GUARANTEED = 0,
   STM_OPTION_INVARIANT,
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index b08fa8a..18f7da5 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -93,6 +93,10 @@
   DEVLINK_CMD_TRAP_GROUP_SET,
   DEVLINK_CMD_TRAP_GROUP_NEW,
   DEVLINK_CMD_TRAP_GROUP_DEL,
+  DEVLINK_CMD_TRAP_POLICER_GET,
+  DEVLINK_CMD_TRAP_POLICER_SET,
+  DEVLINK_CMD_TRAP_POLICER_NEW,
+  DEVLINK_CMD_TRAP_POLICER_DEL,
   __DEVLINK_CMD_MAX,
   DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
 };
@@ -131,6 +135,7 @@
   DEVLINK_PORT_FLAVOUR_DSA,
   DEVLINK_PORT_FLAVOUR_PCI_PF,
   DEVLINK_PORT_FLAVOUR_PCI_VF,
+  DEVLINK_PORT_FLAVOUR_VIRTUAL,
 };
 enum devlink_param_cmode {
   DEVLINK_PARAM_CMODE_RUNTIME,
@@ -154,6 +159,7 @@
 enum {
   DEVLINK_ATTR_STATS_RX_PACKETS,
   DEVLINK_ATTR_STATS_RX_BYTES,
+  DEVLINK_ATTR_STATS_RX_DROPPED,
   __DEVLINK_ATTR_STATS_MAX,
   DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
 };
@@ -167,6 +173,7 @@
 };
 enum {
   DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
+  DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,
 };
 enum devlink_attr {
   DEVLINK_ATTR_UNSPEC,
@@ -310,6 +317,10 @@
   DEVLINK_ATTR_NETNS_FD,
   DEVLINK_ATTR_NETNS_PID,
   DEVLINK_ATTR_NETNS_ID,
+  DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,
+  DEVLINK_ATTR_TRAP_POLICER_ID,
+  DEVLINK_ATTR_TRAP_POLICER_RATE,
+  DEVLINK_ATTR_TRAP_POLICER_BURST,
   __DEVLINK_ATTR_MAX,
   DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
 };
diff --git a/libc/kernel/uapi/linux/dm-ioctl.h b/libc/kernel/uapi/linux/dm-ioctl.h
index 51e997f..130c4c7 100644
--- a/libc/kernel/uapi/linux/dm-ioctl.h
+++ b/libc/kernel/uapi/linux/dm-ioctl.h
@@ -104,9 +104,9 @@
 #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
 #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 #define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 41
+#define DM_VERSION_MINOR 42
 #define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl(2019-09-16)"
+#define DM_VERSION_EXTRA "-ioctl(2020-02-27)"
 #define DM_READONLY_FLAG (1 << 0)
 #define DM_SUSPEND_FLAG (1 << 1)
 #define DM_PERSISTENT_DEV_FLAG (1 << 3)
diff --git a/libc/kernel/uapi/linux/dma-buf.h b/libc/kernel/uapi/linux/dma-buf.h
index 3d7c099..221c20f 100644
--- a/libc/kernel/uapi/linux/dma-buf.h
+++ b/libc/kernel/uapi/linux/dma-buf.h
@@ -32,4 +32,6 @@
 #define DMA_BUF_BASE 'b'
 #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
 #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
+#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
+#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
 #endif
diff --git a/libc/kernel/uapi/linux/gigaset_dev.h b/libc/kernel/uapi/linux/dma-heap.h
similarity index 70%
rename from libc/kernel/uapi/linux/gigaset_dev.h
rename to libc/kernel/uapi/linux/dma-heap.h
index 5741d7d..a2746e3 100644
--- a/libc/kernel/uapi/linux/gigaset_dev.h
+++ b/libc/kernel/uapi/linux/dma-heap.h
@@ -16,15 +16,18 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef GIGASET_INTERFACE_H
-#define GIGASET_INTERFACE_H
+#ifndef _UAPI_LINUX_DMABUF_POOL_H
+#define _UAPI_LINUX_DMABUF_POOL_H
 #include <linux/ioctl.h>
-#define GIGASET_IOCTL 0x47
-#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int)
-#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int)
-#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
-#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4])
-#define GIGVER_DRIVER 0
-#define GIGVER_COMPAT 1
-#define GIGVER_FWBASE 2
+#include <linux/types.h>
+#define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
+#define DMA_HEAP_VALID_HEAP_FLAGS (0)
+struct dma_heap_allocation_data {
+  __u64 len;
+  __u32 fd;
+  __u32 fd_flags;
+  __u64 heap_flags;
+};
+#define DMA_HEAP_IOC_MAGIC 'H'
+#define DMA_HEAP_IOCTL_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0, struct dma_heap_allocation_data)
 #endif
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index cc951d1..8733bca 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -207,6 +207,13 @@
   ETH_SS_TUNABLES,
   ETH_SS_PHY_STATS,
   ETH_SS_PHY_TUNABLES,
+  ETH_SS_LINK_MODES,
+  ETH_SS_MSG_CLASSES,
+  ETH_SS_WOL_MODES,
+  ETH_SS_SOF_TIMESTAMPING,
+  ETH_SS_TS_TX_TYPES,
+  ETH_SS_TS_RX_FILTERS,
+  ETH_SS_COUNT
 };
 struct ethtool_gstrings {
   __u32 cmd;
@@ -452,12 +459,14 @@
   ETHTOOL_FEC_OFF_BIT,
   ETHTOOL_FEC_RS_BIT,
   ETHTOOL_FEC_BASER_BIT,
+  ETHTOOL_FEC_LLRS_BIT,
 };
 #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
 #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT)
 #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)
 #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)
 #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT)
+#define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT)
 #define ETHTOOL_GSET 0x00000001
 #define ETHTOOL_SSET 0x00000002
 #define ETHTOOL_GDRVINFO 0x00000003
@@ -615,6 +624,7 @@
   ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71,
   ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72,
   ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73,
+  ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74,
   __ETHTOOL_LINK_MODE_MASK_NBITS
 };
 #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) (1UL << (ETHTOOL_LINK_MODE_ ##base_name ##_BIT))
@@ -726,6 +736,7 @@
 #define WAKE_MAGIC (1 << 5)
 #define WAKE_MAGICSECURE (1 << 6)
 #define WAKE_FILTER (1 << 7)
+#define WOL_MODE_COUNT 8
 #define TCP_V4_FLOW 0x01
 #define UDP_V4_FLOW 0x02
 #define SCTP_V4_FLOW 0x03
diff --git a/libc/kernel/uapi/linux/ethtool_netlink.h b/libc/kernel/uapi/linux/ethtool_netlink.h
new file mode 100644
index 0000000..52d435e
--- /dev/null
+++ b/libc/kernel/uapi/linux/ethtool_netlink.h
@@ -0,0 +1,304 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ETHTOOL_NETLINK_H_
+#define _UAPI_LINUX_ETHTOOL_NETLINK_H_
+#include <linux/ethtool.h>
+enum {
+  ETHTOOL_MSG_USER_NONE,
+  ETHTOOL_MSG_STRSET_GET,
+  ETHTOOL_MSG_LINKINFO_GET,
+  ETHTOOL_MSG_LINKINFO_SET,
+  ETHTOOL_MSG_LINKMODES_GET,
+  ETHTOOL_MSG_LINKMODES_SET,
+  ETHTOOL_MSG_LINKSTATE_GET,
+  ETHTOOL_MSG_DEBUG_GET,
+  ETHTOOL_MSG_DEBUG_SET,
+  ETHTOOL_MSG_WOL_GET,
+  ETHTOOL_MSG_WOL_SET,
+  ETHTOOL_MSG_FEATURES_GET,
+  ETHTOOL_MSG_FEATURES_SET,
+  ETHTOOL_MSG_PRIVFLAGS_GET,
+  ETHTOOL_MSG_PRIVFLAGS_SET,
+  ETHTOOL_MSG_RINGS_GET,
+  ETHTOOL_MSG_RINGS_SET,
+  ETHTOOL_MSG_CHANNELS_GET,
+  ETHTOOL_MSG_CHANNELS_SET,
+  ETHTOOL_MSG_COALESCE_GET,
+  ETHTOOL_MSG_COALESCE_SET,
+  ETHTOOL_MSG_PAUSE_GET,
+  ETHTOOL_MSG_PAUSE_SET,
+  ETHTOOL_MSG_EEE_GET,
+  ETHTOOL_MSG_EEE_SET,
+  ETHTOOL_MSG_TSINFO_GET,
+  __ETHTOOL_MSG_USER_CNT,
+  ETHTOOL_MSG_USER_MAX = __ETHTOOL_MSG_USER_CNT - 1
+};
+enum {
+  ETHTOOL_MSG_KERNEL_NONE,
+  ETHTOOL_MSG_STRSET_GET_REPLY,
+  ETHTOOL_MSG_LINKINFO_GET_REPLY,
+  ETHTOOL_MSG_LINKINFO_NTF,
+  ETHTOOL_MSG_LINKMODES_GET_REPLY,
+  ETHTOOL_MSG_LINKMODES_NTF,
+  ETHTOOL_MSG_LINKSTATE_GET_REPLY,
+  ETHTOOL_MSG_DEBUG_GET_REPLY,
+  ETHTOOL_MSG_DEBUG_NTF,
+  ETHTOOL_MSG_WOL_GET_REPLY,
+  ETHTOOL_MSG_WOL_NTF,
+  ETHTOOL_MSG_FEATURES_GET_REPLY,
+  ETHTOOL_MSG_FEATURES_SET_REPLY,
+  ETHTOOL_MSG_FEATURES_NTF,
+  ETHTOOL_MSG_PRIVFLAGS_GET_REPLY,
+  ETHTOOL_MSG_PRIVFLAGS_NTF,
+  ETHTOOL_MSG_RINGS_GET_REPLY,
+  ETHTOOL_MSG_RINGS_NTF,
+  ETHTOOL_MSG_CHANNELS_GET_REPLY,
+  ETHTOOL_MSG_CHANNELS_NTF,
+  ETHTOOL_MSG_COALESCE_GET_REPLY,
+  ETHTOOL_MSG_COALESCE_NTF,
+  ETHTOOL_MSG_PAUSE_GET_REPLY,
+  ETHTOOL_MSG_PAUSE_NTF,
+  ETHTOOL_MSG_EEE_GET_REPLY,
+  ETHTOOL_MSG_EEE_NTF,
+  ETHTOOL_MSG_TSINFO_GET_REPLY,
+  __ETHTOOL_MSG_KERNEL_CNT,
+  ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1
+};
+#define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0)
+#define ETHTOOL_FLAG_OMIT_REPLY (1 << 1)
+#define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | ETHTOOL_FLAG_OMIT_REPLY)
+enum {
+  ETHTOOL_A_HEADER_UNSPEC,
+  ETHTOOL_A_HEADER_DEV_INDEX,
+  ETHTOOL_A_HEADER_DEV_NAME,
+  ETHTOOL_A_HEADER_FLAGS,
+  __ETHTOOL_A_HEADER_CNT,
+  ETHTOOL_A_HEADER_MAX = __ETHTOOL_A_HEADER_CNT - 1
+};
+enum {
+  ETHTOOL_A_BITSET_BIT_UNSPEC,
+  ETHTOOL_A_BITSET_BIT_INDEX,
+  ETHTOOL_A_BITSET_BIT_NAME,
+  ETHTOOL_A_BITSET_BIT_VALUE,
+  __ETHTOOL_A_BITSET_BIT_CNT,
+  ETHTOOL_A_BITSET_BIT_MAX = __ETHTOOL_A_BITSET_BIT_CNT - 1
+};
+enum {
+  ETHTOOL_A_BITSET_BITS_UNSPEC,
+  ETHTOOL_A_BITSET_BITS_BIT,
+  __ETHTOOL_A_BITSET_BITS_CNT,
+  ETHTOOL_A_BITSET_BITS_MAX = __ETHTOOL_A_BITSET_BITS_CNT - 1
+};
+enum {
+  ETHTOOL_A_BITSET_UNSPEC,
+  ETHTOOL_A_BITSET_NOMASK,
+  ETHTOOL_A_BITSET_SIZE,
+  ETHTOOL_A_BITSET_BITS,
+  ETHTOOL_A_BITSET_VALUE,
+  ETHTOOL_A_BITSET_MASK,
+  __ETHTOOL_A_BITSET_CNT,
+  ETHTOOL_A_BITSET_MAX = __ETHTOOL_A_BITSET_CNT - 1
+};
+enum {
+  ETHTOOL_A_STRING_UNSPEC,
+  ETHTOOL_A_STRING_INDEX,
+  ETHTOOL_A_STRING_VALUE,
+  __ETHTOOL_A_STRING_CNT,
+  ETHTOOL_A_STRING_MAX = __ETHTOOL_A_STRING_CNT - 1
+};
+enum {
+  ETHTOOL_A_STRINGS_UNSPEC,
+  ETHTOOL_A_STRINGS_STRING,
+  __ETHTOOL_A_STRINGS_CNT,
+  ETHTOOL_A_STRINGS_MAX = __ETHTOOL_A_STRINGS_CNT - 1
+};
+enum {
+  ETHTOOL_A_STRINGSET_UNSPEC,
+  ETHTOOL_A_STRINGSET_ID,
+  ETHTOOL_A_STRINGSET_COUNT,
+  ETHTOOL_A_STRINGSET_STRINGS,
+  __ETHTOOL_A_STRINGSET_CNT,
+  ETHTOOL_A_STRINGSET_MAX = __ETHTOOL_A_STRINGSET_CNT - 1
+};
+enum {
+  ETHTOOL_A_STRINGSETS_UNSPEC,
+  ETHTOOL_A_STRINGSETS_STRINGSET,
+  __ETHTOOL_A_STRINGSETS_CNT,
+  ETHTOOL_A_STRINGSETS_MAX = __ETHTOOL_A_STRINGSETS_CNT - 1
+};
+enum {
+  ETHTOOL_A_STRSET_UNSPEC,
+  ETHTOOL_A_STRSET_HEADER,
+  ETHTOOL_A_STRSET_STRINGSETS,
+  ETHTOOL_A_STRSET_COUNTS_ONLY,
+  __ETHTOOL_A_STRSET_CNT,
+  ETHTOOL_A_STRSET_MAX = __ETHTOOL_A_STRSET_CNT - 1
+};
+enum {
+  ETHTOOL_A_LINKINFO_UNSPEC,
+  ETHTOOL_A_LINKINFO_HEADER,
+  ETHTOOL_A_LINKINFO_PORT,
+  ETHTOOL_A_LINKINFO_PHYADDR,
+  ETHTOOL_A_LINKINFO_TP_MDIX,
+  ETHTOOL_A_LINKINFO_TP_MDIX_CTRL,
+  ETHTOOL_A_LINKINFO_TRANSCEIVER,
+  __ETHTOOL_A_LINKINFO_CNT,
+  ETHTOOL_A_LINKINFO_MAX = __ETHTOOL_A_LINKINFO_CNT - 1
+};
+enum {
+  ETHTOOL_A_LINKMODES_UNSPEC,
+  ETHTOOL_A_LINKMODES_HEADER,
+  ETHTOOL_A_LINKMODES_AUTONEG,
+  ETHTOOL_A_LINKMODES_OURS,
+  ETHTOOL_A_LINKMODES_PEER,
+  ETHTOOL_A_LINKMODES_SPEED,
+  ETHTOOL_A_LINKMODES_DUPLEX,
+  __ETHTOOL_A_LINKMODES_CNT,
+  ETHTOOL_A_LINKMODES_MAX = __ETHTOOL_A_LINKMODES_CNT - 1
+};
+enum {
+  ETHTOOL_A_LINKSTATE_UNSPEC,
+  ETHTOOL_A_LINKSTATE_HEADER,
+  ETHTOOL_A_LINKSTATE_LINK,
+  __ETHTOOL_A_LINKSTATE_CNT,
+  ETHTOOL_A_LINKSTATE_MAX = __ETHTOOL_A_LINKSTATE_CNT - 1
+};
+enum {
+  ETHTOOL_A_DEBUG_UNSPEC,
+  ETHTOOL_A_DEBUG_HEADER,
+  ETHTOOL_A_DEBUG_MSGMASK,
+  __ETHTOOL_A_DEBUG_CNT,
+  ETHTOOL_A_DEBUG_MAX = __ETHTOOL_A_DEBUG_CNT - 1
+};
+enum {
+  ETHTOOL_A_WOL_UNSPEC,
+  ETHTOOL_A_WOL_HEADER,
+  ETHTOOL_A_WOL_MODES,
+  ETHTOOL_A_WOL_SOPASS,
+  __ETHTOOL_A_WOL_CNT,
+  ETHTOOL_A_WOL_MAX = __ETHTOOL_A_WOL_CNT - 1
+};
+enum {
+  ETHTOOL_A_FEATURES_UNSPEC,
+  ETHTOOL_A_FEATURES_HEADER,
+  ETHTOOL_A_FEATURES_HW,
+  ETHTOOL_A_FEATURES_WANTED,
+  ETHTOOL_A_FEATURES_ACTIVE,
+  ETHTOOL_A_FEATURES_NOCHANGE,
+  __ETHTOOL_A_FEATURES_CNT,
+  ETHTOOL_A_FEATURES_MAX = __ETHTOOL_A_FEATURES_CNT - 1
+};
+enum {
+  ETHTOOL_A_PRIVFLAGS_UNSPEC,
+  ETHTOOL_A_PRIVFLAGS_HEADER,
+  ETHTOOL_A_PRIVFLAGS_FLAGS,
+  __ETHTOOL_A_PRIVFLAGS_CNT,
+  ETHTOOL_A_PRIVFLAGS_MAX = __ETHTOOL_A_PRIVFLAGS_CNT - 1
+};
+enum {
+  ETHTOOL_A_RINGS_UNSPEC,
+  ETHTOOL_A_RINGS_HEADER,
+  ETHTOOL_A_RINGS_RX_MAX,
+  ETHTOOL_A_RINGS_RX_MINI_MAX,
+  ETHTOOL_A_RINGS_RX_JUMBO_MAX,
+  ETHTOOL_A_RINGS_TX_MAX,
+  ETHTOOL_A_RINGS_RX,
+  ETHTOOL_A_RINGS_RX_MINI,
+  ETHTOOL_A_RINGS_RX_JUMBO,
+  ETHTOOL_A_RINGS_TX,
+  __ETHTOOL_A_RINGS_CNT,
+  ETHTOOL_A_RINGS_MAX = (__ETHTOOL_A_RINGS_CNT - 1)
+};
+enum {
+  ETHTOOL_A_CHANNELS_UNSPEC,
+  ETHTOOL_A_CHANNELS_HEADER,
+  ETHTOOL_A_CHANNELS_RX_MAX,
+  ETHTOOL_A_CHANNELS_TX_MAX,
+  ETHTOOL_A_CHANNELS_OTHER_MAX,
+  ETHTOOL_A_CHANNELS_COMBINED_MAX,
+  ETHTOOL_A_CHANNELS_RX_COUNT,
+  ETHTOOL_A_CHANNELS_TX_COUNT,
+  ETHTOOL_A_CHANNELS_OTHER_COUNT,
+  ETHTOOL_A_CHANNELS_COMBINED_COUNT,
+  __ETHTOOL_A_CHANNELS_CNT,
+  ETHTOOL_A_CHANNELS_MAX = (__ETHTOOL_A_CHANNELS_CNT - 1)
+};
+enum {
+  ETHTOOL_A_COALESCE_UNSPEC,
+  ETHTOOL_A_COALESCE_HEADER,
+  ETHTOOL_A_COALESCE_RX_USECS,
+  ETHTOOL_A_COALESCE_RX_MAX_FRAMES,
+  ETHTOOL_A_COALESCE_RX_USECS_IRQ,
+  ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ,
+  ETHTOOL_A_COALESCE_TX_USECS,
+  ETHTOOL_A_COALESCE_TX_MAX_FRAMES,
+  ETHTOOL_A_COALESCE_TX_USECS_IRQ,
+  ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ,
+  ETHTOOL_A_COALESCE_STATS_BLOCK_USECS,
+  ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX,
+  ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX,
+  ETHTOOL_A_COALESCE_PKT_RATE_LOW,
+  ETHTOOL_A_COALESCE_RX_USECS_LOW,
+  ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW,
+  ETHTOOL_A_COALESCE_TX_USECS_LOW,
+  ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW,
+  ETHTOOL_A_COALESCE_PKT_RATE_HIGH,
+  ETHTOOL_A_COALESCE_RX_USECS_HIGH,
+  ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH,
+  ETHTOOL_A_COALESCE_TX_USECS_HIGH,
+  ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH,
+  ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL,
+  __ETHTOOL_A_COALESCE_CNT,
+  ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1)
+};
+enum {
+  ETHTOOL_A_PAUSE_UNSPEC,
+  ETHTOOL_A_PAUSE_HEADER,
+  ETHTOOL_A_PAUSE_AUTONEG,
+  ETHTOOL_A_PAUSE_RX,
+  ETHTOOL_A_PAUSE_TX,
+  __ETHTOOL_A_PAUSE_CNT,
+  ETHTOOL_A_PAUSE_MAX = (__ETHTOOL_A_PAUSE_CNT - 1)
+};
+enum {
+  ETHTOOL_A_EEE_UNSPEC,
+  ETHTOOL_A_EEE_HEADER,
+  ETHTOOL_A_EEE_MODES_OURS,
+  ETHTOOL_A_EEE_MODES_PEER,
+  ETHTOOL_A_EEE_ACTIVE,
+  ETHTOOL_A_EEE_ENABLED,
+  ETHTOOL_A_EEE_TX_LPI_ENABLED,
+  ETHTOOL_A_EEE_TX_LPI_TIMER,
+  __ETHTOOL_A_EEE_CNT,
+  ETHTOOL_A_EEE_MAX = (__ETHTOOL_A_EEE_CNT - 1)
+};
+enum {
+  ETHTOOL_A_TSINFO_UNSPEC,
+  ETHTOOL_A_TSINFO_HEADER,
+  ETHTOOL_A_TSINFO_TIMESTAMPING,
+  ETHTOOL_A_TSINFO_TX_TYPES,
+  ETHTOOL_A_TSINFO_RX_FILTERS,
+  ETHTOOL_A_TSINFO_PHC_INDEX,
+  __ETHTOOL_A_TSINFO_CNT,
+  ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)
+};
+#define ETHTOOL_GENL_NAME "ethtool"
+#define ETHTOOL_GENL_VERSION 1
+#define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
+#endif
diff --git a/libc/kernel/uapi/linux/fanotify.h b/libc/kernel/uapi/linux/fanotify.h
index 8b4494f..8f9bea6 100644
--- a/libc/kernel/uapi/linux/fanotify.h
+++ b/libc/kernel/uapi/linux/fanotify.h
@@ -36,8 +36,9 @@
 #define FAN_OPEN_PERM 0x00010000
 #define FAN_ACCESS_PERM 0x00020000
 #define FAN_OPEN_EXEC_PERM 0x00040000
-#define FAN_ONDIR 0x40000000
+#define FAN_DIR_MODIFY 0x00080000
 #define FAN_EVENT_ON_CHILD 0x08000000
+#define FAN_ONDIR 0x40000000
 #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
 #define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
 #define FAN_CLOEXEC 0x00000001
@@ -77,6 +78,7 @@
   __s32 pid;
 };
 #define FAN_EVENT_INFO_TYPE_FID 1
+#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
 struct fanotify_event_info_header {
   __u8 info_type;
   __u8 pad;
diff --git a/libc/kernel/uapi/linux/fcntl.h b/libc/kernel/uapi/linux/fcntl.h
index d0f19c8..84f0095 100644
--- a/libc/kernel/uapi/linux/fcntl.h
+++ b/libc/kernel/uapi/linux/fcntl.h
@@ -19,6 +19,7 @@
 #ifndef _UAPI_LINUX_FCNTL_H
 #define _UAPI_LINUX_FCNTL_H
 #include <asm/fcntl.h>
+#include <linux/openat2.h>
 #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
 #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
 #define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
diff --git a/libc/kernel/uapi/linux/fdreg.h b/libc/kernel/uapi/linux/fdreg.h
index 5280a59..6d9f42d 100644
--- a/libc/kernel/uapi/linux/fdreg.h
+++ b/libc/kernel/uapi/linux/fdreg.h
@@ -18,16 +18,11 @@
  ****************************************************************************/
 #ifndef _LINUX_FDREG_H
 #define _LINUX_FDREG_H
-#ifdef FDPATCHES
-#define FD_IOPORT fdc_state[fdc].address
-#else
-#define FD_IOPORT 0x3f0
-#endif
-#define FD_STATUS (4 + FD_IOPORT)
-#define FD_DATA (5 + FD_IOPORT)
-#define FD_DOR (2 + FD_IOPORT)
-#define FD_DIR (7 + FD_IOPORT)
-#define FD_DCR (7 + FD_IOPORT)
+#define FD_STATUS 4
+#define FD_DATA 5
+#define FD_DOR 2
+#define FD_DIR 7
+#define FD_DCR 7
 #define STATUS_BUSYMASK 0x0F
 #define STATUS_BUSY 0x10
 #define STATUS_DMA 0x20
diff --git a/libc/kernel/uapi/linux/fscrypt.h b/libc/kernel/uapi/linux/fscrypt.h
index f91ce85..33ed9c6 100644
--- a/libc/kernel/uapi/linux/fscrypt.h
+++ b/libc/kernel/uapi/linux/fscrypt.h
@@ -18,6 +18,7 @@
  ****************************************************************************/
 #ifndef _UAPI_LINUX_FSCRYPT_H
 #define _UAPI_LINUX_FSCRYPT_H
+#include <linux/ioctl.h>
 #include <linux/types.h>
 #define FSCRYPT_POLICY_FLAGS_PAD_4 0x00
 #define FSCRYPT_POLICY_FLAGS_PAD_8 0x01
@@ -26,7 +27,8 @@
 #define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03
 #define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04
 #define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 0x08
-#define FSCRYPT_POLICY_FLAGS_VALID 0x0F
+#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
+#define FSCRYPT_POLICY_FLAGS_VALID 0x1F
 #define FSCRYPT_MODE_AES_256_XTS 1
 #define FSCRYPT_MODE_AES_256_CTS 4
 #define FSCRYPT_MODE_AES_128_CBC 5
@@ -80,10 +82,16 @@
     __u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE];
   } u;
 };
+struct fscrypt_provisioning_key_payload {
+  __u32 type;
+  __u32 __reserved;
+  __u8 raw[];
+};
 struct fscrypt_add_key_arg {
   struct fscrypt_key_specifier key_spec;
   __u32 raw_size;
-  __u32 __reserved[8];
+  __u32 key_id;
+  __u32 __reserved[7];
 #define __FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED 0x00000001
   __u32 __flags;
   __u8 raw[];
@@ -115,6 +123,7 @@
 #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
 #define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
 #define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
+#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
 #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE
 #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4
 #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8
diff --git a/libc/kernel/uapi/linux/gpio.h b/libc/kernel/uapi/linux/gpio.h
index 773f409..7e0ce7d 100644
--- a/libc/kernel/uapi/linux/gpio.h
+++ b/libc/kernel/uapi/linux/gpio.h
@@ -40,6 +40,17 @@
   char consumer[32];
 };
 #define GPIOHANDLES_MAX 64
+enum {
+  GPIOLINE_CHANGED_REQUESTED = 1,
+  GPIOLINE_CHANGED_RELEASED,
+  GPIOLINE_CHANGED_CONFIG,
+};
+struct gpioline_info_changed {
+  struct gpioline_info info;
+  __u64 timestamp;
+  __u32 event_type;
+  __u32 padding[5];
+};
 #define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
 #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
 #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
@@ -85,6 +96,8 @@
 };
 #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
 #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
+#define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0b, struct gpioline_info)
+#define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0c, __u32)
 #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
 #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
 #endif
diff --git a/libc/kernel/uapi/linux/hdlc/ioctl.h b/libc/kernel/uapi/linux/hdlc/ioctl.h
index 67b4d13..3c727c5 100644
--- a/libc/kernel/uapi/linux/hdlc/ioctl.h
+++ b/libc/kernel/uapi/linux/hdlc/ioctl.h
@@ -79,5 +79,13 @@
   unsigned int interval;
   unsigned int timeout;
 } cisco_proto;
+typedef struct {
+  unsigned short dce;
+  unsigned int modulo;
+  unsigned int window;
+  unsigned int t1;
+  unsigned int t2;
+  unsigned int n2;
+} x25_hdlc_proto;
 #endif
 #endif
diff --git a/libc/kernel/uapi/linux/hidraw.h b/libc/kernel/uapi/linux/hidraw.h
index 3ce49e1..ab7ed1c 100644
--- a/libc/kernel/uapi/linux/hidraw.h
+++ b/libc/kernel/uapi/linux/hidraw.h
@@ -36,6 +36,7 @@
 #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
 #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x06, len)
 #define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x07, len)
+#define HIDIOCGRAWUNIQ(len) _IOC(_IOC_READ, 'H', 0x08, len)
 #define HIDRAW_FIRST_MINOR 0
 #define HIDRAW_MAX_DEVICES 64
 #define HIDRAW_BUFFER_SIZE 64
diff --git a/libc/kernel/uapi/linux/hyperv.h b/libc/kernel/uapi/linux/hyperv.h
index fb114ad..daa8fc7 100644
--- a/libc/kernel/uapi/linux/hyperv.h
+++ b/libc/kernel/uapi/linux/hyperv.h
@@ -70,8 +70,8 @@
 };
 struct hv_fcopy_hdr {
   __u32 operation;
-  uuid_le service_id0;
-  uuid_le service_id1;
+  __u8 service_id0[16];
+  __u8 service_id1[16];
 } __attribute__((packed));
 #define OVER_WRITE 0x1
 #define CREATE_PATH 0x2
diff --git a/libc/kernel/uapi/linux/idxd.h b/libc/kernel/uapi/linux/idxd.h
new file mode 100644
index 0000000..9565ff7
--- /dev/null
+++ b/libc/kernel/uapi/linux/idxd.h
@@ -0,0 +1,200 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _USR_IDXD_H_
+#define _USR_IDXD_H_
+#include <stdint.h>
+#define IDXD_OP_FLAG_FENCE 0x0001
+#define IDXD_OP_FLAG_BOF 0x0002
+#define IDXD_OP_FLAG_CRAV 0x0004
+#define IDXD_OP_FLAG_RCR 0x0008
+#define IDXD_OP_FLAG_RCI 0x0010
+#define IDXD_OP_FLAG_CRSTS 0x0020
+#define IDXD_OP_FLAG_CR 0x0080
+#define IDXD_OP_FLAG_CC 0x0100
+#define IDXD_OP_FLAG_ADDR1_TCS 0x0200
+#define IDXD_OP_FLAG_ADDR2_TCS 0x0400
+#define IDXD_OP_FLAG_ADDR3_TCS 0x0800
+#define IDXD_OP_FLAG_CR_TCS 0x1000
+#define IDXD_OP_FLAG_STORD 0x2000
+#define IDXD_OP_FLAG_DRDBK 0x4000
+#define IDXD_OP_FLAG_DSTS 0x8000
+enum dsa_opcode {
+  DSA_OPCODE_NOOP = 0,
+  DSA_OPCODE_BATCH,
+  DSA_OPCODE_DRAIN,
+  DSA_OPCODE_MEMMOVE,
+  DSA_OPCODE_MEMFILL,
+  DSA_OPCODE_COMPARE,
+  DSA_OPCODE_COMPVAL,
+  DSA_OPCODE_CR_DELTA,
+  DSA_OPCODE_AP_DELTA,
+  DSA_OPCODE_DUALCAST,
+  DSA_OPCODE_CRCGEN = 0x10,
+  DSA_OPCODE_COPY_CRC,
+  DSA_OPCODE_DIF_CHECK,
+  DSA_OPCODE_DIF_INS,
+  DSA_OPCODE_DIF_STRP,
+  DSA_OPCODE_DIF_UPDT,
+  DSA_OPCODE_CFLUSH = 0x20,
+};
+enum dsa_completion_status {
+  DSA_COMP_NONE = 0,
+  DSA_COMP_SUCCESS,
+  DSA_COMP_SUCCESS_PRED,
+  DSA_COMP_PAGE_FAULT_NOBOF,
+  DSA_COMP_PAGE_FAULT_IR,
+  DSA_COMP_BATCH_FAIL,
+  DSA_COMP_BATCH_PAGE_FAULT,
+  DSA_COMP_DR_OFFSET_NOINC,
+  DSA_COMP_DR_OFFSET_ERANGE,
+  DSA_COMP_DIF_ERR,
+  DSA_COMP_BAD_OPCODE = 0x10,
+  DSA_COMP_INVALID_FLAGS,
+  DSA_COMP_NOZERO_RESERVE,
+  DSA_COMP_XFER_ERANGE,
+  DSA_COMP_DESC_CNT_ERANGE,
+  DSA_COMP_DR_ERANGE,
+  DSA_COMP_OVERLAP_BUFFERS,
+  DSA_COMP_DCAST_ERR,
+  DSA_COMP_DESCLIST_ALIGN,
+  DSA_COMP_INT_HANDLE_INVAL,
+  DSA_COMP_CRA_XLAT,
+  DSA_COMP_CRA_ALIGN,
+  DSA_COMP_ADDR_ALIGN,
+  DSA_COMP_PRIV_BAD,
+  DSA_COMP_TRAFFIC_CLASS_CONF,
+  DSA_COMP_PFAULT_RDBA,
+  DSA_COMP_HW_ERR1,
+  DSA_COMP_HW_ERR_DRB,
+  DSA_COMP_TRANSLATION_FAIL,
+};
+#define DSA_COMP_STATUS_MASK 0x7f
+#define DSA_COMP_STATUS_WRITE 0x80
+struct dsa_hw_desc {
+  uint32_t pasid : 20;
+  uint32_t rsvd : 11;
+  uint32_t priv : 1;
+  uint32_t flags : 24;
+  uint32_t opcode : 8;
+  uint64_t completion_addr;
+  union {
+    uint64_t src_addr;
+    uint64_t rdback_addr;
+    uint64_t pattern;
+    uint64_t desc_list_addr;
+  };
+  union {
+    uint64_t dst_addr;
+    uint64_t rdback_addr2;
+    uint64_t src2_addr;
+    uint64_t comp_pattern;
+  };
+  union {
+    uint32_t xfer_size;
+    uint32_t desc_count;
+  };
+  uint16_t int_handle;
+  uint16_t rsvd1;
+  union {
+    uint8_t expected_res;
+    struct {
+      uint64_t delta_addr;
+      uint32_t max_delta_size;
+    };
+    uint32_t delta_rec_size;
+    uint64_t dest2;
+    struct {
+      uint32_t crc_seed;
+      uint32_t crc_rsvd;
+      uint64_t seed_addr;
+    };
+    struct {
+      uint8_t src_dif_flags;
+      uint8_t dif_chk_res;
+      uint8_t dif_chk_flags;
+      uint8_t dif_chk_res2[5];
+      uint32_t chk_ref_tag_seed;
+      uint16_t chk_app_tag_mask;
+      uint16_t chk_app_tag_seed;
+    };
+    struct {
+      uint8_t dif_ins_res;
+      uint8_t dest_dif_flag;
+      uint8_t dif_ins_flags;
+      uint8_t dif_ins_res2[13];
+      uint32_t ins_ref_tag_seed;
+      uint16_t ins_app_tag_mask;
+      uint16_t ins_app_tag_seed;
+    };
+    struct {
+      uint8_t src_upd_flags;
+      uint8_t upd_dest_flags;
+      uint8_t dif_upd_flags;
+      uint8_t dif_upd_res[5];
+      uint32_t src_ref_tag_seed;
+      uint16_t src_app_tag_mask;
+      uint16_t src_app_tag_seed;
+      uint32_t dest_ref_tag_seed;
+      uint16_t dest_app_tag_mask;
+      uint16_t dest_app_tag_seed;
+    };
+    uint8_t op_specific[24];
+  };
+} __attribute__((packed));
+struct dsa_raw_desc {
+  uint64_t field[8];
+} __attribute__((packed));
+struct dsa_completion_record {
+  volatile uint8_t status;
+  union {
+    uint8_t result;
+    uint8_t dif_status;
+  };
+  uint16_t rsvd;
+  uint32_t bytes_completed;
+  uint64_t fault_addr;
+  union {
+    uint16_t delta_rec_size;
+    uint16_t crc_val;
+    struct {
+      uint32_t dif_chk_ref_tag;
+      uint16_t dif_chk_app_tag_mask;
+      uint16_t dif_chk_app_tag;
+    };
+    struct {
+      uint64_t dif_ins_res;
+      uint32_t dif_ins_ref_tag;
+      uint16_t dif_ins_app_tag_mask;
+      uint16_t dif_ins_app_tag;
+    };
+    struct {
+      uint32_t dif_upd_src_ref_tag;
+      uint16_t dif_upd_src_app_tag_mask;
+      uint16_t dif_upd_src_app_tag;
+      uint32_t dif_upd_dest_ref_tag;
+      uint16_t dif_upd_dest_app_tag_mask;
+      uint16_t dif_upd_dest_app_tag;
+    };
+    uint8_t op_specific[16];
+  };
+} __attribute__((packed));
+struct dsa_raw_completion_record {
+  uint64_t field[4];
+} __attribute__((packed));
+#endif
diff --git a/libc/kernel/uapi/linux/if.h b/libc/kernel/uapi/linux/if.h
index 12967f7..0821f2b 100644
--- a/libc/kernel/uapi/linux/if.h
+++ b/libc/kernel/uapi/linux/if.h
@@ -134,6 +134,7 @@
     fr_proto __user * fr;
     fr_proto_pvc __user * fr_pvc;
     fr_proto_pvc_info __user * fr_pvc_info;
+    x25_hdlc_proto __user * x25;
     sync_serial_settings __user * sync;
     te1_settings __user * te1;
   } ifs_ifsu;
diff --git a/libc/kernel/uapi/linux/if_bonding.h b/libc/kernel/uapi/linux/if_bonding.h
index a1fa959..0079f30 100644
--- a/libc/kernel/uapi/linux/if_bonding.h
+++ b/libc/kernel/uapi/linux/if_bonding.h
@@ -50,6 +50,14 @@
 #define BOND_XMIT_POLICY_LAYER23 2
 #define BOND_XMIT_POLICY_ENCAP23 3
 #define BOND_XMIT_POLICY_ENCAP34 4
+#define LACP_STATE_LACP_ACTIVITY 0x1
+#define LACP_STATE_LACP_TIMEOUT 0x2
+#define LACP_STATE_AGGREGATION 0x4
+#define LACP_STATE_SYNCHRONIZATION 0x8
+#define LACP_STATE_COLLECTING 0x10
+#define LACP_STATE_DISTRIBUTING 0x20
+#define LACP_STATE_DEFAULTED 0x40
+#define LACP_STATE_EXPIRED 0x80
 typedef struct ifbond {
   __s32 bond_mode;
   __s32 num_slaves;
diff --git a/libc/kernel/uapi/linux/if_bridge.h b/libc/kernel/uapi/linux/if_bridge.h
index 03cc1c4..b34116c 100644
--- a/libc/kernel/uapi/linux/if_bridge.h
+++ b/libc/kernel/uapi/linux/if_bridge.h
@@ -115,6 +115,7 @@
 #define BRIDGE_VLAN_INFO_RANGE_BEGIN (1 << 3)
 #define BRIDGE_VLAN_INFO_RANGE_END (1 << 4)
 #define BRIDGE_VLAN_INFO_BRENTRY (1 << 5)
+#define BRIDGE_VLAN_INFO_ONLY_OPTS (1 << 6)
 struct bridge_vlan_info {
   __u16 flags;
   __u16 vid;
@@ -136,6 +137,60 @@
   __u16 flags;
   __u32 pad2;
 };
+struct bridge_stp_xstats {
+  __u64 transition_blk;
+  __u64 transition_fwd;
+  __u64 rx_bpdu;
+  __u64 tx_bpdu;
+  __u64 rx_tcn;
+  __u64 tx_tcn;
+};
+struct br_vlan_msg {
+  __u8 family;
+  __u8 reserved1;
+  __u16 reserved2;
+  __u32 ifindex;
+};
+enum {
+  BRIDGE_VLANDB_DUMP_UNSPEC,
+  BRIDGE_VLANDB_DUMP_FLAGS,
+  __BRIDGE_VLANDB_DUMP_MAX,
+};
+#define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
+#define BRIDGE_VLANDB_DUMPF_STATS (1 << 0)
+enum {
+  BRIDGE_VLANDB_UNSPEC,
+  BRIDGE_VLANDB_ENTRY,
+  __BRIDGE_VLANDB_MAX,
+};
+#define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
+enum {
+  BRIDGE_VLANDB_ENTRY_UNSPEC,
+  BRIDGE_VLANDB_ENTRY_INFO,
+  BRIDGE_VLANDB_ENTRY_RANGE,
+  BRIDGE_VLANDB_ENTRY_STATE,
+  BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
+  BRIDGE_VLANDB_ENTRY_STATS,
+  __BRIDGE_VLANDB_ENTRY_MAX,
+};
+#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
+enum {
+  BRIDGE_VLANDB_TINFO_UNSPEC,
+  BRIDGE_VLANDB_TINFO_ID,
+  BRIDGE_VLANDB_TINFO_CMD,
+  __BRIDGE_VLANDB_TINFO_MAX,
+};
+#define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
+enum {
+  BRIDGE_VLANDB_STATS_UNSPEC,
+  BRIDGE_VLANDB_STATS_RX_BYTES,
+  BRIDGE_VLANDB_STATS_RX_PACKETS,
+  BRIDGE_VLANDB_STATS_TX_BYTES,
+  BRIDGE_VLANDB_STATS_TX_PACKETS,
+  BRIDGE_VLANDB_STATS_PAD,
+  __BRIDGE_VLANDB_STATS_MAX,
+};
+#define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
 enum {
   MDBA_UNSPEC,
   MDBA_MDB,
@@ -212,6 +267,7 @@
   BRIDGE_XSTATS_VLAN,
   BRIDGE_XSTATS_MCAST,
   BRIDGE_XSTATS_PAD,
+  BRIDGE_XSTATS_STP,
   __BRIDGE_XSTATS_MAX
 };
 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 7843fb5..790f1d2 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -146,6 +146,7 @@
   IFLA_MAX_MTU,
   IFLA_PROP_LIST,
   IFLA_ALT_IFNAME,
+  IFLA_PERM_ADDRESS,
   __IFLA_MAX
 };
 #define IFLA_MAX (__IFLA_MAX - 1)
@@ -367,6 +368,7 @@
   IFLA_MACSEC_REPLAY_PROTECT,
   IFLA_MACSEC_VALIDATION,
   IFLA_MACSEC_PAD,
+  IFLA_MACSEC_OFFLOAD,
   __IFLA_MACSEC_MAX,
 };
 #define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1)
@@ -384,6 +386,13 @@
   __MACSEC_VALIDATE_END,
   MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
 };
+enum macsec_offload {
+  MACSEC_OFFLOAD_OFF = 0,
+  MACSEC_OFFLOAD_PHY = 1,
+  MACSEC_OFFLOAD_MAC = 2,
+  __MACSEC_OFFLOAD_END,
+  MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
+};
 enum {
   IFLA_IPVLAN_UNSPEC,
   IFLA_IPVLAN_MODE,
@@ -470,6 +479,15 @@
   GENEVE_DF_MAX = __GENEVE_DF_END - 1,
 };
 enum {
+  IFLA_BAREUDP_UNSPEC,
+  IFLA_BAREUDP_PORT,
+  IFLA_BAREUDP_ETHERTYPE,
+  IFLA_BAREUDP_SRCPORT_MIN,
+  IFLA_BAREUDP_MULTIPROTO_MODE,
+  __IFLA_BAREUDP_MAX
+};
+#define IFLA_BAREUDP_MAX (__IFLA_BAREUDP_MAX - 1)
+enum {
   IFLA_PPP_UNSPEC,
   IFLA_PPP_DEV_FD,
   __IFLA_PPP_MAX
@@ -747,8 +765,9 @@
 #define XDP_FLAGS_SKB_MODE (1U << 1)
 #define XDP_FLAGS_DRV_MODE (1U << 2)
 #define XDP_FLAGS_HW_MODE (1U << 3)
+#define XDP_FLAGS_REPLACE (1U << 4)
 #define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE)
-#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES)
+#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES | XDP_FLAGS_REPLACE)
 enum {
   XDP_ATTACHED_NONE = 0,
   XDP_ATTACHED_DRV,
@@ -765,6 +784,7 @@
   IFLA_XDP_DRV_PROG_ID,
   IFLA_XDP_SKB_PROG_ID,
   IFLA_XDP_HW_PROG_ID,
+  IFLA_XDP_EXPECTED_FD,
   __IFLA_XDP_MAX,
 };
 #define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_macsec.h b/libc/kernel/uapi/linux/if_macsec.h
index a58f531..e60d767 100644
--- a/libc/kernel/uapi/linux/if_macsec.h
+++ b/libc/kernel/uapi/linux/if_macsec.h
@@ -25,6 +25,8 @@
 #define MACSEC_KEYID_LEN 16
 #define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL
 #define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL
+#define MACSEC_CIPHER_ID_GCM_AES_XPN_128 0x0080C20001000003ULL
+#define MACSEC_CIPHER_ID_GCM_AES_XPN_256 0x0080C20001000004ULL
 #define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL
 #define MACSEC_DEFAULT_CIPHER_ALT MACSEC_CIPHER_ID_GCM_AES_128
 #define MACSEC_MIN_ICV_LEN 8
@@ -40,6 +42,7 @@
   MACSEC_ATTR_RXSC_LIST,
   MACSEC_ATTR_TXSC_STATS,
   MACSEC_ATTR_SECY_STATS,
+  MACSEC_ATTR_OFFLOAD,
   __MACSEC_ATTR_END,
   NUM_MACSEC_ATTR = __MACSEC_ATTR_END,
   MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1,
@@ -84,10 +87,20 @@
   MACSEC_SA_ATTR_KEYID,
   MACSEC_SA_ATTR_STATS,
   MACSEC_SA_ATTR_PAD,
+  MACSEC_SA_ATTR_SSCI,
+  MACSEC_SA_ATTR_SALT,
   __MACSEC_SA_ATTR_END,
   NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END,
   MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1,
 };
+enum macsec_offload_attrs {
+  MACSEC_OFFLOAD_ATTR_UNSPEC,
+  MACSEC_OFFLOAD_ATTR_TYPE,
+  MACSEC_OFFLOAD_ATTR_PAD,
+  __MACSEC_OFFLOAD_ATTR_END,
+  NUM_MACSEC_OFFLOAD_ATTR = __MACSEC_OFFLOAD_ATTR_END,
+  MACSEC_OFFLOAD_ATTR_MAX = __MACSEC_OFFLOAD_ATTR_END - 1,
+};
 enum macsec_nl_commands {
   MACSEC_CMD_GET_TXSC,
   MACSEC_CMD_ADD_RXSC,
@@ -99,6 +112,7 @@
   MACSEC_CMD_ADD_RXSA,
   MACSEC_CMD_DEL_RXSA,
   MACSEC_CMD_UPD_RXSA,
+  MACSEC_CMD_UPD_OFFLOAD,
 };
 enum macsec_rxsc_stats_attr {
   MACSEC_RXSC_STATS_ATTR_UNSPEC,
diff --git a/libc/kernel/uapi/linux/in.h b/libc/kernel/uapi/linux/in.h
index f1dab00..99b54cc 100644
--- a/libc/kernel/uapi/linux/in.h
+++ b/libc/kernel/uapi/linux/in.h
@@ -74,8 +74,12 @@
 #define IPPROTO_UDPLITE IPPROTO_UDPLITE
   IPPROTO_MPLS = 137,
 #define IPPROTO_MPLS IPPROTO_MPLS
+  IPPROTO_ETHERNET = 143,
+#define IPPROTO_ETHERNET IPPROTO_ETHERNET
   IPPROTO_RAW = 255,
 #define IPPROTO_RAW IPPROTO_RAW
+  IPPROTO_MPTCP = 262,
+#define IPPROTO_MPTCP IPPROTO_MPTCP
   IPPROTO_MAX
 };
 #endif
diff --git a/libc/kernel/uapi/linux/incrementalfs.h b/libc/kernel/uapi/linux/incrementalfs.h
new file mode 100644
index 0000000..cfaee52
--- /dev/null
+++ b/libc/kernel/uapi/linux/incrementalfs.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_INCREMENTALFS_H
+#define _UAPI_LINUX_INCREMENTALFS_H
+#include <linux/limits.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/xattr.h>
+#define INCFS_NAME "incremental-fs"
+#define INCFS_MAGIC_NUMBER (0x5346434e49ul)
+#define INCFS_DATA_FILE_BLOCK_SIZE 4096
+#define INCFS_HEADER_VER 1
+#define INCFS_MAX_HASH_SIZE 32
+#define INCFS_MAX_FILE_ATTR_SIZE 512
+#define INCFS_PENDING_READS_FILENAME ".pending_reads"
+#define INCFS_LOG_FILENAME ".log"
+#define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
+#define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
+#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
+#define INCFS_MAX_SIGNATURE_SIZE 8096
+#define INCFS_SIGNATURE_VERSION 2
+#define INCFS_SIGNATURE_SECTIONS 2
+#define INCFS_IOCTL_BASE_CODE 'g'
+#define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
+#define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
+#define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
+#define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
+#define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
+enum incfs_compression_alg {
+  COMPRESSION_NONE = 0,
+  COMPRESSION_LZ4 = 1
+};
+enum incfs_block_flags {
+  INCFS_BLOCK_FLAGS_NONE = 0,
+  INCFS_BLOCK_FLAGS_HASH = 1,
+};
+typedef struct {
+  __u8 bytes[16];
+} incfs_uuid_t __attribute__((aligned(8)));
+struct incfs_pending_read_info {
+  incfs_uuid_t file_id;
+  __aligned_u64 timestamp_us;
+  __u32 block_index;
+  __u32 serial_number;
+};
+struct incfs_fill_block {
+  __u32 block_index;
+  __u32 data_len;
+  __aligned_u64 data;
+  __u8 compression;
+  __u8 flags;
+  __u16 reserved1;
+  __u32 reserved2;
+  __aligned_u64 reserved3;
+};
+struct incfs_fill_blocks {
+  __u64 count;
+  __aligned_u64 fill_blocks;
+};
+struct incfs_permit_fill {
+  __u32 file_descriptor;
+};
+enum incfs_hash_tree_algorithm {
+  INCFS_HASH_TREE_NONE = 0,
+  INCFS_HASH_TREE_SHA256 = 1
+};
+struct incfs_new_file_args {
+  incfs_uuid_t file_id;
+  __aligned_u64 size;
+  __u16 mode;
+  __u16 reserved1;
+  __u32 reserved2;
+  __aligned_u64 directory_path;
+  __aligned_u64 file_name;
+  __aligned_u64 file_attr;
+  __u32 file_attr_len;
+  __u32 reserved4;
+  __aligned_u64 signature_info;
+  __aligned_u64 signature_size;
+  __aligned_u64 reserved6;
+};
+struct incfs_get_file_sig_args {
+  __aligned_u64 file_signature;
+  __u32 file_signature_buf_size;
+  __u32 file_signature_len_out;
+};
+struct incfs_filled_range {
+  __u32 begin;
+  __u32 end;
+};
+struct incfs_get_filled_blocks_args {
+  __aligned_u64 range_buffer;
+  __u32 range_buffer_size;
+  __u32 start_index;
+  __u32 end_index;
+  __u32 total_blocks_out;
+  __u32 data_blocks_out;
+  __u32 range_buffer_size_out;
+  __u32 index_out;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/inet_diag.h b/libc/kernel/uapi/linux/inet_diag.h
index 5df55ef..fedbd85 100644
--- a/libc/kernel/uapi/linux/inet_diag.h
+++ b/libc/kernel/uapi/linux/inet_diag.h
@@ -59,8 +59,10 @@
 enum {
   INET_DIAG_REQ_NONE,
   INET_DIAG_REQ_BYTECODE,
+  INET_DIAG_REQ_SK_BPF_STORAGES,
+  __INET_DIAG_REQ_MAX,
 };
-#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
+#define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1)
 struct inet_diag_bc_op {
   unsigned char code;
   unsigned char yes;
@@ -124,6 +126,7 @@
   INET_DIAG_CLASS_ID,
   INET_DIAG_MD5SIG,
   INET_DIAG_ULP_INFO,
+  INET_DIAG_SK_BPF_STORAGES,
   __INET_DIAG_MAX,
 };
 #define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
@@ -131,6 +134,7 @@
   INET_ULP_INFO_UNSPEC,
   INET_ULP_INFO_NAME,
   INET_ULP_INFO_TLS,
+  INET_ULP_INFO_MPTCP,
   __INET_ULP_INFO_MAX,
 };
 #define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1)
diff --git a/libc/kernel/uapi/linux/input-event-codes.h b/libc/kernel/uapi/linux/input-event-codes.h
index ee0e92f..46cc7f0 100644
--- a/libc/kernel/uapi/linux/input-event-codes.h
+++ b/libc/kernel/uapi/linux/input-event-codes.h
@@ -572,6 +572,7 @@
 #define KEY_DATA 0x277
 #define KEY_ONSCREEN_KEYBOARD 0x278
 #define KEY_PRIVACY_SCREEN_TOGGLE 0x279
+#define KEY_SELECTIVE_SCREENSHOT 0x27a
 #define KEY_MACRO1 0x290
 #define KEY_MACRO2 0x291
 #define KEY_MACRO3 0x292
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index 0639a80..ef3ee51 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -29,7 +29,10 @@
     __u64 off;
     __u64 addr2;
   };
-  __u64 addr;
+  union {
+    __u64 addr;
+    __u64 splice_off_in;
+  };
   __u32 len;
   union {
     __kernel_rwf_t rw_flags;
@@ -40,21 +43,44 @@
     __u32 timeout_flags;
     __u32 accept_flags;
     __u32 cancel_flags;
+    __u32 open_flags;
+    __u32 statx_flags;
+    __u32 fadvise_advice;
+    __u32 splice_flags;
   };
   __u64 user_data;
   union {
-    __u16 buf_index;
+    struct {
+      union {
+        __u16 buf_index;
+        __u16 buf_group;
+      } __attribute__((packed));
+      __u16 personality;
+      __s32 splice_fd_in;
+    };
     __u64 __pad2[3];
   };
 };
-#define IOSQE_FIXED_FILE (1U << 0)
-#define IOSQE_IO_DRAIN (1U << 1)
-#define IOSQE_IO_LINK (1U << 2)
-#define IOSQE_IO_HARDLINK (1U << 3)
+enum {
+  IOSQE_FIXED_FILE_BIT,
+  IOSQE_IO_DRAIN_BIT,
+  IOSQE_IO_LINK_BIT,
+  IOSQE_IO_HARDLINK_BIT,
+  IOSQE_ASYNC_BIT,
+  IOSQE_BUFFER_SELECT_BIT,
+};
+#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
+#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
+#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
+#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
+#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
+#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
 #define IORING_SETUP_IOPOLL (1U << 0)
 #define IORING_SETUP_SQPOLL (1U << 1)
 #define IORING_SETUP_SQ_AFF (1U << 2)
 #define IORING_SETUP_CQSIZE (1U << 3)
+#define IORING_SETUP_CLAMP (1U << 4)
+#define IORING_SETUP_ATTACH_WQ (1U << 5)
 enum {
   IORING_OP_NOP,
   IORING_OP_READV,
@@ -73,15 +99,36 @@
   IORING_OP_ASYNC_CANCEL,
   IORING_OP_LINK_TIMEOUT,
   IORING_OP_CONNECT,
+  IORING_OP_FALLOCATE,
+  IORING_OP_OPENAT,
+  IORING_OP_CLOSE,
+  IORING_OP_FILES_UPDATE,
+  IORING_OP_STATX,
+  IORING_OP_READ,
+  IORING_OP_WRITE,
+  IORING_OP_FADVISE,
+  IORING_OP_MADVISE,
+  IORING_OP_SEND,
+  IORING_OP_RECV,
+  IORING_OP_OPENAT2,
+  IORING_OP_EPOLL_CTL,
+  IORING_OP_SPLICE,
+  IORING_OP_PROVIDE_BUFFERS,
+  IORING_OP_REMOVE_BUFFERS,
   IORING_OP_LAST,
 };
 #define IORING_FSYNC_DATASYNC (1U << 0)
 #define IORING_TIMEOUT_ABS (1U << 0)
+#define SPLICE_F_FD_IN_FIXED (1U << 31)
 struct io_uring_cqe {
   __u64 user_data;
   __s32 res;
   __u32 flags;
 };
+#define IORING_CQE_F_BUFFER (1U << 0)
+enum {
+  IORING_CQE_BUFFER_SHIFT = 16,
+};
 #define IORING_OFF_SQ_RING 0ULL
 #define IORING_OFF_CQ_RING 0x8000000ULL
 #define IORING_OFF_SQES 0x10000000ULL
@@ -115,13 +162,17 @@
   __u32 sq_thread_cpu;
   __u32 sq_thread_idle;
   __u32 features;
-  __u32 resv[4];
+  __u32 wq_fd;
+  __u32 resv[3];
   struct io_sqring_offsets sq_off;
   struct io_cqring_offsets cq_off;
 };
 #define IORING_FEAT_SINGLE_MMAP (1U << 0)
 #define IORING_FEAT_NODROP (1U << 1)
 #define IORING_FEAT_SUBMIT_STABLE (1U << 2)
+#define IORING_FEAT_RW_CUR_POS (1U << 3)
+#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
+#define IORING_FEAT_FAST_POLL (1U << 5)
 #define IORING_REGISTER_BUFFERS 0
 #define IORING_UNREGISTER_BUFFERS 1
 #define IORING_REGISTER_FILES 2
@@ -129,9 +180,27 @@
 #define IORING_REGISTER_EVENTFD 4
 #define IORING_UNREGISTER_EVENTFD 5
 #define IORING_REGISTER_FILES_UPDATE 6
+#define IORING_REGISTER_EVENTFD_ASYNC 7
+#define IORING_REGISTER_PROBE 8
+#define IORING_REGISTER_PERSONALITY 9
+#define IORING_UNREGISTER_PERSONALITY 10
 struct io_uring_files_update {
   __u32 offset;
   __u32 resv;
   __aligned_u64 fds;
 };
+#define IO_URING_OP_SUPPORTED (1U << 0)
+struct io_uring_probe_op {
+  __u8 op;
+  __u8 resv;
+  __u16 flags;
+  __u32 resv2;
+};
+struct io_uring_probe {
+  __u8 last_op;
+  __u8 ops_len;
+  __u16 resv;
+  __u32 resv2[3];
+  struct io_uring_probe_op ops[0];
+};
 #endif
diff --git a/libc/kernel/uapi/linux/ipv6.h b/libc/kernel/uapi/linux/ipv6.h
index ff345a6..7cd6cb0 100644
--- a/libc/kernel/uapi/linux/ipv6.h
+++ b/libc/kernel/uapi/linux/ipv6.h
@@ -43,6 +43,7 @@
 #define IPV6_SRCRT_STRICT 0x01
 #define IPV6_SRCRT_TYPE_0 0
 #define IPV6_SRCRT_TYPE_2 2
+#define IPV6_SRCRT_TYPE_3 3
 #define IPV6_SRCRT_TYPE_4 4
 struct ipv6_rt_hdr {
   __u8 nexthdr;
@@ -141,6 +142,7 @@
   DEVCONF_DISABLE_POLICY,
   DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN,
   DEVCONF_NDISC_TCLASS,
+  DEVCONF_RPL_SEG_ENABLED,
   DEVCONF_MAX
 };
 #endif
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index b865936..ea6bca5 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -355,11 +355,16 @@
   __u32 size;
   __u32 op;
   __u64 buf;
-  __u8 ar;
-  __u8 reserved[31];
+  union {
+    __u8 ar;
+    __u32 sida_offset;
+    __u8 reserved[32];
+  };
 };
 #define KVM_S390_MEMOP_LOGICAL_READ 0
 #define KVM_S390_MEMOP_LOGICAL_WRITE 1
+#define KVM_S390_MEMOP_SIDA_READ 2
+#define KVM_S390_MEMOP_SIDA_WRITE 3
 #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
 #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
 struct kvm_interrupt {
@@ -788,6 +793,9 @@
 #define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176
 #define KVM_CAP_ARM_NISV_TO_USER 177
 #define KVM_CAP_ARM_INJECT_EXT_DABT 178
+#define KVM_CAP_S390_VCPU_RESETS 179
+#define KVM_CAP_S390_PROTECTED 180
+#define KVM_CAP_PPC_SECURE_GUEST 181
 #ifdef KVM_CAP_IRQ_ROUTING
 struct kvm_irq_routing_irqchip {
   __u32 irqchip;
@@ -1110,6 +1118,35 @@
 #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
 #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
 #define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
+#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
+#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
+struct kvm_s390_pv_sec_parm {
+  __u64 origin;
+  __u64 length;
+};
+struct kvm_s390_pv_unp {
+  __u64 addr;
+  __u64 size;
+  __u64 tweak;
+};
+enum pv_cmd_id {
+  KVM_PV_ENABLE,
+  KVM_PV_DISABLE,
+  KVM_PV_SET_SEC_PARMS,
+  KVM_PV_UNPACK,
+  KVM_PV_VERIFY,
+  KVM_PV_PREP_RESET,
+  KVM_PV_UNSHARE_ALL,
+};
+struct kvm_pv_cmd {
+  __u32 cmd;
+  __u16 rc;
+  __u16 rrc;
+  __u64 data;
+  __u32 flags;
+  __u32 reserved[3];
+};
+#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
 enum sev_cmd_id {
   KVM_SEV_INIT = 0,
   KVM_SEV_ES_INIT,
@@ -1228,4 +1265,6 @@
 };
 #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
 #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
+#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
+#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
 #endif
diff --git a/libc/kernel/uapi/linux/lwtunnel.h b/libc/kernel/uapi/linux/lwtunnel.h
index f1e2ab8..f472150 100644
--- a/libc/kernel/uapi/linux/lwtunnel.h
+++ b/libc/kernel/uapi/linux/lwtunnel.h
@@ -28,6 +28,7 @@
   LWTUNNEL_ENCAP_SEG6,
   LWTUNNEL_ENCAP_BPF,
   LWTUNNEL_ENCAP_SEG6_LOCAL,
+  LWTUNNEL_ENCAP_RPL,
   __LWTUNNEL_ENCAP_MAX,
 };
 #define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/magic.h b/libc/kernel/uapi/linux/magic.h
index ca1daea..82b9dce 100644
--- a/libc/kernel/uapi/linux/magic.h
+++ b/libc/kernel/uapi/linux/magic.h
@@ -68,7 +68,6 @@
 #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
 #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
 #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
-#define SDCARDFS_SUPER_MAGIC 0x5dca2df5
 #define SMB_SUPER_MAGIC 0x517B
 #define CGROUP_SUPER_MAGIC 0x27e0eb
 #define CGROUP2_SUPER_MAGIC 0x63677270
@@ -93,6 +92,7 @@
 #define NSFS_MAGIC 0x6e736673
 #define BPF_FS_MAGIC 0xcafe4a11
 #define AAFS_MAGIC 0x5a3c69f0
+#define ZONEFS_MAGIC 0x5a4f4653
 #define UDF_SUPER_MAGIC 0x15013346
 #define BALLOON_KVM_MAGIC 0x13661366
 #define ZSMALLOC_MAGIC 0x58295829
diff --git a/libc/kernel/uapi/linux/media-bus-format.h b/libc/kernel/uapi/linux/media-bus-format.h
index f0d81d0..9e0ef0f 100644
--- a/libc/kernel/uapi/linux/media-bus-format.h
+++ b/libc/kernel/uapi/linux/media-bus-format.h
@@ -68,6 +68,7 @@
 #define MEDIA_BUS_FMT_VYUY12_2X12 0x201d
 #define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
 #define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
+#define MEDIA_BUS_FMT_Y14_1X14 0x202d
 #define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
 #define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
 #define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
diff --git a/libc/kernel/uapi/linux/mii.h b/libc/kernel/uapi/linux/mii.h
index 3c6c564..75b29fd 100644
--- a/libc/kernel/uapi/linux/mii.h
+++ b/libc/kernel/uapi/linux/mii.h
@@ -120,6 +120,21 @@
 #define NWAYTEST_RESV1 0x00ff
 #define NWAYTEST_LOOPBACK 0x0100
 #define NWAYTEST_RESV2 0xfe00
+#define ADVERTISE_SGMII 0x0001
+#define LPA_SGMII 0x0001
+#define LPA_SGMII_SPD_MASK 0x0c00
+#define LPA_SGMII_FULL_DUPLEX 0x1000
+#define LPA_SGMII_DPX_SPD_MASK 0x1C00
+#define LPA_SGMII_10 0x0000
+#define LPA_SGMII_10HALF 0x0000
+#define LPA_SGMII_10FULL 0x1000
+#define LPA_SGMII_100 0x0400
+#define LPA_SGMII_100HALF 0x0400
+#define LPA_SGMII_100FULL 0x1400
+#define LPA_SGMII_1000 0x0800
+#define LPA_SGMII_1000HALF 0x0800
+#define LPA_SGMII_1000FULL 0x1800
+#define LPA_SGMII_LINK 0x8000
 #define ADVERTISE_1000FULL 0x0200
 #define ADVERTISE_1000HALF 0x0100
 #define CTL1000_AS_MASTER 0x0800
diff --git a/libc/kernel/uapi/linux/mman.h b/libc/kernel/uapi/linux/mman.h
index e469374..9cb8776 100644
--- a/libc/kernel/uapi/linux/mman.h
+++ b/libc/kernel/uapi/linux/mman.h
@@ -22,6 +22,7 @@
 #include <asm-generic/hugetlb_encode.h>
 #define MREMAP_MAYMOVE 1
 #define MREMAP_FIXED 2
+#define MREMAP_DONTUNMAP 4
 #define OVERCOMMIT_GUESS 0
 #define OVERCOMMIT_ALWAYS 1
 #define OVERCOMMIT_NEVER 2
diff --git a/libc/kernel/uapi/linux/mptcp.h b/libc/kernel/uapi/linux/mptcp.h
new file mode 100644
index 0000000..43702f3
--- /dev/null
+++ b/libc/kernel/uapi/linux/mptcp.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_MPTCP_H
+#define _UAPI_MPTCP_H
+#include <linux/const.h>
+#include <linux/types.h>
+#define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
+#define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
+#define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)
+#define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3)
+#define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4)
+#define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5)
+#define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6)
+#define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7)
+#define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8)
+enum {
+  MPTCP_SUBFLOW_ATTR_UNSPEC,
+  MPTCP_SUBFLOW_ATTR_TOKEN_REM,
+  MPTCP_SUBFLOW_ATTR_TOKEN_LOC,
+  MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ,
+  MPTCP_SUBFLOW_ATTR_MAP_SEQ,
+  MPTCP_SUBFLOW_ATTR_MAP_SFSEQ,
+  MPTCP_SUBFLOW_ATTR_SSN_OFFSET,
+  MPTCP_SUBFLOW_ATTR_MAP_DATALEN,
+  MPTCP_SUBFLOW_ATTR_FLAGS,
+  MPTCP_SUBFLOW_ATTR_ID_REM,
+  MPTCP_SUBFLOW_ATTR_ID_LOC,
+  MPTCP_SUBFLOW_ATTR_PAD,
+  __MPTCP_SUBFLOW_ATTR_MAX
+};
+#define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1)
+#define MPTCP_PM_NAME "mptcp_pm"
+#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
+#define MPTCP_PM_VER 0x1
+enum {
+  MPTCP_PM_ATTR_UNSPEC,
+  MPTCP_PM_ATTR_ADDR,
+  MPTCP_PM_ATTR_RCV_ADD_ADDRS,
+  MPTCP_PM_ATTR_SUBFLOWS,
+  __MPTCP_PM_ATTR_MAX
+};
+#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
+enum {
+  MPTCP_PM_ADDR_ATTR_UNSPEC,
+  MPTCP_PM_ADDR_ATTR_FAMILY,
+  MPTCP_PM_ADDR_ATTR_ID,
+  MPTCP_PM_ADDR_ATTR_ADDR4,
+  MPTCP_PM_ADDR_ATTR_ADDR6,
+  MPTCP_PM_ADDR_ATTR_PORT,
+  MPTCP_PM_ADDR_ATTR_FLAGS,
+  MPTCP_PM_ADDR_ATTR_IF_IDX,
+  __MPTCP_PM_ADDR_ATTR_MAX
+};
+#define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1)
+#define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
+#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
+#define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
+enum {
+  MPTCP_PM_CMD_UNSPEC,
+  MPTCP_PM_CMD_ADD_ADDR,
+  MPTCP_PM_CMD_DEL_ADDR,
+  MPTCP_PM_CMD_GET_ADDR,
+  MPTCP_PM_CMD_FLUSH_ADDRS,
+  MPTCP_PM_CMD_SET_LIMITS,
+  MPTCP_PM_CMD_GET_LIMITS,
+  __MPTCP_PM_CMD_AFTER_LAST
+};
+#endif
diff --git a/libc/kernel/uapi/linux/net_dropmon.h b/libc/kernel/uapi/linux/net_dropmon.h
index a3d9119..01b76cb 100644
--- a/libc/kernel/uapi/linux/net_dropmon.h
+++ b/libc/kernel/uapi/linux/net_dropmon.h
@@ -86,6 +86,7 @@
   NET_DM_ATTR_HW_TRAP_COUNT,
   NET_DM_ATTR_SW_DROPS,
   NET_DM_ATTR_HW_DROPS,
+  NET_DM_ATTR_FLOW_ACTION_COOKIE,
   __NET_DM_ATTR_MAX,
   NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
 };
diff --git a/libc/kernel/uapi/linux/net_tstamp.h b/libc/kernel/uapi/linux/net_tstamp.h
index 375906a..373d1bb 100644
--- a/libc/kernel/uapi/linux/net_tstamp.h
+++ b/libc/kernel/uapi/linux/net_tstamp.h
@@ -49,6 +49,8 @@
   HWTSTAMP_TX_OFF,
   HWTSTAMP_TX_ON,
   HWTSTAMP_TX_ONESTEP_SYNC,
+  HWTSTAMP_TX_ONESTEP_P2P,
+  __HWTSTAMP_TX_CNT
 };
 enum hwtstamp_rx_filters {
   HWTSTAMP_FILTER_NONE,
@@ -67,6 +69,7 @@
   HWTSTAMP_FILTER_PTP_V2_SYNC,
   HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
   HWTSTAMP_FILTER_NTP_ALL,
+  __HWTSTAMP_FILTER_CNT
 };
 struct scm_ts_pktinfo {
   __u32 if_index;
diff --git a/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h b/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
index 43d60ca..152584a 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
@@ -64,7 +64,7 @@
   IPS_HELPER = (1 << IPS_HELPER_BIT),
   IPS_OFFLOAD_BIT = 14,
   IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT),
-  IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD),
+  IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_UNTRACKED | IPS_OFFLOAD),
   __IPS_MAX_BIT = 15,
 };
 enum ip_conntrack_events {
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index 2fe11b0..6d3ec0a 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -52,6 +52,7 @@
 #define NFT_REG_MAX (__NFT_REG_MAX - 1)
 #define NFT_REG_SIZE 16
 #define NFT_REG32_SIZE 4
+#define NFT_REG32_COUNT (NFT_REG32_15 - NFT_REG32_00 + 1)
 enum nft_verdicts {
   NFT_CONTINUE = - 1,
   NFT_BREAK = - 2,
@@ -164,6 +165,7 @@
   NFT_SET_TIMEOUT = 0x10,
   NFT_SET_EVAL = 0x20,
   NFT_SET_OBJECT = 0x40,
+  NFT_SET_CONCAT = 0x80,
 };
 enum nft_set_policies {
   NFT_SET_POL_PERFORMANCE,
@@ -172,9 +174,16 @@
 enum nft_set_desc_attributes {
   NFTA_SET_DESC_UNSPEC,
   NFTA_SET_DESC_SIZE,
+  NFTA_SET_DESC_CONCAT,
   __NFTA_SET_DESC_MAX
 };
 #define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
+enum nft_set_field_attributes {
+  NFTA_SET_FIELD_UNSPEC,
+  NFTA_SET_FIELD_LEN,
+  __NFTA_SET_FIELD_MAX
+};
+#define NFTA_SET_FIELD_MAX (__NFTA_SET_FIELD_MAX - 1)
 enum nft_set_attributes {
   NFTA_SET_UNSPEC,
   NFTA_SET_TABLE,
@@ -193,6 +202,7 @@
   NFTA_SET_PAD,
   NFTA_SET_OBJ_TYPE,
   NFTA_SET_HANDLE,
+  NFTA_SET_EXPR,
   __NFTA_SET_MAX
 };
 #define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -210,6 +220,7 @@
   NFTA_SET_ELEM_EXPR,
   NFTA_SET_ELEM_PAD,
   NFTA_SET_ELEM_OBJREF,
+  NFTA_SET_ELEM_KEY_END,
   __NFTA_SET_ELEM_MAX
 };
 #define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
@@ -256,6 +267,11 @@
   __NFTA_IMMEDIATE_MAX
 };
 #define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
+enum nft_bitwise_ops {
+  NFT_BITWISE_BOOL,
+  NFT_BITWISE_LSHIFT,
+  NFT_BITWISE_RSHIFT,
+};
 enum nft_bitwise_attributes {
   NFTA_BITWISE_UNSPEC,
   NFTA_BITWISE_SREG,
@@ -263,6 +279,8 @@
   NFTA_BITWISE_LEN,
   NFTA_BITWISE_MASK,
   NFTA_BITWISE_XOR,
+  NFTA_BITWISE_OP,
+  NFTA_BITWISE_DATA,
   __NFTA_BITWISE_MAX
 };
 #define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
@@ -425,6 +443,8 @@
   NFT_META_TIME_NS,
   NFT_META_TIME_DAY,
   NFT_META_TIME_HOUR,
+  NFT_META_SDIF,
+  NFT_META_SDIFNAME,
 };
 enum nft_rt_keys {
   NFT_RT_CLASSID,
@@ -784,6 +804,11 @@
   __NFTA_OBJ_MAX
 };
 #define NFTA_OBJ_MAX (__NFTA_OBJ_MAX - 1)
+enum nft_flowtable_flags {
+  NFT_FLOWTABLE_HW_OFFLOAD = 0x1,
+  NFT_FLOWTABLE_COUNTER = 0x2,
+  NFT_FLOWTABLE_MASK = (NFT_FLOWTABLE_HW_OFFLOAD | NFT_FLOWTABLE_COUNTER)
+};
 enum nft_flowtable_attributes {
   NFTA_FLOWTABLE_UNSPEC,
   NFTA_FLOWTABLE_TABLE,
@@ -915,6 +940,7 @@
   NFTA_TUNNEL_KEY_OPTS_UNSPEC,
   NFTA_TUNNEL_KEY_OPTS_VXLAN,
   NFTA_TUNNEL_KEY_OPTS_ERSPAN,
+  NFTA_TUNNEL_KEY_OPTS_GENEVE,
   __NFTA_TUNNEL_KEY_OPTS_MAX
 };
 #define NFTA_TUNNEL_KEY_OPTS_MAX (__NFTA_TUNNEL_KEY_OPTS_MAX - 1)
@@ -933,6 +959,14 @@
   __NFTA_TUNNEL_KEY_ERSPAN_MAX
 };
 #define NFTA_TUNNEL_KEY_ERSPAN_MAX (__NFTA_TUNNEL_KEY_ERSPAN_MAX - 1)
+enum nft_tunnel_opts_geneve_attributes {
+  NFTA_TUNNEL_KEY_GENEVE_UNSPEC,
+  NFTA_TUNNEL_KEY_GENEVE_CLASS,
+  NFTA_TUNNEL_KEY_GENEVE_TYPE,
+  NFTA_TUNNEL_KEY_GENEVE_DATA,
+  __NFTA_TUNNEL_KEY_GENEVE_MAX
+};
+#define NFTA_TUNNEL_KEY_GENEVE_MAX (__NFTA_TUNNEL_KEY_GENEVE_MAX - 1)
 enum nft_tunnel_flags {
   NFT_TUNNEL_F_ZERO_CSUM_TX = (1 << 0),
   NFT_TUNNEL_F_DONT_FRAGMENT = (1 << 1),
diff --git a/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h b/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
index e1f0e33..a59ae09 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
@@ -20,6 +20,7 @@
 #define _XT_IDLETIMER_H
 #include <linux/types.h>
 #define MAX_IDLETIMER_LABEL_SIZE 28
+#define XT_IDLETIMER_ALARM 0x01
 #define NLMSG_MAX_SIZE 64
 #define NL_EVENT_TYPE_INACTIVE 0
 #define NL_EVENT_TYPE_ACTIVE 1
@@ -29,4 +30,11 @@
   __u8 send_nl_msg;
   struct idletimer_tg * timer __attribute__((aligned(8)));
 };
+struct idletimer_tg_info_v1 {
+  __u32 timeout;
+  char label[MAX_IDLETIMER_LABEL_SIZE];
+  __u8 send_nl_msg;
+  __u8 timer_type;
+  struct idletimer_tg * timer __attribute__((aligned(8)));
+};
 #endif
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index 9292571..7f8b45f 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -174,6 +174,7 @@
   NL80211_CMD_NOTIFY_RADAR,
   NL80211_CMD_UPDATE_OWE_INFO,
   NL80211_CMD_PROBE_MESH_LINK,
+  NL80211_CMD_SET_TID_CONFIG,
   __NL80211_CMD_AFTER_LAST,
   NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
 };
@@ -473,6 +474,12 @@
   NL80211_ATTR_WIPHY_EDMG_CHANNELS,
   NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
   NL80211_ATTR_VLAN_ID,
+  NL80211_ATTR_HE_BSS_COLOR,
+  NL80211_ATTR_IFTYPE_AKM_SUITES,
+  NL80211_ATTR_TID_CONFIG,
+  NL80211_ATTR_CONTROL_PORT_NO_PREAUTH,
+  NL80211_ATTR_PMK_LIFETIME,
+  NL80211_ATTR_PMK_REAUTH_THRESHOLD,
   __NL80211_ATTR_AFTER_LAST,
   NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
   NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -755,6 +762,7 @@
   NL80211_FREQUENCY_ATTR_NO_20MHZ,
   NL80211_FREQUENCY_ATTR_NO_10MHZ,
   NL80211_FREQUENCY_ATTR_WMM,
+  NL80211_FREQUENCY_ATTR_NO_HE,
   __NL80211_FREQUENCY_ATTR_AFTER_LAST,
   NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
 };
@@ -822,6 +830,7 @@
   NL80211_RRF_NO_HT40PLUS = 1 << 14,
   NL80211_RRF_NO_80MHZ = 1 << 15,
   NL80211_RRF_NO_160MHZ = 1 << 16,
+  NL80211_RRF_NO_HE = 1 << 17,
 };
 #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
 #define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
@@ -1050,6 +1059,7 @@
   NL80211_KEY_TYPE,
   NL80211_KEY_DEFAULT_TYPES,
   NL80211_KEY_MODE,
+  NL80211_KEY_DEFAULT_BEACON,
   __NL80211_KEY_AFTER_LAST,
   NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
 };
@@ -1107,6 +1117,25 @@
   NL80211_TX_POWER_LIMITED,
   NL80211_TX_POWER_FIXED,
 };
+enum nl80211_tid_config {
+  NL80211_TID_CONFIG_ENABLE,
+  NL80211_TID_CONFIG_DISABLE,
+};
+enum nl80211_tid_config_attr {
+  __NL80211_TID_CONFIG_ATTR_INVALID,
+  NL80211_TID_CONFIG_ATTR_PAD,
+  NL80211_TID_CONFIG_ATTR_VIF_SUPP,
+  NL80211_TID_CONFIG_ATTR_PEER_SUPP,
+  NL80211_TID_CONFIG_ATTR_OVERRIDE,
+  NL80211_TID_CONFIG_ATTR_TIDS,
+  NL80211_TID_CONFIG_ATTR_NOACK,
+  NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
+  NL80211_TID_CONFIG_ATTR_RETRY_LONG,
+  NL80211_TID_CONFIG_ATTR_AMPDU_CTRL,
+  NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL,
+  __NL80211_TID_CONFIG_ATTR_AFTER_LAST,
+  NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1
+};
 enum nl80211_packet_pattern_attr {
   __NL80211_PKTPAT_INVALID,
   NL80211_PKTPAT_MASK,
@@ -1345,6 +1374,10 @@
   NL80211_EXT_FEATURE_SAE_OFFLOAD,
   NL80211_EXT_FEATURE_VLAN_OFFLOAD,
   NL80211_EXT_FEATURE_AQL,
+  NL80211_EXT_FEATURE_BEACON_PROTECTION,
+  NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH,
+  NL80211_EXT_FEATURE_PROTECTED_TWT,
+  NL80211_EXT_FEATURE_DEL_IBSS_STA,
   NUM_NL80211_EXT_FEATURES,
   MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
 };
@@ -1535,6 +1568,7 @@
   NL80211_PREAMBLE_HT,
   NL80211_PREAMBLE_VHT,
   NL80211_PREAMBLE_DMG,
+  NL80211_PREAMBLE_HE,
 };
 enum nl80211_peer_measurement_type {
   NL80211_PMSR_TYPE_INVALID,
@@ -1595,6 +1629,8 @@
   NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
   NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
   NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
+  NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED,
+  NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED,
   NUM_NL80211_PMSR_FTM_CAPA_ATTR,
   NL80211_PMSR_FTM_CAPA_ATTR_MAX = NUM_NL80211_PMSR_FTM_CAPA_ATTR - 1
 };
@@ -1609,6 +1645,8 @@
   NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
   NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
   NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
+  NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED,
+  NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,
   NUM_NL80211_PMSR_FTM_REQ_ATTR,
   NL80211_PMSR_FTM_REQ_ATTR_MAX = NUM_NL80211_PMSR_FTM_REQ_ATTR - 1
 };
@@ -1655,4 +1693,19 @@
   __NL80211_HE_OBSS_PD_ATTR_LAST,
   NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
 };
+enum nl80211_bss_color_attributes {
+  __NL80211_HE_BSS_COLOR_ATTR_INVALID,
+  NL80211_HE_BSS_COLOR_ATTR_COLOR,
+  NL80211_HE_BSS_COLOR_ATTR_DISABLED,
+  NL80211_HE_BSS_COLOR_ATTR_PARTIAL,
+  __NL80211_HE_BSS_COLOR_ATTR_LAST,
+  NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1,
+};
+enum nl80211_iftype_akm_attributes {
+  __NL80211_IFTYPE_AKM_ATTR_INVALID,
+  NL80211_IFTYPE_AKM_ATTR_IFTYPES,
+  NL80211_IFTYPE_AKM_ATTR_SUITES,
+  __NL80211_IFTYPE_AKM_ATTR_LAST,
+  NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
+};
 #endif
diff --git a/libc/kernel/uapi/linux/hysdn_if.h b/libc/kernel/uapi/linux/openat2.h
similarity index 72%
rename from libc/kernel/uapi/linux/hysdn_if.h
rename to libc/kernel/uapi/linux/openat2.h
index 2aac1d0..27136af 100644
--- a/libc/kernel/uapi/linux/hysdn_if.h
+++ b/libc/kernel/uapi/linux/openat2.h
@@ -16,16 +16,17 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define ERR_NONE 0
-#define ERR_ALREADY_BOOT 1000
-#define EPOF_BAD_MAGIC 1001
-#define ERR_BOARD_DPRAM 1002
-#define EPOF_INTERNAL 1003
-#define EPOF_BAD_IMG_SIZE 1004
-#define ERR_BOOTIMG_FAIL 1005
-#define ERR_BOOTSEQ_FAIL 1006
-#define ERR_POF_TIMEOUT 1007
-#define ERR_NOT_BOOTED 1008
-#define ERR_CONF_LONG 1009
-#define ERR_INV_CHAN 1010
-#define ERR_ASYNC_TIME 1011
+#ifndef _UAPI_LINUX_OPENAT2_H
+#define _UAPI_LINUX_OPENAT2_H
+#include <linux/types.h>
+struct open_how {
+  __u64 flags;
+  __u64 mode;
+  __u64 resolve;
+};
+#define RESOLVE_NO_XDEV 0x01
+#define RESOLVE_NO_MAGICLINKS 0x02
+#define RESOLVE_NO_SYMLINKS 0x04
+#define RESOLVE_BENEATH 0x08
+#define RESOLVE_IN_ROOT 0x10
+#endif
diff --git a/libc/kernel/uapi/linux/openvswitch.h b/libc/kernel/uapi/linux/openvswitch.h
index 99a987d..5dba4e6 100644
--- a/libc/kernel/uapi/linux/openvswitch.h
+++ b/libc/kernel/uapi/linux/openvswitch.h
@@ -366,6 +366,12 @@
   __be32 mpls_lse;
   __be16 mpls_ethertype;
 };
+struct ovs_action_add_mpls {
+  __be32 mpls_lse;
+  __be16 mpls_ethertype;
+  __u16 tun_flags;
+};
+#define OVS_MPLS_L3_TUNNEL_FLAG_MASK (1 << 0)
 struct ovs_action_push_vlan {
   __be16 vlan_tpid;
   __be16 vlan_tci;
@@ -439,6 +445,8 @@
   OVS_ACTION_ATTR_METER,
   OVS_ACTION_ATTR_CLONE,
   OVS_ACTION_ATTR_CHECK_PKT_LEN,
+  OVS_ACTION_ATTR_ADD_MPLS,
+  OVS_ACTION_ATTR_DEC_TTL,
   __OVS_ACTION_ATTR_MAX,
 };
 #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
@@ -502,4 +510,9 @@
   __u32 limit;
   __u32 count;
 };
+enum ovs_dec_ttl_attr {
+  OVS_DEC_TTL_ATTR_UNSPEC,
+  OVS_DEC_TTL_ATTR_ACTION,
+  __OVS_DEC_TTL_ATTR_MAX
+};
 #endif
diff --git a/libc/kernel/uapi/linux/pci_regs.h b/libc/kernel/uapi/linux/pci_regs.h
index 5501de0..f502b80 100644
--- a/libc/kernel/uapi/linux/pci_regs.h
+++ b/libc/kernel/uapi/linux/pci_regs.h
@@ -514,6 +514,7 @@
 #define PCI_EXP_SLTCTL_PWR_OFF 0x0400
 #define PCI_EXP_SLTCTL_EIC 0x0800
 #define PCI_EXP_SLTCTL_DLLSCE 0x1000
+#define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000
 #define PCI_EXP_SLTSTA 26
 #define PCI_EXP_SLTSTA_ABP 0x0001
 #define PCI_EXP_SLTSTA_PFD 0x0002
@@ -577,9 +578,11 @@
 #define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005
 #define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010
 #define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380
+#define PCI_EXP_LNKCTL2_HASD 0x0020
 #define PCI_EXP_LNKSTA2 50
 #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52
 #define PCI_EXP_SLTCAP2 52
+#define PCI_EXP_SLTCAP2_IBPD 0x00000001
 #define PCI_EXP_SLTCTL2 56
 #define PCI_EXP_SLTSTA2 58
 #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
diff --git a/libc/kernel/uapi/linux/pcitest.h b/libc/kernel/uapi/linux/pcitest.h
index c6112d0..98248bd 100644
--- a/libc/kernel/uapi/linux/pcitest.h
+++ b/libc/kernel/uapi/linux/pcitest.h
@@ -27,4 +27,10 @@
 #define PCITEST_MSIX _IOW('P', 0x7, int)
 #define PCITEST_SET_IRQTYPE _IOW('P', 0x8, int)
 #define PCITEST_GET_IRQTYPE _IO('P', 0x9)
+#define PCITEST_CLEAR_IRQ _IO('P', 0x10)
+#define PCITEST_FLAGS_USE_DMA 0x00000001
+struct pci_endpoint_test_xfer_param {
+  unsigned long size;
+  unsigned char flags;
+};
 #endif
diff --git a/libc/kernel/uapi/linux/perf_event.h b/libc/kernel/uapi/linux/perf_event.h
index 4e9e32c..b996adb 100644
--- a/libc/kernel/uapi/linux/perf_event.h
+++ b/libc/kernel/uapi/linux/perf_event.h
@@ -100,7 +100,8 @@
   PERF_SAMPLE_REGS_INTR = 1U << 18,
   PERF_SAMPLE_PHYS_ADDR = 1U << 19,
   PERF_SAMPLE_AUX = 1U << 20,
-  PERF_SAMPLE_MAX = 1U << 21,
+  PERF_SAMPLE_CGROUP = 1U << 21,
+  PERF_SAMPLE_MAX = 1U << 22,
   __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
 };
 enum perf_branch_sample_type_shift {
@@ -121,6 +122,7 @@
   PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14,
   PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15,
   PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16,
+  PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17,
   PERF_SAMPLE_BRANCH_MAX_SHIFT
 };
 enum perf_branch_sample_type {
@@ -141,6 +143,7 @@
   PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT,
   PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
   PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
+  PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
   PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
 };
 enum {
@@ -200,7 +203,7 @@
   };
   __u64 sample_type;
   __u64 read_format;
-  __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, aux_output : 1, __reserved_1 : 32;
+  __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, aux_output : 1, cgroup : 1, __reserved_1 : 31;
   union {
     __u32 wakeup_events;
     __u32 wakeup_watermark;
@@ -332,6 +335,7 @@
   PERF_RECORD_NAMESPACES = 16,
   PERF_RECORD_KSYMBOL = 17,
   PERF_RECORD_BPF_EVENT = 18,
+  PERF_RECORD_CGROUP = 19,
   PERF_RECORD_MAX,
 };
 enum perf_record_ksymbol_type {
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index dd096d9..d77d46e 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -30,9 +30,13 @@
   TCA_ACT_PAD,
   TCA_ACT_COOKIE,
   TCA_ACT_FLAGS,
+  TCA_ACT_HW_STATS,
+  TCA_ACT_USED_HW_STATS,
   __TCA_ACT_MAX
 };
 #define TCA_ACT_FLAGS_NO_PERCPU_STATS 1
+#define TCA_ACT_HW_STATS_IMMEDIATE (1 << 0)
+#define TCA_ACT_HW_STATS_DELAYED (1 << 1)
 #define TCA_ACT_MAX __TCA_ACT_MAX
 #define TCA_OLD_COMPAT (TCA_ACT_MAX + 1)
 #define TCA_ACT_MAX_PRIO 32
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index c965928..db7f5cb 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -167,6 +167,7 @@
   TCA_RED_PARMS,
   TCA_RED_STAB,
   TCA_RED_MAX_P,
+  TCA_RED_FLAGS,
   __TCA_RED_MAX,
 };
 #define TCA_RED_MAX (__TCA_RED_MAX - 1)
@@ -181,7 +182,9 @@
 #define TC_RED_ECN 1
 #define TC_RED_HARDDROP 2
 #define TC_RED_ADAPTATIVE 4
+#define TC_RED_NODROP 8
 };
+#define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
 struct tc_red_xstats {
   __u32 early;
   __u32 pdrop;
@@ -665,6 +668,7 @@
   TCA_FQ_ORPHAN_MASK,
   TCA_FQ_LOW_RATE_THRESHOLD,
   TCA_FQ_CE_THRESHOLD,
+  TCA_FQ_TIMER_SLACK,
   __TCA_FQ_MAX
 };
 #define TCA_FQ_MAX (__TCA_FQ_MAX - 1)
@@ -725,6 +729,34 @@
   __u32 maxq;
   __u32 ecn_mark;
 };
+enum {
+  TCA_FQ_PIE_UNSPEC,
+  TCA_FQ_PIE_LIMIT,
+  TCA_FQ_PIE_FLOWS,
+  TCA_FQ_PIE_TARGET,
+  TCA_FQ_PIE_TUPDATE,
+  TCA_FQ_PIE_ALPHA,
+  TCA_FQ_PIE_BETA,
+  TCA_FQ_PIE_QUANTUM,
+  TCA_FQ_PIE_MEMORY_LIMIT,
+  TCA_FQ_PIE_ECN_PROB,
+  TCA_FQ_PIE_ECN,
+  TCA_FQ_PIE_BYTEMODE,
+  TCA_FQ_PIE_DQ_RATE_ESTIMATOR,
+  __TCA_FQ_PIE_MAX
+};
+#define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1)
+struct tc_fq_pie_xstats {
+  __u32 packets_in;
+  __u32 dropped;
+  __u32 overlimit;
+  __u32 overmemory;
+  __u32 ecn_mark;
+  __u32 new_flow_count;
+  __u32 new_flows_len;
+  __u32 old_flows_len;
+  __u32 memory_usage;
+};
 struct tc_cbs_qopt {
   __u8 offload;
   __u8 _pad[3];
@@ -879,8 +911,8 @@
   __TCA_TAPRIO_SCHED_MAX,
 };
 #define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1)
-#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST BIT(0)
-#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD BIT(1)
+#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0)
+#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1)
 enum {
   TCA_TAPRIO_ATTR_UNSPEC,
   TCA_TAPRIO_ATTR_PRIOMAP,
@@ -897,4 +929,16 @@
   __TCA_TAPRIO_ATTR_MAX,
 };
 #define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
+#define TCQ_ETS_MAX_BANDS 16
+enum {
+  TCA_ETS_UNSPEC,
+  TCA_ETS_NBANDS,
+  TCA_ETS_NSTRICT,
+  TCA_ETS_QUANTA,
+  TCA_ETS_QUANTA_BAND,
+  TCA_ETS_PRIOMAP,
+  TCA_ETS_PRIOMAP_BAND,
+  __TCA_ETS_MAX,
+};
+#define TCA_ETS_MAX (__TCA_ETS_MAX - 1)
 #endif
diff --git a/libc/kernel/uapi/linux/prctl.h b/libc/kernel/uapi/linux/prctl.h
index 6e3426c..c8118da 100644
--- a/libc/kernel/uapi/linux/prctl.h
+++ b/libc/kernel/uapi/linux/prctl.h
@@ -153,6 +153,8 @@
 #define PR_SET_TAGGED_ADDR_CTRL 55
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#define PR_SET_IO_FLUSHER 57
+#define PR_GET_IO_FLUSHER 58
 #define PR_SET_VMA 0x53564d41
 #define PR_SET_VMA_ANON_NAME 0
 #endif
diff --git a/libc/kernel/uapi/linux/random.h b/libc/kernel/uapi/linux/random.h
index 3a5fbfd..2d3cfef 100644
--- a/libc/kernel/uapi/linux/random.h
+++ b/libc/kernel/uapi/linux/random.h
@@ -35,4 +35,5 @@
 };
 #define GRND_NONBLOCK 0x0001
 #define GRND_RANDOM 0x0002
+#define GRND_INSECURE 0x0004
 #endif
diff --git a/libc/kernel/uapi/linux/gigaset_dev.h b/libc/kernel/uapi/linux/rpl.h
similarity index 60%
copy from libc/kernel/uapi/linux/gigaset_dev.h
copy to libc/kernel/uapi/linux/rpl.h
index 5741d7d..4437731 100644
--- a/libc/kernel/uapi/linux/gigaset_dev.h
+++ b/libc/kernel/uapi/linux/rpl.h
@@ -16,15 +16,28 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef GIGASET_INTERFACE_H
-#define GIGASET_INTERFACE_H
-#include <linux/ioctl.h>
-#define GIGASET_IOCTL 0x47
-#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int)
-#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int)
-#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
-#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4])
-#define GIGVER_DRIVER 0
-#define GIGVER_COMPAT 1
-#define GIGVER_FWBASE 2
+#ifndef _UAPI_LINUX_RPL_H
+#define _UAPI_LINUX_RPL_H
+#include <asm/byteorder.h>
+#include <linux/types.h>
+#include <linux/in6.h>
+struct ipv6_rpl_sr_hdr {
+  __u8 nexthdr;
+  __u8 hdrlen;
+  __u8 type;
+  __u8 segments_left;
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  __u32 cmpre : 4, cmpri : 4, reserved : 4, pad : 4, reserved1 : 16;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+  __u32 reserved : 20, pad : 4, cmpri : 4, cmpre : 4;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+  union {
+    struct in6_addr addr[0];
+    __u8 data[0];
+  } segments;
+} __attribute__((packed));
+#define rpl_segaddr segments.addr
+#define rpl_segdata segments.data
 #endif
diff --git a/libc/kernel/uapi/linux/hysdn_if.h b/libc/kernel/uapi/linux/rpl_iptunnel.h
similarity index 72%
copy from libc/kernel/uapi/linux/hysdn_if.h
copy to libc/kernel/uapi/linux/rpl_iptunnel.h
index 2aac1d0..c61725d 100644
--- a/libc/kernel/uapi/linux/hysdn_if.h
+++ b/libc/kernel/uapi/linux/rpl_iptunnel.h
@@ -16,16 +16,13 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define ERR_NONE 0
-#define ERR_ALREADY_BOOT 1000
-#define EPOF_BAD_MAGIC 1001
-#define ERR_BOARD_DPRAM 1002
-#define EPOF_INTERNAL 1003
-#define EPOF_BAD_IMG_SIZE 1004
-#define ERR_BOOTIMG_FAIL 1005
-#define ERR_BOOTSEQ_FAIL 1006
-#define ERR_POF_TIMEOUT 1007
-#define ERR_NOT_BOOTED 1008
-#define ERR_CONF_LONG 1009
-#define ERR_INV_CHAN 1010
-#define ERR_ASYNC_TIME 1011
+#ifndef _UAPI_LINUX_RPL_IPTUNNEL_H
+#define _UAPI_LINUX_RPL_IPTUNNEL_H
+enum {
+  RPL_IPTUNNEL_UNSPEC,
+  RPL_IPTUNNEL_SRH,
+  __RPL_IPTUNNEL_MAX,
+};
+#define RPL_IPTUNNEL_MAX (__RPL_IPTUNNEL_MAX - 1)
+#define RPL_IPTUNNEL_SRH_SIZE(srh) (((srh)->hdrlen + 1) << 3)
+#endif
diff --git a/libc/kernel/uapi/linux/rtc.h b/libc/kernel/uapi/linux/rtc.h
index a047293..3312f69 100644
--- a/libc/kernel/uapi/linux/rtc.h
+++ b/libc/kernel/uapi/linux/rtc.h
@@ -18,6 +18,8 @@
  ****************************************************************************/
 #ifndef _UAPI_LINUX_RTC_H_
 #define _UAPI_LINUX_RTC_H_
+#include <linux/const.h>
+#include <linux/ioctl.h>
 struct rtc_time {
   int tm_sec;
   int tm_min;
@@ -63,7 +65,11 @@
 #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)
 #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info)
 #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info)
-#define RTC_VL_READ _IOR('p', 0x13, int)
+#define RTC_VL_DATA_INVALID _BITUL(0)
+#define RTC_VL_BACKUP_LOW _BITUL(1)
+#define RTC_VL_BACKUP_EMPTY _BITUL(2)
+#define RTC_VL_ACCURACY_LOW _BITUL(3)
+#define RTC_VL_READ _IOR('p', 0x13, unsigned int)
 #define RTC_VL_CLR _IO('p', 0x14)
 #define RTC_IRQF 0x80
 #define RTC_PF 0x40
diff --git a/libc/kernel/uapi/linux/rtnetlink.h b/libc/kernel/uapi/linux/rtnetlink.h
index 14366de..295fbed 100644
--- a/libc/kernel/uapi/linux/rtnetlink.h
+++ b/libc/kernel/uapi/linux/rtnetlink.h
@@ -151,6 +151,12 @@
 #define RTM_DELLINKPROP RTM_DELLINKPROP
   RTM_GETLINKPROP,
 #define RTM_GETLINKPROP RTM_GETLINKPROP
+  RTM_NEWVLAN = 112,
+#define RTM_NEWNVLAN RTM_NEWVLAN
+  RTM_DELVLAN,
+#define RTM_DELVLAN RTM_DELVLAN
+  RTM_GETVLAN,
+#define RTM_GETVLAN RTM_GETVLAN
   __RTM_MAX,
 #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
 };
@@ -230,6 +236,8 @@
 #define RTM_F_PREFIX 0x800
 #define RTM_F_LOOKUP_TABLE 0x1000
 #define RTM_F_FIB_MATCH 0x2000
+#define RTM_F_OFFLOAD 0x4000
+#define RTM_F_TRAP 0x8000
 enum rt_class_t {
   RT_TABLE_UNSPEC = 0,
   RT_TABLE_COMPAT = 252,
@@ -537,6 +545,8 @@
 #define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R
   RTNLGRP_NEXTHOP,
 #define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP
+  RTNLGRP_BRVLAN,
+#define RTNLGRP_BRVLAN RTNLGRP_BRVLAN
   __RTNLGRP_MAX
 };
 #define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/sched.h b/libc/kernel/uapi/linux/sched.h
index b8f39dd..f9c00df 100644
--- a/libc/kernel/uapi/linux/sched.h
+++ b/libc/kernel/uapi/linux/sched.h
@@ -45,6 +45,8 @@
 #define CLONE_NEWNET 0x40000000
 #define CLONE_IO 0x80000000
 #define CLONE_CLEAR_SIGHAND 0x100000000ULL
+#define CLONE_INTO_CGROUP 0x200000000ULL
+#define CLONE_NEWTIME 0x00000080
 #ifndef __ASSEMBLY__
 struct clone_args {
   __aligned_u64 flags;
@@ -57,10 +59,12 @@
   __aligned_u64 tls;
   __aligned_u64 set_tid;
   __aligned_u64 set_tid_size;
+  __aligned_u64 cgroup;
 };
 #endif
 #define CLONE_ARGS_SIZE_VER0 64
 #define CLONE_ARGS_SIZE_VER1 80
+#define CLONE_ARGS_SIZE_VER2 88
 #define SCHED_NORMAL 0
 #define SCHED_FIFO 1
 #define SCHED_RR 2
diff --git a/libc/kernel/uapi/linux/seccomp.h b/libc/kernel/uapi/linux/seccomp.h
index 6f7cbbe..d535f50 100644
--- a/libc/kernel/uapi/linux/seccomp.h
+++ b/libc/kernel/uapi/linux/seccomp.h
@@ -31,6 +31,7 @@
 #define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
 #define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
 #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
+#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
 #define SECCOMP_RET_KILL_PROCESS 0x80000000U
 #define SECCOMP_RET_KILL_THREAD 0x00000000U
 #define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
diff --git a/libc/kernel/uapi/linux/serio.h b/libc/kernel/uapi/linux/serio.h
index 5ef9de4..605a4e4 100644
--- a/libc/kernel/uapi/linux/serio.h
+++ b/libc/kernel/uapi/linux/serio.h
@@ -18,12 +18,13 @@
  ****************************************************************************/
 #ifndef _UAPI_SERIO_H
 #define _UAPI_SERIO_H
+#include <linux/const.h>
 #include <linux/ioctl.h>
 #define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
-#define SERIO_TIMEOUT BIT(0)
-#define SERIO_PARITY BIT(1)
-#define SERIO_FRAME BIT(2)
-#define SERIO_OOB_DATA BIT(3)
+#define SERIO_TIMEOUT _BITUL(0)
+#define SERIO_PARITY _BITUL(1)
+#define SERIO_FRAME _BITUL(2)
+#define SERIO_OOB_DATA _BITUL(3)
 #define SERIO_XT 0x00
 #define SERIO_8042 0x01
 #define SERIO_RS232 0x02
diff --git a/libc/kernel/uapi/linux/snmp.h b/libc/kernel/uapi/linux/snmp.h
index 3ec299a..c114544 100644
--- a/libc/kernel/uapi/linux/snmp.h
+++ b/libc/kernel/uapi/linux/snmp.h
@@ -252,6 +252,8 @@
   LINUX_MIB_TCPRCVQDROP,
   LINUX_MIB_TCPWQUEUETOOBIG,
   LINUX_MIB_TCPFASTOPENPASSIVEALTKEY,
+  LINUX_MIB_TCPTIMEOUTREHASH,
+  LINUX_MIB_TCPDUPLICATEDATAREHASH,
   __LINUX_MIB_MAX
 };
 enum {
diff --git a/libc/kernel/uapi/linux/sock_diag.h b/libc/kernel/uapi/linux/sock_diag.h
index 0182597..a4e40d9 100644
--- a/libc/kernel/uapi/linux/sock_diag.h
+++ b/libc/kernel/uapi/linux/sock_diag.h
@@ -46,4 +46,24 @@
   __SKNLGRP_MAX,
 };
 #define SKNLGRP_MAX (__SKNLGRP_MAX - 1)
+enum {
+  SK_DIAG_BPF_STORAGE_REQ_NONE,
+  SK_DIAG_BPF_STORAGE_REQ_MAP_FD,
+  __SK_DIAG_BPF_STORAGE_REQ_MAX,
+};
+#define SK_DIAG_BPF_STORAGE_REQ_MAX (__SK_DIAG_BPF_STORAGE_REQ_MAX - 1)
+enum {
+  SK_DIAG_BPF_STORAGE_REP_NONE,
+  SK_DIAG_BPF_STORAGE,
+  __SK_DIAG_BPF_STORAGE_REP_MAX,
+};
+#define SK_DIAB_BPF_STORAGE_REP_MAX (__SK_DIAG_BPF_STORAGE_REP_MAX - 1)
+enum {
+  SK_DIAG_BPF_STORAGE_NONE,
+  SK_DIAG_BPF_STORAGE_PAD,
+  SK_DIAG_BPF_STORAGE_MAP_ID,
+  SK_DIAG_BPF_STORAGE_MAP_VALUE,
+  __SK_DIAG_BPF_STORAGE_MAX,
+};
+#define SK_DIAG_BPF_STORAGE_MAX (__SK_DIAG_BPF_STORAGE_MAX - 1)
 #endif
diff --git a/libc/kernel/uapi/linux/swab.h b/libc/kernel/uapi/linux/swab.h
index da949db..e96085e 100644
--- a/libc/kernel/uapi/linux/swab.h
+++ b/libc/kernel/uapi/linux/swab.h
@@ -20,6 +20,7 @@
 #define _UAPI_LINUX_SWAB_H
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <asm/bitsperlong.h>
 #include <asm/swab.h>
 #define ___constant_swab16(x) ((__u16) ((((__u16) (x) & (__u16) 0x00ffU) << 8) | (((__u16) (x) & (__u16) 0xff00U) >> 8)))
 #define ___constant_swab32(x) ((__u32) ((((__u32) (x) & (__u32) 0x000000ffUL) << 24) | (((__u32) (x) & (__u32) 0x0000ff00UL) << 8) | (((__u32) (x) & (__u32) 0x00ff0000UL) >> 8) | (((__u32) (x) & (__u32) 0xff000000UL) >> 24)))
@@ -53,6 +54,9 @@
 #define __swab16(x) (__u16) __builtin_bswap16((__u16) (x))
 #define __swab32(x) (__u32) __builtin_bswap32((__u32) (x))
 #define __swab64(x) (__u64) __builtin_bswap64((__u64) (x))
+#if __BITS_PER_LONG == 64
+#else
+#endif
 #define __swahw32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahw32(x) : __fswahw32(x))
 #define __swahb32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahb32(x) : __fswahb32(x))
 static __always_inline __u16 __swab16p(const __u16 * p) {
diff --git a/libc/kernel/uapi/linux/switchtec_ioctl.h b/libc/kernel/uapi/linux/switchtec_ioctl.h
index 2143148..204839d 100644
--- a/libc/kernel/uapi/linux/switchtec_ioctl.h
+++ b/libc/kernel/uapi/linux/switchtec_ioctl.h
@@ -32,7 +32,15 @@
 #define SWITCHTEC_IOCTL_PART_VENDOR5 10
 #define SWITCHTEC_IOCTL_PART_VENDOR6 11
 #define SWITCHTEC_IOCTL_PART_VENDOR7 12
-#define SWITCHTEC_IOCTL_NUM_PARTITIONS 13
+#define SWITCHTEC_IOCTL_PART_BL2_0 13
+#define SWITCHTEC_IOCTL_PART_BL2_1 14
+#define SWITCHTEC_IOCTL_PART_MAP_0 15
+#define SWITCHTEC_IOCTL_PART_MAP_1 16
+#define SWITCHTEC_IOCTL_PART_KEY_0 17
+#define SWITCHTEC_IOCTL_PART_KEY_1 18
+#define SWITCHTEC_NUM_PARTITIONS_GEN3 13
+#define SWITCHTEC_NUM_PARTITIONS_GEN4 19
+#define SWITCHTEC_IOCTL_NUM_PARTITIONS SWITCHTEC_NUM_PARTITIONS_GEN3
 struct switchtec_ioctl_flash_info {
   __u64 flash_length;
   __u32 num_partitions;
@@ -92,7 +100,9 @@
 #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27
 #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28
 #define SWITCHTEC_IOCTL_EVENT_GFMS 29
-#define SWITCHTEC_IOCTL_MAX_EVENTS 30
+#define SWITCHTEC_IOCTL_EVENT_INTERCOMM_REQ_NOTIFY 30
+#define SWITCHTEC_IOCTL_EVENT_UEC 31
+#define SWITCHTEC_IOCTL_MAX_EVENTS 32
 #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX - 1
 #define SWITCHTEC_IOCTL_EVENT_IDX_ALL - 2
 #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0)
diff --git a/libc/kernel/uapi/linux/taskstats.h b/libc/kernel/uapi/linux/taskstats.h
index dc7791d..5f9d0cc 100644
--- a/libc/kernel/uapi/linux/taskstats.h
+++ b/libc/kernel/uapi/linux/taskstats.h
@@ -19,7 +19,7 @@
 #ifndef _LINUX_TASKSTATS_H
 #define _LINUX_TASKSTATS_H
 #include <linux/types.h>
-#define TASKSTATS_VERSION 9
+#define TASKSTATS_VERSION 10
 #define TS_COMM_LEN 32
 struct taskstats {
   __u16 version;
@@ -68,6 +68,7 @@
   __u64 freepages_delay_total;
   __u64 thrashing_count;
   __u64 thrashing_delay_total;
+  __u64 ac_btime64;
 };
 enum {
   TASKSTATS_CMD_UNSPEC = 0,
diff --git a/libc/kernel/uapi/linux/tcp.h b/libc/kernel/uapi/linux/tcp.h
index 823583d..e38e462 100644
--- a/libc/kernel/uapi/linux/tcp.h
+++ b/libc/kernel/uapi/linux/tcp.h
@@ -217,15 +217,18 @@
   TCP_NLA_DSACK_DUPS,
   TCP_NLA_REORD_SEEN,
   TCP_NLA_SRTT,
+  TCP_NLA_TIMEOUT_REHASH,
+  TCP_NLA_BYTES_NOTSENT,
 };
 #define TCP_MD5SIG_MAXKEYLEN 80
-#define TCP_MD5SIG_FLAG_PREFIX 1
+#define TCP_MD5SIG_FLAG_PREFIX 0x1
+#define TCP_MD5SIG_FLAG_IFINDEX 0x2
 struct tcp_md5sig {
   struct sockaddr_storage tcpm_addr;
   __u8 tcpm_flags;
   __u8 tcpm_prefixlen;
   __u16 tcpm_keylen;
-  __u32 __tcpm_pad;
+  int tcpm_ifindex;
   __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
 };
 struct tcp_diag_md5sig {
@@ -239,5 +242,7 @@
   __u64 address;
   __u32 length;
   __u32 recv_skip_hint;
+  __u32 inq;
+  __s32 err;
 };
 #endif
diff --git a/libc/kernel/uapi/linux/tee.h b/libc/kernel/uapi/linux/tee.h
index e13c231..9ddcf19 100644
--- a/libc/kernel/uapi/linux/tee.h
+++ b/libc/kernel/uapi/linux/tee.h
@@ -29,6 +29,7 @@
 #define TEE_GEN_CAP_PRIVILEGED (1 << 1)
 #define TEE_GEN_CAP_REG_MEM (1 << 2)
 #define TEE_IMPL_ID_OPTEE 1
+#define TEE_IMPL_ID_AMDTEE 2
 #define TEE_OPTEE_CAP_TZ (1 << 0)
 struct tee_ioctl_version_data {
   __u32 impl_id;
diff --git a/libc/kernel/uapi/linux/time.h b/libc/kernel/uapi/linux/time.h
index eed430b..df52295 100644
--- a/libc/kernel/uapi/linux/time.h
+++ b/libc/kernel/uapi/linux/time.h
@@ -31,13 +31,6 @@
   __kernel_old_time_t tv_sec;
   __kernel_suseconds_t tv_usec;
 };
-struct timezone {
-  int tz_minuteswest;
-  int tz_dsttime;
-};
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
-#define ITIMER_PROF 2
 struct itimerspec {
   struct timespec it_interval;
   struct timespec it_value;
@@ -46,6 +39,13 @@
   struct timeval it_interval;
   struct timeval it_value;
 };
+struct timezone {
+  int tz_minuteswest;
+  int tz_dsttime;
+};
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
 #define CLOCK_REALTIME 0
 #define CLOCK_MONOTONIC 1
 #define CLOCK_PROCESS_CPUTIME_ID 2
diff --git a/libc/kernel/uapi/linux/tipc_netlink.h b/libc/kernel/uapi/linux/tipc_netlink.h
index 61577fa..10fdf5e 100644
--- a/libc/kernel/uapi/linux/tipc_netlink.h
+++ b/libc/kernel/uapi/linux/tipc_netlink.h
@@ -46,6 +46,7 @@
   TIPC_NL_UDP_GET_REMOTEIP,
   TIPC_NL_KEY_SET,
   TIPC_NL_KEY_FLUSH,
+  TIPC_NL_ADDR_LEGACY_GET,
   __TIPC_NL_CMD_MAX,
   TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
 };
@@ -135,6 +136,7 @@
   TIPC_NLA_NET_ADDR,
   TIPC_NLA_NET_NODEID,
   TIPC_NLA_NET_NODEID_W1,
+  TIPC_NLA_NET_ADDR_LEGACY,
   __TIPC_NLA_NET_MAX,
   TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1
 };
diff --git a/libc/kernel/uapi/linux/udp.h b/libc/kernel/uapi/linux/udp.h
index 278cf6c..802c686 100644
--- a/libc/kernel/uapi/linux/udp.h
+++ b/libc/kernel/uapi/linux/udp.h
@@ -37,4 +37,5 @@
 #define UDP_ENCAP_GTP0 4
 #define UDP_ENCAP_GTP1U 5
 #define UDP_ENCAP_RXRPC 6
+#define TCP_ENCAP_ESPINTCP 7
 #endif
diff --git a/libc/kernel/uapi/linux/gigaset_dev.h b/libc/kernel/uapi/linux/um_timetravel.h
similarity index 68%
copy from libc/kernel/uapi/linux/gigaset_dev.h
copy to libc/kernel/uapi/linux/um_timetravel.h
index 5741d7d..220324f 100644
--- a/libc/kernel/uapi/linux/gigaset_dev.h
+++ b/libc/kernel/uapi/linux/um_timetravel.h
@@ -16,15 +16,23 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef GIGASET_INTERFACE_H
-#define GIGASET_INTERFACE_H
-#include <linux/ioctl.h>
-#define GIGASET_IOCTL 0x47
-#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int)
-#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int)
-#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
-#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4])
-#define GIGVER_DRIVER 0
-#define GIGVER_COMPAT 1
-#define GIGVER_FWBASE 2
+#ifndef _UAPI_LINUX_UM_TIMETRAVEL_H
+#define _UAPI_LINUX_UM_TIMETRAVEL_H
+#include <linux/types.h>
+struct um_timetravel_msg {
+  __u32 op;
+  __u32 seq;
+  __u64 time;
+};
+enum um_timetravel_ops {
+  UM_TIMETRAVEL_ACK = 0,
+  UM_TIMETRAVEL_START = 1,
+  UM_TIMETRAVEL_REQUEST = 2,
+  UM_TIMETRAVEL_WAIT = 3,
+  UM_TIMETRAVEL_GET = 4,
+  UM_TIMETRAVEL_UPDATE = 5,
+  UM_TIMETRAVEL_RUN = 6,
+  UM_TIMETRAVEL_FREE_UNTIL = 7,
+  UM_TIMETRAVEL_GET_TOD = 8,
+};
 #endif
diff --git a/libc/kernel/uapi/linux/usb/charger.h b/libc/kernel/uapi/linux/usb/charger.h
index 0810aab..e53f7d6 100644
--- a/libc/kernel/uapi/linux/usb/charger.h
+++ b/libc/kernel/uapi/linux/usb/charger.h
@@ -19,15 +19,15 @@
 #ifndef _UAPI__LINUX_USB_CHARGER_H
 #define _UAPI__LINUX_USB_CHARGER_H
 enum usb_charger_type {
-  UNKNOWN_TYPE,
-  SDP_TYPE,
-  DCP_TYPE,
-  CDP_TYPE,
-  ACA_TYPE,
+  UNKNOWN_TYPE = 0,
+  SDP_TYPE = 1,
+  DCP_TYPE = 2,
+  CDP_TYPE = 3,
+  ACA_TYPE = 4,
 };
 enum usb_charger_state {
-  USB_CHARGER_DEFAULT,
-  USB_CHARGER_PRESENT,
-  USB_CHARGER_ABSENT,
+  USB_CHARGER_DEFAULT = 0,
+  USB_CHARGER_PRESENT = 1,
+  USB_CHARGER_ABSENT = 2,
 };
 #endif
diff --git a/libc/kernel/uapi/linux/usb/raw_gadget.h b/libc/kernel/uapi/linux/usb/raw_gadget.h
new file mode 100644
index 0000000..70d5a26
--- /dev/null
+++ b/libc/kernel/uapi/linux/usb/raw_gadget.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI__LINUX_USB_RAW_GADGET_H
+#define _UAPI__LINUX_USB_RAW_GADGET_H
+#include <asm/ioctl.h>
+#include <linux/types.h>
+#include <linux/usb/ch9.h>
+#define UDC_NAME_LENGTH_MAX 128
+struct usb_raw_init {
+  __u8 driver_name[UDC_NAME_LENGTH_MAX];
+  __u8 device_name[UDC_NAME_LENGTH_MAX];
+  __u8 speed;
+};
+enum usb_raw_event_type {
+  USB_RAW_EVENT_INVALID = 0,
+  USB_RAW_EVENT_CONNECT = 1,
+  USB_RAW_EVENT_CONTROL = 2,
+};
+struct usb_raw_event {
+  __u32 type;
+  __u32 length;
+  __u8 data[0];
+};
+#define USB_RAW_IO_FLAGS_ZERO 0x0001
+#define USB_RAW_IO_FLAGS_MASK 0x0001
+struct usb_raw_ep_io {
+  __u16 ep;
+  __u16 flags;
+  __u32 length;
+  __u8 data[0];
+};
+#define USB_RAW_EPS_NUM_MAX 30
+#define USB_RAW_EP_NAME_MAX 16
+#define USB_RAW_EP_ADDR_ANY 0xff
+struct usb_raw_ep_caps {
+  __u32 type_control : 1;
+  __u32 type_iso : 1;
+  __u32 type_bulk : 1;
+  __u32 type_int : 1;
+  __u32 dir_in : 1;
+  __u32 dir_out : 1;
+};
+struct usb_raw_ep_limits {
+  __u16 maxpacket_limit;
+  __u16 max_streams;
+  __u32 reserved;
+};
+struct usb_raw_ep_info {
+  __u8 name[USB_RAW_EP_NAME_MAX];
+  __u32 addr;
+  struct usb_raw_ep_caps caps;
+  struct usb_raw_ep_limits limits;
+};
+struct usb_raw_eps_info {
+  struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
+};
+#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
+#define USB_RAW_IOCTL_RUN _IO('U', 1)
+#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
+#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
+#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
+#define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
+#define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
+#define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
+#define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
+#define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
+#define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
+#define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
+#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
+#define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
+#define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
+#define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
+#endif
diff --git a/libc/kernel/uapi/linux/userfaultfd.h b/libc/kernel/uapi/linux/userfaultfd.h
index ecc6302..e6b776a 100644
--- a/libc/kernel/uapi/linux/userfaultfd.h
+++ b/libc/kernel/uapi/linux/userfaultfd.h
@@ -20,15 +20,16 @@
 #define _LINUX_USERFAULTFD_H
 #include <linux/types.h>
 #define UFFD_API ((__u64) 0xAA)
-#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID)
+#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID)
 #define UFFD_API_IOCTLS ((__u64) 1 << _UFFDIO_REGISTER | (__u64) 1 << _UFFDIO_UNREGISTER | (__u64) 1 << _UFFDIO_API)
-#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE)
+#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE | (__u64) 1 << _UFFDIO_WRITEPROTECT)
 #define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY)
 #define _UFFDIO_REGISTER (0x00)
 #define _UFFDIO_UNREGISTER (0x01)
 #define _UFFDIO_WAKE (0x02)
 #define _UFFDIO_COPY (0x03)
 #define _UFFDIO_ZEROPAGE (0x04)
+#define _UFFDIO_WRITEPROTECT (0x06)
 #define _UFFDIO_API (0x3F)
 #define UFFDIO 0xAA
 #define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, struct uffdio_api)
@@ -37,6 +38,7 @@
 #define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, struct uffdio_range)
 #define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, struct uffdio_copy)
 #define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, struct uffdio_zeropage)
+#define UFFDIO_WRITEPROTECT _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, struct uffdio_writeprotect)
 struct uffd_msg {
   __u8 event;
   __u8 reserved1;
@@ -106,6 +108,7 @@
   __u64 src;
   __u64 len;
 #define UFFDIO_COPY_MODE_DONTWAKE ((__u64) 1 << 0)
+#define UFFDIO_COPY_MODE_WP ((__u64) 1 << 1)
   __u64 mode;
   __s64 copy;
 };
@@ -115,4 +118,10 @@
   __u64 mode;
   __s64 zeropage;
 };
+struct uffdio_writeprotect {
+  struct uffdio_range range;
+#define UFFDIO_WRITEPROTECT_MODE_WP ((__u64) 1 << 0)
+#define UFFDIO_WRITEPROTECT_MODE_DONTWAKE ((__u64) 1 << 1)
+  __u64 mode;
+};
 #endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 85f3a8b..e38620d 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -110,6 +110,7 @@
 #define V4L2_CID_USER_TC358743_BASE (V4L2_CID_USER_BASE + 0x1080)
 #define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090)
 #define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x10b0)
+#define V4L2_CID_USER_ATMEL_ISC_BASE (V4L2_CID_USER_BASE + 0x10c0)
 #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
 #define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
 #define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE + 0)
@@ -366,6 +367,10 @@
   V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
   V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
   V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
+  V4L2_MPEG_VIDEO_H264_LEVEL_5_2 = 16,
+  V4L2_MPEG_VIDEO_H264_LEVEL_6_0 = 17,
+  V4L2_MPEG_VIDEO_H264_LEVEL_6_1 = 18,
+  V4L2_MPEG_VIDEO_H264_LEVEL_6_2 = 19,
 };
 #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE + 360)
 #define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE + 361)
@@ -394,6 +399,7 @@
   V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
   V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
   V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
+  V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH = 17,
 };
 #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE + 364)
 #define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE + 365)
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index 471dcd7..5da4041 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,5 +16,5 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define LINUX_VERSION_CODE 328960
+#define LINUX_VERSION_CODE 329472
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/libc/kernel/uapi/linux/vfio.h b/libc/kernel/uapi/linux/vfio.h
index b9e7243..88f8168 100644
--- a/libc/kernel/uapi/linux/vfio.h
+++ b/libc/kernel/uapi/linux/vfio.h
@@ -244,6 +244,17 @@
   __s32 fd;
 };
 #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16)
+struct vfio_device_feature {
+  __u32 argsz;
+  __u32 flags;
+#define VFIO_DEVICE_FEATURE_MASK (0xffff)
+#define VFIO_DEVICE_FEATURE_GET (1 << 16)
+#define VFIO_DEVICE_FEATURE_SET (1 << 17)
+#define VFIO_DEVICE_FEATURE_PROBE (1 << 18)
+  __u8 data[];
+};
+#define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17)
+#define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0)
 struct vfio_iommu_type1_info {
   __u32 argsz;
   __u32 flags;
diff --git a/libc/kernel/uapi/linux/vhost.h b/libc/kernel/uapi/linux/vhost.h
index 9e87e6e..4546023 100644
--- a/libc/kernel/uapi/linux/vhost.h
+++ b/libc/kernel/uapi/linux/vhost.h
@@ -53,4 +53,11 @@
 #define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
 #define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64)
 #define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int)
+#define VHOST_VDPA_GET_DEVICE_ID _IOR(VHOST_VIRTIO, 0x70, __u32)
+#define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8)
+#define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8)
+#define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, struct vhost_vdpa_config)
+#define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, struct vhost_vdpa_config)
+#define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, struct vhost_vring_state)
+#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
 #endif
diff --git a/libc/kernel/uapi/linux/vhost_types.h b/libc/kernel/uapi/linux/vhost_types.h
index 646fcdc..1288cf6 100644
--- a/libc/kernel/uapi/linux/vhost_types.h
+++ b/libc/kernel/uapi/linux/vhost_types.h
@@ -89,6 +89,11 @@
   unsigned short vhost_tpgt;
   unsigned short reserved;
 };
+struct vhost_vdpa_config {
+  __u32 off;
+  __u32 len;
+  __u8 buf[0];
+};
 #define VHOST_F_LOG_ALL 26
 #define VHOST_NET_F_VIRTIO_NET_HDR 27
 #endif
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index aaf5a70..1209fb7 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -248,6 +248,7 @@
 #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ')
 #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ')
 #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ')
+#define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ')
 #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ')
 #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ')
 #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B')
@@ -323,6 +324,10 @@
 #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
 #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
 #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
+#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4')
+#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4')
+#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('G', 'R', '1', '4')
+#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4')
 #define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E')
 #define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E')
 #define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E')
diff --git a/libc/kernel/uapi/linux/virtio_balloon.h b/libc/kernel/uapi/linux/virtio_balloon.h
index 806e757..80affd8 100644
--- a/libc/kernel/uapi/linux/virtio_balloon.h
+++ b/libc/kernel/uapi/linux/virtio_balloon.h
@@ -27,13 +27,17 @@
 #define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2
 #define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3
 #define VIRTIO_BALLOON_F_PAGE_POISON 4
+#define VIRTIO_BALLOON_F_REPORTING 5
 #define VIRTIO_BALLOON_PFN_SHIFT 12
 #define VIRTIO_BALLOON_CMD_ID_STOP 0
 #define VIRTIO_BALLOON_CMD_ID_DONE 1
 struct virtio_balloon_config {
   __u32 num_pages;
   __u32 actual;
-  __u32 free_page_report_cmd_id;
+  union {
+    __u32 free_page_hint_cmd_id;
+    __u32 free_page_report_cmd_id;
+  };
   __u32 poison_val;
 };
 #define VIRTIO_BALLOON_S_SWAP_IN 0
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index 8e6712a..9fd6b65 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -35,4 +35,5 @@
 #define VIRTIO_ID_IOMMU 23
 #define VIRTIO_ID_FS 26
 #define VIRTIO_ID_PMEM 27
+#define VIRTIO_ID_MAC80211_HWSIM 29
 #endif
diff --git a/libc/kernel/uapi/linux/virtio_iommu.h b/libc/kernel/uapi/linux/virtio_iommu.h
index b08de57..b156ea3 100644
--- a/libc/kernel/uapi/linux/virtio_iommu.h
+++ b/libc/kernel/uapi/linux/virtio_iommu.h
@@ -26,18 +26,18 @@
 #define VIRTIO_IOMMU_F_PROBE 4
 #define VIRTIO_IOMMU_F_MMIO 5
 struct virtio_iommu_range_64 {
-  __le64 start;
-  __le64 end;
+  __u64 start;
+  __u64 end;
 };
 struct virtio_iommu_range_32 {
-  __le32 start;
-  __le32 end;
+  __u32 start;
+  __u32 end;
 };
 struct virtio_iommu_config {
-  __le64 page_size_mask;
+  __u64 page_size_mask;
   struct virtio_iommu_range_64 input_range;
   struct virtio_iommu_range_32 domain_range;
-  __le32 probe_size;
+  __u32 probe_size;
 };
 #define VIRTIO_IOMMU_T_ATTACH 0x01
 #define VIRTIO_IOMMU_T_DETACH 0x02
diff --git a/libc/kernel/uapi/linux/virtio_net.h b/libc/kernel/uapi/linux/virtio_net.h
index 07afd06..cd53e16 100644
--- a/libc/kernel/uapi/linux/virtio_net.h
+++ b/libc/kernel/uapi/linux/virtio_net.h
@@ -45,6 +45,9 @@
 #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
 #define VIRTIO_NET_F_MQ 22
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23
+#define VIRTIO_NET_F_HASH_REPORT 57
+#define VIRTIO_NET_F_RSS 60
+#define VIRTIO_NET_F_RSC_EXT 61
 #define VIRTIO_NET_F_STANDBY 62
 #define VIRTIO_NET_F_SPEED_DUPLEX 63
 #ifndef VIRTIO_NET_NO_LEGACY
@@ -52,6 +55,15 @@
 #endif
 #define VIRTIO_NET_S_LINK_UP 1
 #define VIRTIO_NET_S_ANNOUNCE 2
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2)
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5)
+#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8)
 struct virtio_net_config {
   __u8 mac[ETH_ALEN];
   __u16 status;
@@ -59,10 +71,14 @@
   __u16 mtu;
   __u32 speed;
   __u8 duplex;
+  __u8 rss_max_key_size;
+  __le16 rss_max_indirection_table_length;
+  __le32 supported_hash_types;
 } __attribute__((packed));
 struct virtio_net_hdr_v1 {
 #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
 #define VIRTIO_NET_HDR_F_DATA_VALID 2
+#define VIRTIO_NET_HDR_F_RSC_INFO 4
   __u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE 0
 #define VIRTIO_NET_HDR_GSO_TCPV4 1
@@ -72,10 +88,38 @@
   __u8 gso_type;
   __virtio16 hdr_len;
   __virtio16 gso_size;
-  __virtio16 csum_start;
-  __virtio16 csum_offset;
+  union {
+    struct {
+      __virtio16 csum_start;
+      __virtio16 csum_offset;
+    };
+    struct {
+      __virtio16 start;
+      __virtio16 offset;
+    } csum;
+    struct {
+      __le16 segments;
+      __le16 dup_acks;
+    } rsc;
+  };
   __virtio16 num_buffers;
 };
+struct virtio_net_hdr_v1_hash {
+  struct virtio_net_hdr_v1 hdr;
+  __le32 hash_value;
+#define VIRTIO_NET_HASH_REPORT_NONE 0
+#define VIRTIO_NET_HASH_REPORT_IPv4 1
+#define VIRTIO_NET_HASH_REPORT_TCPv4 2
+#define VIRTIO_NET_HASH_REPORT_UDPv4 3
+#define VIRTIO_NET_HASH_REPORT_IPv6 4
+#define VIRTIO_NET_HASH_REPORT_TCPv6 5
+#define VIRTIO_NET_HASH_REPORT_UDPv6 6
+#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7
+#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8
+#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9
+  __le16 hash_report;
+  __le16 padding;
+};
 #ifndef VIRTIO_NET_NO_LEGACY
 struct virtio_net_hdr {
   __u8 flags;
@@ -116,13 +160,30 @@
 #define VIRTIO_NET_CTRL_VLAN_DEL 1
 #define VIRTIO_NET_CTRL_ANNOUNCE 3
 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
+#define VIRTIO_NET_CTRL_MQ 4
 struct virtio_net_ctrl_mq {
   __virtio16 virtqueue_pairs;
 };
-#define VIRTIO_NET_CTRL_MQ 4
 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
+struct virtio_net_rss_config {
+  __le32 hash_types;
+  __le16 indirection_table_mask;
+  __le16 unclassified_queue;
+  __le16 indirection_table[1];
+  __le16 max_tx_vq;
+  __u8 hash_key_length;
+  __u8 hash_key_data[];
+};
+#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1
+struct virtio_net_hash_config {
+  __le32 hash_types;
+  __le16 reserved[4];
+  __u8 hash_key_length;
+  __u8 hash_key_data[];
+};
+#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
 #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
 #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
 #endif
diff --git a/libc/kernel/uapi/linux/vm_sockets.h b/libc/kernel/uapi/linux/vm_sockets.h
index 87e4ba0..3dc4bcf 100644
--- a/libc/kernel/uapi/linux/vm_sockets.h
+++ b/libc/kernel/uapi/linux/vm_sockets.h
@@ -29,7 +29,7 @@
 #define VMADDR_CID_ANY - 1U
 #define VMADDR_PORT_ANY - 1U
 #define VMADDR_CID_HYPERVISOR 0
-#define VMADDR_CID_RESERVED 1
+#define VMADDR_CID_LOCAL 1
 #define VMADDR_CID_HOST 2
 #define VM_SOCKETS_INVALID_VERSION - 1U
 #define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24)
diff --git a/libc/kernel/uapi/linux/vsoc_shm.h b/libc/kernel/uapi/linux/vsoc_shm.h
deleted file mode 100644
index 467b89b..0000000
--- a/libc/kernel/uapi/linux/vsoc_shm.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ***   To edit the content of this header, modify the corresponding
- ***   source file (e.g. under external/kernel-headers/original/) then
- ***   run bionic/libc/kernel/tools/update_all.py
- ***
- ***   Any manual change here will be lost the next time this script will
- ***   be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_VSOC_SHM_H
-#define _UAPI_LINUX_VSOC_SHM_H
-#include <linux/types.h>
-struct fd_scoped_permission {
-  __u32 begin_offset;
-  __u32 end_offset;
-  __u32 owner_offset;
-  __u32 owned_value;
-};
-#define VSOC_REGION_FREE ((__u32) 0)
-struct fd_scoped_permission_arg {
-  struct fd_scoped_permission perm;
-  __s32 managed_region_fd;
-};
-#define VSOC_NODE_FREE ((__u32) 0)
-struct vsoc_signal_table_layout {
-  __u32 num_nodes_lg2;
-  __u32 futex_uaddr_table_offset;
-  __u32 interrupt_signalled_offset;
-};
-#define VSOC_REGION_WHOLE ((__s32) 0)
-#define VSOC_DEVICE_NAME_SZ 16
-struct vsoc_device_region {
-  __u16 current_version;
-  __u16 min_compatible_version;
-  __u32 region_begin_offset;
-  __u32 region_end_offset;
-  __u32 offset_of_region_data;
-  struct vsoc_signal_table_layout guest_to_host_signal_table;
-  struct vsoc_signal_table_layout host_to_guest_signal_table;
-  char device_name[VSOC_DEVICE_NAME_SZ];
-  __u32 managed_by;
-};
-struct vsoc_shm_layout_descriptor {
-  __u16 major_version;
-  __u16 minor_version;
-  __u32 size;
-  __u32 region_count;
-  __u32 vsoc_region_desc_offset;
-};
-#define CURRENT_VSOC_LAYOUT_MAJOR_VERSION 2
-#define CURRENT_VSOC_LAYOUT_MINOR_VERSION 0
-#define VSOC_CREATE_FD_SCOPED_PERMISSION _IOW(0xF5, 0, struct fd_scoped_permission)
-#define VSOC_GET_FD_SCOPED_PERMISSION _IOR(0xF5, 1, struct fd_scoped_permission)
-#define VSOC_MAYBE_SEND_INTERRUPT_TO_HOST _IO(0xF5, 2)
-#define VSOC_WAIT_FOR_INCOMING_INTERRUPT _IO(0xF5, 3)
-#define VSOC_DESCRIBE_REGION _IOR(0xF5, 4, struct vsoc_device_region)
-#define VSOC_SELF_INTERRUPT _IO(0xF5, 5)
-#define VSOC_SEND_INTERRUPT_TO_HOST _IO(0xF5, 6)
-enum wait_types {
-  VSOC_WAIT_UNDEFINED = 0,
-  VSOC_WAIT_IF_EQUAL = 1,
-  VSOC_WAIT_IF_EQUAL_TIMEOUT = 2
-};
-struct vsoc_cond_wait {
-  __u32 offset;
-  __u32 value;
-  __u64 wake_time_sec;
-  __u32 wake_time_nsec;
-  __u32 wait_type;
-  __u32 wakes;
-  __u32 reserved_1;
-};
-#define VSOC_COND_WAIT _IOWR(0xF5, 7, struct vsoc_cond_wait)
-#define VSOC_COND_WAKE _IO(0xF5, 8)
-#endif
diff --git a/libc/kernel/uapi/linux/wireguard.h b/libc/kernel/uapi/linux/wireguard.h
new file mode 100644
index 0000000..6a4128b
--- /dev/null
+++ b/libc/kernel/uapi/linux/wireguard.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _WG_UAPI_WIREGUARD_H
+#define _WG_UAPI_WIREGUARD_H
+#define WG_GENL_NAME "wireguard"
+#define WG_GENL_VERSION 1
+#define WG_KEY_LEN 32
+enum wg_cmd {
+  WG_CMD_GET_DEVICE,
+  WG_CMD_SET_DEVICE,
+  __WG_CMD_MAX
+};
+#define WG_CMD_MAX (__WG_CMD_MAX - 1)
+enum wgdevice_flag {
+  WGDEVICE_F_REPLACE_PEERS = 1U << 0,
+  __WGDEVICE_F_ALL = WGDEVICE_F_REPLACE_PEERS
+};
+enum wgdevice_attribute {
+  WGDEVICE_A_UNSPEC,
+  WGDEVICE_A_IFINDEX,
+  WGDEVICE_A_IFNAME,
+  WGDEVICE_A_PRIVATE_KEY,
+  WGDEVICE_A_PUBLIC_KEY,
+  WGDEVICE_A_FLAGS,
+  WGDEVICE_A_LISTEN_PORT,
+  WGDEVICE_A_FWMARK,
+  WGDEVICE_A_PEERS,
+  __WGDEVICE_A_LAST
+};
+#define WGDEVICE_A_MAX (__WGDEVICE_A_LAST - 1)
+enum wgpeer_flag {
+  WGPEER_F_REMOVE_ME = 1U << 0,
+  WGPEER_F_REPLACE_ALLOWEDIPS = 1U << 1,
+  WGPEER_F_UPDATE_ONLY = 1U << 2,
+  __WGPEER_F_ALL = WGPEER_F_REMOVE_ME | WGPEER_F_REPLACE_ALLOWEDIPS | WGPEER_F_UPDATE_ONLY
+};
+enum wgpeer_attribute {
+  WGPEER_A_UNSPEC,
+  WGPEER_A_PUBLIC_KEY,
+  WGPEER_A_PRESHARED_KEY,
+  WGPEER_A_FLAGS,
+  WGPEER_A_ENDPOINT,
+  WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL,
+  WGPEER_A_LAST_HANDSHAKE_TIME,
+  WGPEER_A_RX_BYTES,
+  WGPEER_A_TX_BYTES,
+  WGPEER_A_ALLOWEDIPS,
+  WGPEER_A_PROTOCOL_VERSION,
+  __WGPEER_A_LAST
+};
+#define WGPEER_A_MAX (__WGPEER_A_LAST - 1)
+enum wgallowedip_attribute {
+  WGALLOWEDIP_A_UNSPEC,
+  WGALLOWEDIP_A_FAMILY,
+  WGALLOWEDIP_A_IPADDR,
+  WGALLOWEDIP_A_CIDR_MASK,
+  __WGALLOWEDIP_A_LAST
+};
+#define WGALLOWEDIP_A_MAX (__WGALLOWEDIP_A_LAST - 1)
+#endif
diff --git a/libc/kernel/uapi/linux/wireless.h b/libc/kernel/uapi/linux/wireless.h
index 6d41b94..ca31dd2 100644
--- a/libc/kernel/uapi/linux/wireless.h
+++ b/libc/kernel/uapi/linux/wireless.h
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/socket.h>
 #include <linux/if.h>
+#include <stddef.h>
 #define WIRELESS_EXT 22
 #define SIOCSIWCOMMIT 0x8B00
 #define SIOCGIWNAME 0x8B01
@@ -435,7 +436,7 @@
 #define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
 #define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
 #define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
-#define IW_EV_POINT_OFF (((char *) & (((struct iw_point *) NULL)->length)) - (char *) NULL)
+#define IW_EV_POINT_OFF offsetof(struct iw_point, length)
 #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - IW_EV_POINT_OFF)
 #define IW_EV_LCP_PK_LEN (4)
 #define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
diff --git a/libc/kernel/uapi/linux/hysdn_if.h b/libc/kernel/uapi/misc/pvpanic.h
similarity index 72%
copy from libc/kernel/uapi/linux/hysdn_if.h
copy to libc/kernel/uapi/misc/pvpanic.h
index 2aac1d0..18edcd8 100644
--- a/libc/kernel/uapi/linux/hysdn_if.h
+++ b/libc/kernel/uapi/misc/pvpanic.h
@@ -16,16 +16,8 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define ERR_NONE 0
-#define ERR_ALREADY_BOOT 1000
-#define EPOF_BAD_MAGIC 1001
-#define ERR_BOARD_DPRAM 1002
-#define EPOF_INTERNAL 1003
-#define EPOF_BAD_IMG_SIZE 1004
-#define ERR_BOOTIMG_FAIL 1005
-#define ERR_BOOTSEQ_FAIL 1006
-#define ERR_POF_TIMEOUT 1007
-#define ERR_NOT_BOOTED 1008
-#define ERR_CONF_LONG 1009
-#define ERR_INV_CHAN 1010
-#define ERR_ASYNC_TIME 1011
+#ifndef __PVPANIC_H__
+#define __PVPANIC_H__
+#define PVPANIC_PANICKED (1 << 0)
+#define PVPANIC_CRASH_LOADED (1 << 1)
+#endif
diff --git a/libc/kernel/uapi/linux/hysdn_if.h b/libc/kernel/uapi/misc/uacce/hisi_qm.h
similarity index 72%
copy from libc/kernel/uapi/linux/hysdn_if.h
copy to libc/kernel/uapi/misc/uacce/hisi_qm.h
index 2aac1d0..49d9f6a 100644
--- a/libc/kernel/uapi/linux/hysdn_if.h
+++ b/libc/kernel/uapi/misc/uacce/hisi_qm.h
@@ -16,16 +16,14 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define ERR_NONE 0
-#define ERR_ALREADY_BOOT 1000
-#define EPOF_BAD_MAGIC 1001
-#define ERR_BOARD_DPRAM 1002
-#define EPOF_INTERNAL 1003
-#define EPOF_BAD_IMG_SIZE 1004
-#define ERR_BOOTIMG_FAIL 1005
-#define ERR_BOOTSEQ_FAIL 1006
-#define ERR_POF_TIMEOUT 1007
-#define ERR_NOT_BOOTED 1008
-#define ERR_CONF_LONG 1009
-#define ERR_INV_CHAN 1010
-#define ERR_ASYNC_TIME 1011
+#ifndef _UAPI_HISI_QM_H
+#define _UAPI_HISI_QM_H
+#include <linux/types.h>
+struct hisi_qp_ctx {
+  __u16 id;
+  __u16 qc_type;
+};
+#define HISI_QM_API_VER_BASE "hisi_qm_v1"
+#define HISI_QM_API_VER2_BASE "hisi_qm_v2"
+#define UACCE_CMD_QM_SET_QP_CTX _IOWR('H', 10, struct hisi_qp_ctx)
+#endif
diff --git a/libc/kernel/uapi/linux/hysdn_if.h b/libc/kernel/uapi/misc/uacce/uacce.h
similarity index 72%
copy from libc/kernel/uapi/linux/hysdn_if.h
copy to libc/kernel/uapi/misc/uacce/uacce.h
index 2aac1d0..469d188 100644
--- a/libc/kernel/uapi/linux/hysdn_if.h
+++ b/libc/kernel/uapi/misc/uacce/uacce.h
@@ -16,16 +16,15 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define ERR_NONE 0
-#define ERR_ALREADY_BOOT 1000
-#define EPOF_BAD_MAGIC 1001
-#define ERR_BOARD_DPRAM 1002
-#define EPOF_INTERNAL 1003
-#define EPOF_BAD_IMG_SIZE 1004
-#define ERR_BOOTIMG_FAIL 1005
-#define ERR_BOOTSEQ_FAIL 1006
-#define ERR_POF_TIMEOUT 1007
-#define ERR_NOT_BOOTED 1008
-#define ERR_CONF_LONG 1009
-#define ERR_INV_CHAN 1010
-#define ERR_ASYNC_TIME 1011
+#ifndef _UAPIUUACCE_H
+#define _UAPIUUACCE_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#define UACCE_CMD_START_Q _IO('W', 0)
+#define UACCE_CMD_PUT_Q _IO('W', 1)
+#define UACCE_DEV_SVA BIT(0)
+enum uacce_qfrt {
+  UACCE_QFRT_MMIO = 0,
+  UACCE_QFRT_DUS = 1,
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
index ebf8b7c..3933841 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
@@ -39,6 +39,7 @@
   UVERBS_OBJECT_FLOW_ACTION,
   UVERBS_OBJECT_DM,
   UVERBS_OBJECT_COUNTERS,
+  UVERBS_OBJECT_ASYNC_EVENT,
 };
 enum {
   UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
@@ -48,6 +49,7 @@
   UVERBS_METHOD_INVOKE_WRITE,
   UVERBS_METHOD_INFO_HANDLES,
   UVERBS_METHOD_QUERY_PORT,
+  UVERBS_METHOD_GET_CONTEXT,
 };
 enum uverbs_attrs_invoke_write_cmd_attr_ids {
   UVERBS_ATTR_CORE_IN,
@@ -58,6 +60,10 @@
   UVERBS_ATTR_QUERY_PORT_PORT_NUM,
   UVERBS_ATTR_QUERY_PORT_RESP,
 };
+enum uverbs_attrs_get_context_attr_ids {
+  UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
+  UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
+};
 enum uverbs_attrs_create_cq_cmd_attr_ids {
   UVERBS_ATTR_CREATE_CQ_HANDLE,
   UVERBS_ATTR_CREATE_CQ_CQE,
@@ -187,4 +193,10 @@
 enum uverbs_attrs_flow_destroy_ids {
   UVERBS_ATTR_DESTROY_FLOW_HANDLE,
 };
+enum uverbs_method_async_event {
+  UVERBS_METHOD_ASYNC_EVENT_ALLOC,
+};
+enum uverbs_attrs_async_event_create {
+  UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE,
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
index 1394ed7..ddf2abd 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
@@ -23,6 +23,11 @@
 #ifndef RDMA_UAPI_PTR
 #define RDMA_UAPI_PTR(_type,_name) __aligned_u64 _name
 #endif
+#define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20)
+#define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29)
+enum ib_uverbs_core_support {
+  IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0,
+};
 enum ib_uverbs_access_flags {
   IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0,
   IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1,
@@ -32,6 +37,8 @@
   IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5,
   IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6,
   IB_UVERBS_ACCESS_HUGETLB = 1 << 7,
+  IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
+  IB_UVERBS_ACCESS_OPTIONAL_RANGE = ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) & ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
 };
 enum ib_uverbs_query_port_cap_flags {
   IB_UVERBS_PCF_SM = 1 << 1,
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index e01b6d3..c7fedb6 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -32,6 +32,7 @@
   MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC = 1 << 7,
   MLX5_QP_FLAG_ALLOW_SCATTER_CQE = 1 << 8,
   MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE = 1 << 9,
+  MLX5_QP_FLAG_UAR_PAGE_INDEX = 1 << 10,
 };
 enum {
   MLX5_SRQ_FLAG_SIGNATURE = 1 << 0,
@@ -46,6 +47,7 @@
 };
 enum mlx5_lib_caps {
   MLX5_LIB_CAP_4K_UAR = (__u64) 1 << 0,
+  MLX5_LIB_CAP_DYN_UAR = (__u64) 1 << 1,
 };
 enum mlx5_ib_alloc_uctx_v2_flags {
   MLX5_IB_ALLOC_UCTX_DEVX = 1 << 0,
@@ -189,6 +191,7 @@
 };
 enum mlx5_ib_create_cq_flags {
   MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,
+  MLX5_IB_CREATE_CQ_FLAGS_UAR_PAGE_INDEX = 1 << 1,
 };
 struct mlx5_ib_create_cq {
   __aligned_u64 buf_addr;
@@ -197,6 +200,9 @@
   __u8 cqe_comp_en;
   __u8 cqe_comp_res_format;
   __u16 flags;
+  __u16 uar_page_index;
+  __u16 reserved0;
+  __u32 reserved1;
 };
 struct mlx5_ib_create_cq_resp {
   __u32 cqn;
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
index 1cd3339..37ad392 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -85,6 +85,33 @@
   MLX5_IB_METHOD_DEVX_OBJ_QUERY,
   MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY,
 };
+enum mlx5_ib_var_alloc_attrs {
+  MLX5_IB_ATTR_VAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_OFFSET,
+  MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_LENGTH,
+  MLX5_IB_ATTR_VAR_OBJ_ALLOC_PAGE_ID,
+};
+enum mlx5_ib_var_obj_destroy_attrs {
+  MLX5_IB_ATTR_VAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+};
+enum mlx5_ib_var_obj_methods {
+  MLX5_IB_METHOD_VAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_METHOD_VAR_OBJ_DESTROY,
+};
+enum mlx5_ib_uar_alloc_attrs {
+  MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE,
+  MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET,
+  MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH,
+  MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID,
+};
+enum mlx5_ib_uar_obj_destroy_attrs {
+  MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+};
+enum mlx5_ib_uar_obj_methods {
+  MLX5_IB_METHOD_UAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_METHOD_UAR_OBJ_DESTROY,
+};
 enum mlx5_ib_devx_umem_reg_attrs {
   MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR,
@@ -95,6 +122,19 @@
 enum mlx5_ib_devx_umem_dereg_attrs {
   MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
 };
+enum mlx5_ib_pp_obj_methods {
+  MLX5_IB_METHOD_PP_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_METHOD_PP_OBJ_DESTROY,
+};
+enum mlx5_ib_pp_alloc_attrs {
+  MLX5_IB_ATTR_PP_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX,
+  MLX5_IB_ATTR_PP_OBJ_ALLOC_FLAGS,
+  MLX5_IB_ATTR_PP_OBJ_ALLOC_INDEX,
+};
+enum mlx5_ib_pp_obj_destroy_attrs {
+  MLX5_IB_ATTR_PP_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+};
 enum mlx5_ib_devx_umem_methods {
   MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT),
   MLX5_IB_METHOD_DEVX_UMEM_DEREG,
@@ -119,6 +159,9 @@
   MLX5_IB_OBJECT_FLOW_MATCHER,
   MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD,
   MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD,
+  MLX5_IB_OBJECT_VAR,
+  MLX5_IB_OBJECT_PP,
+  MLX5_IB_OBJECT_UAR,
 };
 enum mlx5_ib_flow_matcher_create_attrs {
   MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index dc2e69d..bfbfd76 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -27,6 +27,7 @@
   MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX = 0x1,
   MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2,
   MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX = 0x3,
+  MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX = 0x4,
 };
 enum mlx5_ib_uapi_flow_action_packet_reformat_type {
   MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 = 0x0,
@@ -50,4 +51,11 @@
   __aligned_u64 cookie;
   __u8 out_data[];
 };
+enum mlx5_ib_uapi_pp_alloc_flags {
+  MLX5_IB_UAPI_PP_ALLOC_FLAGS_DEDICATED_INDEX = 1 << 0,
+};
+enum mlx5_ib_uapi_uar_alloc_type {
+  MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF = 0x0,
+  MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC = 0x1,
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/qedr-abi.h b/libc/kernel/uapi/rdma/qedr-abi.h
index fd96309..2e666f3 100644
--- a/libc/kernel/uapi/rdma/qedr-abi.h
+++ b/libc/kernel/uapi/rdma/qedr-abi.h
@@ -28,6 +28,16 @@
   __u32 context_flags;
   __u32 reserved;
 };
+#define QEDR_LDPM_MAX_SIZE (8192)
+#define QEDR_EDPM_TRANS_SIZE (64)
+enum qedr_rdma_dpm_type {
+  QEDR_DPM_TYPE_NONE = 0,
+  QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0,
+  QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1,
+  QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2,
+  QEDR_DPM_TYPE_RESERVED = 1 << 3,
+  QEDR_DPM_SIZES_SET = 1 << 4,
+};
 struct qedr_alloc_ucontext_resp {
   __aligned_u64 db_pa;
   __u32 db_size;
@@ -38,10 +48,12 @@
   __u32 sges_per_recv_wr;
   __u32 sges_per_srq_wr;
   __u32 max_cqes;
-  __u8 dpm_enabled;
+  __u8 dpm_flags;
   __u8 wids_enabled;
   __u16 wid_count;
-  __u32 reserved;
+  __u16 ldpm_limit_size;
+  __u8 edpm_trans_size;
+  __u8 reserved;
 };
 struct qedr_alloc_pd_ureq {
   __aligned_u64 rsvd1;
diff --git a/libc/kernel/uapi/scsi/fc/fc_els.h b/libc/kernel/uapi/scsi/fc/fc_els.h
index 1cabadd..843bc4e 100644
--- a/libc/kernel/uapi/scsi/fc/fc_els.h
+++ b/libc/kernel/uapi/scsi/fc/fc_els.h
@@ -19,6 +19,7 @@
 #ifndef _FC_ELS_H_
 #define _FC_ELS_H_
 #include <linux/types.h>
+#include <asm/byteorder.h>
 enum fc_els_cmd {
   ELS_LS_RJT = 0x01,
   ELS_LS_ACC = 0x02,
@@ -41,6 +42,7 @@
   ELS_REC = 0x13,
   ELS_SRR = 0x14,
   ELS_FPIN = 0x16,
+  ELS_RDF = 0x19,
   ELS_PRLI = 0x20,
   ELS_PRLO = 0x21,
   ELS_SCN = 0x22,
@@ -82,7 +84,7 @@
   ELS_LKA = 0x80,
   ELS_AUTH_ELS = 0x90,
 };
-#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_FPIN] = "FPIN",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
+#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_FPIN] = "FPIN",[ELS_RDF] = "RDF",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
 }
 struct fc_els_ls_acc {
   __u8 la_cmd;
@@ -123,6 +125,32 @@
   ELS_EXPL_INV_LEN = 0x2d,
   ELS_EXPL_NOT_NEIGHBOR = 0x62,
 };
+enum fc_ls_tlv_dtag {
+  ELS_DTAG_LS_REQ_INFO = 0x00000001,
+  ELS_DTAG_LNK_INTEGRITY = 0x00020001,
+  ELS_DTAG_DELIVERY = 0x00020002,
+  ELS_DTAG_PEER_CONGEST = 0x00020003,
+  ELS_DTAG_CONGESTION = 0x00020004,
+  ELS_DTAG_FPIN_REGISTER = 0x00030001,
+};
+#define FC_LS_TLV_DTAG_INIT { { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, { ELS_DTAG_CONGESTION, "Congestion Notification" }, { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \
+}
+struct fc_tlv_desc {
+  __be32 desc_tag;
+  __be32 desc_len;
+  __u8 desc_value[0];
+};
+#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
+#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
+#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
+struct fc_els_lsri_desc {
+  __be32 desc_tag;
+  __be32 desc_len;
+  struct {
+    __u8 cmd;
+    __u8 bytes[3];
+  } rqst_w0;
+};
 struct fc_els_csp {
   __u8 sp_hi_ver;
   __u8 sp_lo_ver;
@@ -543,20 +571,52 @@
   ELS_CLID_IC_LOOP_TO = 7,
   ELS_CLID_IC_LIP = 8,
 };
-enum fc_fn_dtag {
-  ELS_FN_DTAG_LNK_INTEGRITY = 0x00020001,
-  ELS_FN_DTAG_PEER_CONGEST = 0x00020003,
-  ELS_FN_DTAG_CONGESTION = 0x00020004,
+enum fc_fpin_li_event_types {
+  FPIN_LI_UNKNOWN = 0x0,
+  FPIN_LI_LINK_FAILURE = 0x1,
+  FPIN_LI_LOSS_OF_SYNC = 0x2,
+  FPIN_LI_LOSS_OF_SIG = 0x3,
+  FPIN_LI_PRIM_SEQ_ERR = 0x4,
+  FPIN_LI_INVALID_TX_WD = 0x5,
+  FPIN_LI_INVALID_CRC = 0x6,
+  FPIN_LI_DEVICE_SPEC = 0xF,
 };
-struct fc_fn_desc {
-  __be32 fn_desc_tag;
-  __be32 fn_desc_value_len;
-  __u8 fn_desc_value[0];
+#define FC_FPIN_LI_EVT_TYPES_INIT { { FPIN_LI_UNKNOWN, "Unknown" }, { FPIN_LI_LINK_FAILURE, "Link Failure" }, { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, { FPIN_LI_INVALID_CRC, "Invalid CRC" }, { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \
+}
+struct fc_fn_li_desc {
+  __be32 desc_tag;
+  __be32 desc_len;
+  __be64 detecting_wwpn;
+  __be64 attached_wwpn;
+  __be16 event_type;
+  __be16 event_modifier;
+  __be32 event_threshold;
+  __be32 event_count;
+  __be32 pname_count;
+  __be64 pname_list[0];
 };
 struct fc_els_fpin {
   __u8 fpin_cmd;
   __u8 fpin_zero[3];
-  __be32 fpin_desc_cnt;
-  struct fc_fn_desc fpin_desc[0];
+  __be32 desc_len;
+  struct fc_tlv_desc fpin_desc[0];
+};
+struct fc_df_desc_fpin_reg {
+  __be32 desc_tag;
+  __be32 desc_len;
+  __be32 count;
+  __be32 desc_tags[0];
+};
+struct fc_els_rdf {
+  __u8 fpin_cmd;
+  __u8 fpin_zero[3];
+  __be32 desc_len;
+  struct fc_tlv_desc desc[0];
+};
+struct fc_els_rdf_resp {
+  struct fc_els_ls_acc acc_hdr;
+  __be32 desc_list_len;
+  struct fc_els_lsri_desc lsri;
+  struct fc_tlv_desc desc[0];
 };
 #endif
diff --git a/libc/kernel/uapi/scsi/scsi_bsg_ufs.h b/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
index 177cae9..ae5c757 100644
--- a/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
+++ b/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
@@ -46,7 +46,6 @@
   union {
     struct utp_upiu_cmd sc;
     struct utp_upiu_query qr;
-    struct utp_upiu_query tr;
     struct utp_upiu_query uc;
   };
 };
diff --git a/libc/kernel/uapi/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index abc81dd..397cccc 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -20,7 +20,9 @@
 #define _UAPI__SOUND_ASOUND_H
 #ifdef __linux__
 #include <linux/types.h>
+#include <asm/byteorder.h>
 #else
+#include <endian.h>
 #include <sys/ioctl.h>
 #endif
 #include <stdlib.h>
@@ -101,7 +103,7 @@
 #define SNDRV_HWDEP_IOCTL_INFO _IOR('H', 0x01, struct snd_hwdep_info)
 #define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
 #define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
 typedef unsigned long snd_pcm_uframes_t;
 typedef signed long snd_pcm_sframes_t;
 enum {
@@ -234,6 +236,9 @@
 #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000
 #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000
 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000
+#if __BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)
+#define __SND_STRUCT_TIME64
+#endif
 typedef int __bitwise snd_pcm_state_t;
 #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0)
 #define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1)
@@ -247,8 +252,17 @@
 #define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
 enum {
   SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
-  SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
-  SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
+  SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
+  SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
+  SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
+  SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
+#ifdef __SND_STRUCT_TIME64
+  SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
+  SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
+#else
+  SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
+  SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
+#endif
 };
 union snd_pcm_sync_id {
   unsigned char id[16];
@@ -351,8 +365,12 @@
   SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5,
   SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
 };
+typedef struct {
+  unsigned char pad[sizeof(time_t) - sizeof(int)];
+} __time_pad;
 struct snd_pcm_status {
   snd_pcm_state_t state;
+  __time_pad pad1;
   struct timespec trigger_tstamp;
   struct timespec tstamp;
   snd_pcm_uframes_t appl_ptr;
@@ -368,29 +386,87 @@
   __u32 audio_tstamp_accuracy;
   unsigned char reserved[52 - 2 * sizeof(struct timespec)];
 };
-struct snd_pcm_mmap_status {
+#ifdef __SND_STRUCT_TIME64
+#define __snd_pcm_mmap_status64 snd_pcm_mmap_status
+#define __snd_pcm_mmap_control64 snd_pcm_mmap_control
+#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
+#define __snd_timespec64 timespec
+struct __snd_timespec {
+  __s32 tv_sec;
+  __s32 tv_nsec;
+};
+#else
+#define __snd_pcm_mmap_status snd_pcm_mmap_status
+#define __snd_pcm_mmap_control snd_pcm_mmap_control
+#define __snd_pcm_sync_ptr snd_pcm_sync_ptr
+#define __snd_timespec timespec
+struct __snd_timespec64 {
+  __s64 tv_sec;
+  __s64 tv_nsec;
+};
+#endif
+struct __snd_pcm_mmap_status {
   snd_pcm_state_t state;
   int pad1;
   snd_pcm_uframes_t hw_ptr;
-  struct timespec tstamp;
+  struct __snd_timespec tstamp;
   snd_pcm_state_t suspended_state;
-  struct timespec audio_tstamp;
+  struct __snd_timespec audio_tstamp;
 };
-struct snd_pcm_mmap_control {
+struct __snd_pcm_mmap_control {
   snd_pcm_uframes_t appl_ptr;
   snd_pcm_uframes_t avail_min;
 };
 #define SNDRV_PCM_SYNC_PTR_HWSYNC (1 << 0)
 #define SNDRV_PCM_SYNC_PTR_APPL (1 << 1)
 #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1 << 2)
-struct snd_pcm_sync_ptr {
+struct __snd_pcm_sync_ptr {
   unsigned int flags;
   union {
-    struct snd_pcm_mmap_status status;
+    struct __snd_pcm_mmap_status status;
     unsigned char reserved[64];
   } s;
   union {
-    struct snd_pcm_mmap_control control;
+    struct __snd_pcm_mmap_control control;
+    unsigned char reserved[64];
+  } c;
+};
+#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
+typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
+typedef char __pad_after_uframe[0];
+#endif
+#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
+typedef char __pad_before_uframe[0];
+typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
+#endif
+struct __snd_pcm_mmap_status64 {
+  snd_pcm_state_t state;
+  __u32 pad1;
+  __pad_before_uframe __pad1;
+  snd_pcm_uframes_t hw_ptr;
+  __pad_after_uframe __pad2;
+  struct __snd_timespec64 tstamp;
+  snd_pcm_state_t suspended_state;
+  __u32 pad3;
+  struct __snd_timespec64 audio_tstamp;
+};
+struct __snd_pcm_mmap_control64 {
+  __pad_before_uframe __pad1;
+  snd_pcm_uframes_t appl_ptr;
+  __pad_before_uframe __pad2;
+  __pad_before_uframe __pad3;
+  snd_pcm_uframes_t avail_min;
+  __pad_after_uframe __pad4;
+};
+struct __snd_pcm_sync_ptr64 {
+  __u32 flags;
+  __u32 pad1;
+  union {
+    struct __snd_pcm_mmap_status64 status;
+    unsigned char reserved[64];
+  } s;
+  union {
+    struct __snd_pcm_mmap_control64 control;
     unsigned char reserved[64];
   } c;
 };
@@ -465,6 +541,8 @@
 #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
 #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
 #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
+#define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
+#define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
 #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
 #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
 #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
@@ -484,7 +562,7 @@
 #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
 #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
 #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
 enum {
   SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
   SNDRV_RAWMIDI_STREAM_INPUT,
@@ -515,6 +593,7 @@
 };
 struct snd_rawmidi_status {
   int stream;
+  __time_pad pad1;
   struct timespec tstamp;
   size_t avail;
   size_t xruns;
@@ -526,7 +605,7 @@
 #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
 #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
 #define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
 enum {
   SNDRV_TIMER_CLASS_NONE = - 1,
   SNDRV_TIMER_CLASS_SLAVE = 0,
@@ -614,7 +693,7 @@
 };
 #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
 #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
-#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
+#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
 #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
 #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
 #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
@@ -626,6 +705,12 @@
 #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
 #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
 #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
+#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
+#if __BITS_PER_LONG == 64
+#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
+#else
+#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? SNDRV_TIMER_IOCTL_TREAD_OLD : SNDRV_TIMER_IOCTL_TREAD64)
+#endif
 struct snd_timer_read {
   unsigned int resolution;
   unsigned int ticks;
@@ -649,10 +734,12 @@
 };
 struct snd_timer_tread {
   int event;
+  __time_pad pad1;
   struct timespec tstamp;
   unsigned int val;
+  __time_pad pad2;
 };
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
 struct snd_ctl_card_info {
   int card;
   int pad;
@@ -686,7 +773,6 @@
 #define SNDRV_CTL_ELEM_ACCESS_WRITE (1 << 1)
 #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE)
 #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1 << 2)
-#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1 << 3)
 #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1 << 4)
 #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1 << 5)
 #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
@@ -745,11 +831,7 @@
     } enumerated;
     unsigned char reserved[128];
   } value;
-  union {
-    unsigned short d[4];
-    unsigned short * d_ptr;
-  } dimen;
-  unsigned char reserved[64 - 4 * sizeof(unsigned short)];
+  unsigned char reserved[64];
 };
 struct snd_ctl_elem_value {
   struct snd_ctl_elem_id id;
@@ -773,8 +855,7 @@
     } bytes;
     struct snd_aes_iec958 iec958;
   } value;
-  struct timespec tstamp;
-  unsigned char reserved[128 - sizeof(struct timespec)];
+  unsigned char reserved[128];
 };
 struct snd_ctl_tlv {
   unsigned int numid;
diff --git a/libc/kernel/uapi/sound/compress_offload.h b/libc/kernel/uapi/sound/compress_offload.h
index 3b532ff..60688bc 100644
--- a/libc/kernel/uapi/sound/compress_offload.h
+++ b/libc/kernel/uapi/sound/compress_offload.h
@@ -21,7 +21,7 @@
 #include <linux/types.h>
 #include <sound/asound.h>
 #include <sound/compress_params.h>
-#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
+#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 2, 0)
 struct snd_compressed_buffer {
   __u32 fragment_size;
   __u32 fragments;
diff --git a/libc/kernel/uapi/sound/compress_params.h b/libc/kernel/uapi/sound/compress_params.h
index f49b45f..ee6c000 100644
--- a/libc/kernel/uapi/sound/compress_params.h
+++ b/libc/kernel/uapi/sound/compress_params.h
@@ -37,7 +37,9 @@
 #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
 #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
 #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E)
-#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_BESPOKE
+#define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F)
+#define SND_AUDIOCODEC_APE ((__u32) 0x00000010)
+#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE
 #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
 #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
 #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
@@ -81,6 +83,9 @@
 #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
 #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
 #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
+#define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010)
+#define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020)
+#define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040)
 #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
 #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
 #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
@@ -171,6 +176,30 @@
   __u16 max_frame_size;
   __u16 reserved;
 } __attribute__((packed, aligned(4)));
+struct snd_dec_wma {
+  __u32 encoder_option;
+  __u32 adv_encoder_option;
+  __u32 adv_encoder_option2;
+  __u32 reserved;
+} __attribute__((packed, aligned(4)));
+struct snd_dec_alac {
+  __u32 frame_length;
+  __u8 compatible_version;
+  __u8 pb;
+  __u8 mb;
+  __u8 kb;
+  __u32 max_run;
+  __u32 max_frame_bytes;
+} __attribute__((packed, aligned(4)));
+struct snd_dec_ape {
+  __u16 compatible_version;
+  __u16 compression_level;
+  __u32 format_flags;
+  __u32 blocks_per_frame;
+  __u32 final_frame_blocks;
+  __u32 total_frames;
+  __u32 seek_table_present;
+} __attribute__((packed, aligned(4)));
 union snd_codec_options {
   struct snd_enc_wma wma;
   struct snd_enc_vorbis vorbis;
@@ -178,6 +207,9 @@
   struct snd_enc_flac flac;
   struct snd_enc_generic generic;
   struct snd_dec_flac flac_d;
+  struct snd_dec_wma wma_d;
+  struct snd_dec_alac alac_d;
+  struct snd_dec_ape ape_d;
 } __attribute__((packed, aligned(4)));
 struct snd_codec_desc {
   __u32 max_ch;
diff --git a/libc/kernel/uapi/sound/emu10k1.h b/libc/kernel/uapi/sound/emu10k1.h
index 4ad0002..483309e 100644
--- a/libc/kernel/uapi/sound/emu10k1.h
+++ b/libc/kernel/uapi/sound/emu10k1.h
@@ -18,8 +18,9 @@
  ****************************************************************************/
 #ifndef _UAPI__SOUND_EMU10K1_H
 #define _UAPI__SOUND_EMU10K1_H
+#ifdef __linux__
 #include <linux/types.h>
-#include <sound/asound.h>
+#endif
 #define EMU10K1_CARD_CREATIVE 0x00000000
 #define EMU10K1_CARD_EMUAPS 0x00000001
 #define EMU10K1_FX8010_PCM_COUNT 8
@@ -233,8 +234,20 @@
 #define EMU10K1_GPR_TRANSLATION_BASS 2
 #define EMU10K1_GPR_TRANSLATION_TREBLE 3
 #define EMU10K1_GPR_TRANSLATION_ONOFF 4
+enum emu10k1_ctl_elem_iface {
+  EMU10K1_CTL_ELEM_IFACE_MIXER = 2,
+  EMU10K1_CTL_ELEM_IFACE_PCM = 3,
+};
+struct emu10k1_ctl_elem_id {
+  unsigned int pad;
+  int iface;
+  unsigned int device;
+  unsigned int subdevice;
+  unsigned char name[44];
+  unsigned int index;
+};
 struct snd_emu10k1_fx8010_control_gpr {
-  struct snd_ctl_elem_id id;
+  struct emu10k1_ctl_elem_id id;
   unsigned int vcount;
   unsigned int count;
   unsigned short gpr[32];
@@ -245,7 +258,7 @@
   const unsigned int * tlv;
 };
 struct snd_emu10k1_fx8010_control_old_gpr {
-  struct snd_ctl_elem_id id;
+  struct emu10k1_ctl_elem_id id;
   unsigned int vcount;
   unsigned int count;
   unsigned short gpr[32];
@@ -257,19 +270,19 @@
 struct snd_emu10k1_fx8010_code {
   char name[128];
   __EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200);
-  __u32 __user * gpr_map;
+  __u32 * gpr_map;
   unsigned int gpr_add_control_count;
-  struct snd_emu10k1_fx8010_control_gpr __user * gpr_add_controls;
+  struct snd_emu10k1_fx8010_control_gpr * gpr_add_controls;
   unsigned int gpr_del_control_count;
-  struct snd_ctl_elem_id __user * gpr_del_controls;
+  struct emu10k1_ctl_elem_id * gpr_del_controls;
   unsigned int gpr_list_control_count;
   unsigned int gpr_list_control_total;
-  struct snd_emu10k1_fx8010_control_gpr __user * gpr_list_controls;
+  struct snd_emu10k1_fx8010_control_gpr * gpr_list_controls;
   __EMU10K1_DECLARE_BITMAP(tram_valid, 0x100);
-  __u32 __user * tram_data_map;
-  __u32 __user * tram_addr_map;
+  __u32 * tram_data_map;
+  __u32 * tram_addr_map;
   __EMU10K1_DECLARE_BITMAP(code_valid, 1024);
-  __u32 __user * code;
+  __u32 * code;
 };
 struct snd_emu10k1_fx8010_tram {
   unsigned int address;
@@ -307,9 +320,4 @@
 #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO('H', 0x82)
 #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW('H', 0x83, int)
 #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR('H', 0x84, int)
-typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
-typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
-typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
-typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
-typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
 #endif
diff --git a/libc/kernel/uapi/sound/hdsp.h b/libc/kernel/uapi/sound/hdsp.h
index 02e7f2d..2fec371 100644
--- a/libc/kernel/uapi/sound/hdsp.h
+++ b/libc/kernel/uapi/sound/hdsp.h
@@ -18,7 +18,9 @@
  ****************************************************************************/
 #ifndef __SOUND_HDSP_H
 #define __SOUND_HDSP_H
+#ifdef __linux__
 #include <linux/types.h>
+#endif
 #define HDSP_MATRIX_MIXER_SIZE 2048
 enum HDSP_IO_Type {
   Digiface,
@@ -64,7 +66,7 @@
 };
 #define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
 struct hdsp_firmware {
-  void __user * firmware_data;
+  void * firmware_data;
 };
 #define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
 struct hdsp_version {
@@ -81,11 +83,4 @@
   int aebo;
 };
 #define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
-typedef enum HDSP_IO_Type HDSP_IO_Type;
-typedef struct hdsp_peak_rms hdsp_peak_rms_t;
-typedef struct hdsp_config_info hdsp_config_info_t;
-typedef struct hdsp_firmware hdsp_firmware_t;
-typedef struct hdsp_version hdsp_version_t;
-typedef struct hdsp_mixer hdsp_mixer_t;
-typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
 #endif
diff --git a/libc/kernel/uapi/sound/hdspm.h b/libc/kernel/uapi/sound/hdspm.h
index dc3192d..bd28e8c 100644
--- a/libc/kernel/uapi/sound/hdspm.h
+++ b/libc/kernel/uapi/sound/hdspm.h
@@ -18,7 +18,9 @@
  ****************************************************************************/
 #ifndef __SOUND_HDSPM_H
 #define __SOUND_HDSPM_H
+#ifdef __linux__
 #include <linux/types.h>
+#endif
 #define HDSPM_MAX_CHANNELS 64
 enum hdspm_io_type {
   MADI,
@@ -144,9 +146,4 @@
   struct hdspm_mixer * mixer;
 };
 #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
-typedef struct hdspm_peak_rms hdspm_peak_rms_t;
-typedef struct hdspm_config_info hdspm_config_info_t;
-typedef struct hdspm_version hdspm_version_t;
-typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
-typedef struct hdspm_mixer hdspm_mixer_t;
 #endif
diff --git a/libc/kernel/uapi/sound/sof/abi.h b/libc/kernel/uapi/sound/sof/abi.h
index f19e4e9..b0adb11 100644
--- a/libc/kernel/uapi/sound/sof/abi.h
+++ b/libc/kernel/uapi/sound/sof/abi.h
@@ -19,7 +19,7 @@
 #ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
 #define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
 #define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 11
+#define SOF_ABI_MINOR 13
 #define SOF_ABI_PATCH 0
 #define SOF_ABI_MAJOR_SHIFT 24
 #define SOF_ABI_MAJOR_MASK 0xff
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
index 6d8561f..7ce5ddc 100644
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ b/libc/kernel/uapi/sound/sof/tokens.h
@@ -37,6 +37,10 @@
 #define SOF_TKN_VOLUME_RAMP_STEP_MS 251
 #define SOF_TKN_SRC_RATE_IN 300
 #define SOF_TKN_SRC_RATE_OUT 301
+#define SOF_TKN_ASRC_RATE_IN 320
+#define SOF_TKN_ASRC_RATE_OUT 321
+#define SOF_TKN_ASRC_ASYNCHRONOUS_MODE 322
+#define SOF_TKN_ASRC_OPERATION_MODE 323
 #define SOF_TKN_PCM_DMAC_CONFIG 353
 #define SOF_TKN_COMP_PERIOD_SINK_COUNT 400
 #define SOF_TKN_COMP_PERIOD_SOURCE_COUNT 401
@@ -67,7 +71,7 @@
 #define SOF_TKN_TONE_SAMPLE_RATE 800
 #define SOF_TKN_PROCESS_TYPE 900
 #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE
-#define SOF_TKN_IMX_SAI_FIRST_TOKEN 1000
+#define SOF_TKN_IMX_SAI_MCLK_ID 1000
 #define SOF_TKN_IMX_ESAI_MCLK_ID 1100
 #define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 1200
 #define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 4bfb8a2..10732a1 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1550,6 +1550,12 @@
     _Unwind_VRS_Set; # apex llndk arm
 } LIBC_Q;
 
+LIBC_S { # introduced=S
+  global:
+    ffsl;
+    ffsll;
+} LIBC_R;
+
 LIBC_PRIVATE {
   global:
     __accept4; # arm x86
diff --git a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
index f260db7..1bfe61e 100644
--- a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
@@ -40,7 +40,7 @@
 #include <android-base/file.h>
 #include <android-base/stringprintf.h>
 #include <gtest/gtest.h>
-#include <log/log.h>
+#include <log/log_read.h>
 
 #include <atomic>
 #include <string>
@@ -158,7 +158,7 @@
   log_str->clear();
 
   logger_list* list;
-  list = android_logger_list_open(log, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid);
+  list = android_logger_list_open(log, ANDROID_LOG_NONBLOCK, 1000, pid);
   ASSERT_TRUE(list != nullptr);
 
   while (true) {
diff --git a/libc/malloc_hooks/README.md b/libc/malloc_hooks/README.md
index b418e1e..1747e8d 100644
--- a/libc/malloc_hooks/README.md
+++ b/libc/malloc_hooks/README.md
@@ -74,11 +74,11 @@
 ======================
 Below is a simple implementation intercepting only malloc/calloc calls.
 
-    void* new_malloc_hook(size_t bytes, const char* arg) {
+    void* new_malloc_hook(size_t bytes, const void* arg) {
       return orig_malloc_hook(bytes, arg);
     }
 
-    void orig_malloc_hook = __malloc_hook;
+    auto orig_malloc_hook = __malloc_hook;
     __malloc_hook = new_malloc_hook;
 
 Enabling Examples
diff --git a/libc/platform/bionic/macros.h b/libc/platform/bionic/macros.h
index 28a69e6..076cff1 100644
--- a/libc/platform/bionic/macros.h
+++ b/libc/platform/bionic/macros.h
@@ -83,11 +83,15 @@
 #define __BIONIC_FALLTHROUGH
 #endif
 
-template <typename T>
-static inline T* untag_address(T* p) {
+static inline uintptr_t untag_address(uintptr_t p) {
 #if defined(__aarch64__)
-  return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ((1ULL << 56) - 1));
+  return p & ((1ULL << 56) - 1);
 #else
   return p;
 #endif
 }
+
+template <typename T>
+static inline T* untag_address(T* p) {
+  return reinterpret_cast<T*>(untag_address(reinterpret_cast<uintptr_t>(p)));
+}
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index 0ea7e3c..f9eb03f 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -116,6 +116,8 @@
   M_HEAP_TAGGING_LEVEL_TBI = 1,
   // Enable heap tagging if supported, at a level appropriate for asynchronous memory tag checks.
   M_HEAP_TAGGING_LEVEL_ASYNC = 2,
+  // Enable heap tagging if supported, at a level appropriate for synchronous memory tag checks.
+  M_HEAP_TAGGING_LEVEL_SYNC = 3,
 };
 
 // Manipulates bionic-specific handling of memory allocation APIs such as
diff --git a/libc/platform/bionic/mte.h b/libc/platform/bionic/mte.h
index fbf3895..1e393eb 100644
--- a/libc/platform/bionic/mte.h
+++ b/libc/platform/bionic/mte.h
@@ -31,16 +31,14 @@
 #include <sys/auxv.h>
 #include <bionic/mte_kernel.h>
 
-#ifdef __aarch64__
 inline bool mte_supported() {
-#ifdef ANDROID_EXPERIMENTAL_MTE
+#if defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
   static bool supported = getauxval(AT_HWCAP2) & HWCAP2_MTE;
 #else
   static bool supported = false;
 #endif
   return supported;
 }
-#endif
 
 #ifdef __aarch64__
 class ScopedDisableMTE {
diff --git a/libc/platform/bionic/mte_kernel.h b/libc/platform/bionic/mte_kernel.h
index 2c777c9..e8ef2a5 100644
--- a/libc/platform/bionic/mte_kernel.h
+++ b/libc/platform/bionic/mte_kernel.h
@@ -37,7 +37,7 @@
 
 #ifdef ANDROID_EXPERIMENTAL_MTE
 
-#define HWCAP2_MTE (1 << 10)
+#define HWCAP2_MTE (1 << 18)
 #define PROT_MTE 0x20
 
 #define PR_MTE_TCF_SHIFT 1
@@ -45,10 +45,13 @@
 #define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
 #define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_EXCL_SHIFT 3
-#define PR_MTE_EXCL_MASK (0xffffUL << PR_MTE_EXCL_SHIFT)
+#define PR_MTE_TAG_SHIFT 3
+#define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
 
-#define SEGV_MTEAERR 6
-#define SEGV_MTESERR 7
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
+
+#define PTRACE_PEEKMTETAGS 33
+#define PTRACE_POKEMTETAGS 34
 
 #endif
diff --git a/libc/private/WriteProtected.h b/libc/private/WriteProtected.h
index 8f5b32d..746f72a 100644
--- a/libc/private/WriteProtected.h
+++ b/libc/private/WriteProtected.h
@@ -40,23 +40,11 @@
 // explicitly.
 template <typename T>
 class WriteProtected {
+ public:
   static_assert(sizeof(T) < PAGE_SIZE,
                 "WriteProtected only supports contents up to PAGE_SIZE");
   static_assert(__is_pod(T), "WriteProtected only supports POD contents");
 
-  WriteProtectedContents<T> contents;
-
-  int set_protection(int prot) {
-    auto addr = &contents;
-#if __has_feature(hwaddress_sanitizer)
-    // The mprotect system call does not currently untag pointers, so do it
-    // ourselves.
-    addr = untag_address(addr);
-#endif
-    return mprotect(reinterpret_cast<void*>(addr), PAGE_SIZE, prot);
-  }
-
- public:
   WriteProtected() = default;
   BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtected);
 
@@ -64,10 +52,7 @@
     // Not strictly necessary, but this will hopefully segfault if we initialize
     // multiple times by accident.
     memset(&contents, 0, sizeof(contents));
-
-    if (set_protection(PROT_READ)) {
-      async_safe_fatal("failed to make WriteProtected nonwritable in initialize");
-    }
+    set_protection(PROT_READ);
   }
 
   const T* operator->() {
@@ -80,14 +65,23 @@
 
   template <typename Mutator>
   void mutate(Mutator mutator) {
-    if (set_protection(PROT_READ | PROT_WRITE) != 0) {
-      async_safe_fatal("failed to make WriteProtected writable in mutate: %s",
-                       strerror(errno));
-    }
+    set_protection(PROT_READ | PROT_WRITE);
     mutator(&contents.value);
-    if (set_protection(PROT_READ) != 0) {
-      async_safe_fatal("failed to make WriteProtected nonwritable in mutate: %s",
-                       strerror(errno));
+    set_protection(PROT_READ);
+  }
+
+ private:
+  WriteProtectedContents<T> contents;
+
+  void set_protection(int prot) {
+    auto addr = &contents;
+#if __has_feature(hwaddress_sanitizer)
+    // The mprotect system call does not currently untag pointers, so do it
+    // ourselves.
+    addr = untag_address(addr);
+#endif
+    if (mprotect(reinterpret_cast<void*>(addr), PAGE_SIZE, prot) == -1) {
+      async_safe_fatal("WriteProtected mprotect %x failed: %s", prot, strerror(errno));
     }
   }
 };
diff --git a/libc/private/bionic_fortify.h b/libc/private/bionic_fortify.h
index 3c3292e..df83360 100644
--- a/libc/private/bionic_fortify.h
+++ b/libc/private/bionic_fortify.h
@@ -35,7 +35,11 @@
 
 #include <async_safe/log.h>
 
-static inline __noreturn void __fortify_fatal(const char* fmt, ...) {
+//
+// LLVM can't inline variadic functions, and we don't want one definition of
+// this per #include in libc.so, so no `static`.
+//
+inline __noreturn __printflike(1, 2) void __fortify_fatal(const char* fmt, ...) {
   va_list args;
   va_start(args, fmt);
   async_safe_fatal_va_list("FORTIFY", fmt, args);
@@ -52,7 +56,7 @@
     __fortify_fatal("%s: file descriptor %d < 0", fn, fd);
   }
   if (__predict_false(fd >= FD_SETSIZE)) {
-    __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %zu", fn, fd, FD_SETSIZE);
+    __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %d", fn, fd, FD_SETSIZE);
   }
   if (__predict_false(set_size < sizeof(fd_set))) {
     __fortify_fatal("%s: set size %zu is too small to be an fd_set", fn, set_size);
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index 6e7eb76..5c9b726 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -101,8 +101,11 @@
   const char* init_progname = nullptr;
   char** init_environ = nullptr;
 
-  const gwp_asan::AllocatorState *gwp_asan_state = nullptr;
-  const gwp_asan::AllocationMetadata *gwp_asan_metadata = nullptr;
+  const gwp_asan::AllocatorState* gwp_asan_state = nullptr;
+  const gwp_asan::AllocationMetadata* gwp_asan_metadata = nullptr;
+
+  const char* scudo_stack_depot = nullptr;
+  const char* scudo_region_info = nullptr;
 };
 
 __LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
diff --git a/libc/private/bionic_string_utils.h b/libc/private/bionic_string_utils.h
deleted file mode 100644
index ab0eccf..0000000
--- a/libc/private/bionic_string_utils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _BIONIC_STRING_UTILS_H_
-#define _BIONIC_STRING_UTILS_H_
-
-#include <string.h>
-
-static inline bool ends_with(const char* s1, const char* s2) {
-  size_t s1_length = strlen(s1);
-  size_t s2_length = strlen(s2);
-  if (s2_length > s1_length) {
-    return false;
-  }
-  return memcmp(s1 + (s1_length - s2_length), s2, s2_length) == 0;
-}
-
-#endif // _BIONIC_STRING_UTILS_H_
diff --git a/libc/seccomp/seccomp_policy.cpp b/libc/seccomp/seccomp_policy.cpp
index 65357fc..a42816e 100644
--- a/libc/seccomp/seccomp_policy.cpp
+++ b/libc/seccomp/seccomp_policy.cpp
@@ -140,12 +140,12 @@
     Disallow(f);
 }
 
-// This filter is meant to be installed in addition to a regular whitelist filter.
+// This filter is meant to be installed in addition to a regular allowlist filter.
 // Therefore, it's default action has to be Allow, except when the evaluated
 // system call matches setresuid/setresgid and the arguments don't fall within the
 // passed in range.
 //
-// The regular whitelist only allows setresuid/setresgid for UID/GID changes, so
+// The regular allowlist only allows setresuid/setresgid for UID/GID changes, so
 // that's the only system call we need to check here. A CTS test ensures the other
 // calls will remain blocked.
 static void ValidateSetUidGid(filter& f, uint32_t uid_gid_min, uint32_t uid_gid_max, bool primary) {
diff --git a/libc/stdlib/exit.c b/libc/stdlib/exit.c
deleted file mode 100644
index e301a2a..0000000
--- a/libc/stdlib/exit.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <unistd.h>
-
-#include "private/bionic_defs.h"
-
-extern void __cxa_finalize(void* dso_handle);
-extern void __cxa_thread_finalize();
-
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-void exit(int status) {
-  __cxa_thread_finalize();
-  __cxa_finalize(NULL);
-  _exit(status);
-}
diff --git a/libc/system_properties/contexts_split.cpp b/libc/system_properties/contexts_split.cpp
index 11db7ec..96b01a4 100644
--- a/libc/system_properties/contexts_split.cpp
+++ b/libc/system_properties/contexts_split.cpp
@@ -114,8 +114,6 @@
 }
 
 // The below two functions are duplicated from label_support.c in libselinux.
-// TODO: Find a location suitable for these functions such that both libc and
-// libselinux can share a common source file.
 
 // The read_spec_entries and read_spec_entry functions may be used to
 // replace sscanf to read entries from spec files. The file and
diff --git a/libc/tools/generate-NOTICE.py b/libc/tools/generate-NOTICE.py
index 7218445..b6deb9c 100755
--- a/libc/tools/generate-NOTICE.py
+++ b/libc/tools/generate-NOTICE.py
@@ -26,6 +26,7 @@
     uninteresting_extensions = [
         ".bp",
         ".map",
+        ".md",
         ".mk",
         ".py",
         ".pyc",
@@ -34,7 +35,7 @@
     ]
     if os.path.splitext(path)[1] in uninteresting_extensions:
         return False
-    if path.endswith("/notice") or path.endswith("/readme"):
+    if path.endswith("/notice") or path.endswith("/readme") or path.endswith("/pylintrc"):
         return False
     return True
 
@@ -137,7 +138,7 @@
 
     if not "Copyright" in content:
         if "public domain" in content.lower():
-            warn("ignoring public domain file %s" % path)
+            warn_verbose("ignoring public domain file %s" % path)
             return
         warn('no copyright notice found in "%s" (%d lines)' % (path, len(lines)))
         return
diff --git a/libc/tools/genseccomp.py b/libc/tools/genseccomp.py
index ba7e2ca..89eeb44 100755
--- a/libc/tools/genseccomp.py
+++ b/libc/tools/genseccomp.py
@@ -56,12 +56,12 @@
   return priorities
 
 
-def merge_names(base_names, whitelist_names, blacklist_names):
-  if bool(blacklist_names - base_names):
-    raise RuntimeError("Blacklist item not in bionic - aborting " + str(
-        blacklist_names - base_names))
+def merge_names(base_names, allowlist_names, blocklist_names):
+  if bool(blocklist_names - base_names):
+    raise RuntimeError("blocklist item not in bionic - aborting " + str(
+        blocklist_names - base_names))
 
-  return (base_names - blacklist_names) | whitelist_names
+  return (base_names - blocklist_names) | allowlist_names
 
 
 def extract_priority_syscalls(syscalls, priorities):
@@ -230,19 +230,19 @@
 def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files, syscall_NRs, priority_file):
   for arch in SupportedArchitectures:
     base_names = load_syscall_names_from_file(base_syscall_file, arch)
-    whitelist_names = set()
-    blacklist_names = set()
+    allowlist_names = set()
+    blocklist_names = set()
     for f in syscall_files:
-      if "blacklist" in f.lower():
-        blacklist_names |= load_syscall_names_from_file(f, arch)
+      if "blocklist" in f.lower():
+        blocklist_names |= load_syscall_names_from_file(f, arch)
       else:
-        whitelist_names |= load_syscall_names_from_file(f, arch)
+        allowlist_names |= load_syscall_names_from_file(f, arch)
     priorities = []
     if priority_file:
       priorities = load_syscall_priorities_from_file(priority_file)
 
     allowed_syscalls = []
-    for name in merge_names(base_names, whitelist_names, blacklist_names):
+    for name in merge_names(base_names, allowlist_names, blocklist_names):
       try:
         allowed_syscalls.append((name, syscall_NRs[arch][name]))
       except:
@@ -274,8 +274,8 @@
                       help=("The path of the input files. In order to "
                             "simplify the build rules, it can take any of the "
                             "following files: \n"
-                            "* /blacklist.*\.txt$/ syscall blacklist.\n"
-                            "* /whitelist.*\.txt$/ syscall whitelist.\n"
+                            "* /blocklist.*\.txt$/ syscall blocklist.\n"
+                            "* /allowlist.*\.txt$/ syscall allowlist.\n"
                             "* /priority.txt$/ priorities for bpf rules.\n"
                             "* otherwise, syscall name-number mapping.\n"))
   args = parser.parse_args()
diff --git a/libc/tools/pylintrc b/libc/tools/pylintrc
index 2481b12..dd7dbf6 100644
--- a/libc/tools/pylintrc
+++ b/libc/tools/pylintrc
@@ -10,7 +10,7 @@
 # Profiled execution.
 profile=no
 
-# Add files or directories to the blacklist. They should be base names, not
+# Add files or directories to the ignore list. They should be base names, not
 # paths.
 ignore=CVS
 
diff --git a/libc/tools/test_genseccomp.py b/libc/tools/test_genseccomp.py
index 0c2699a..812218e 100755
--- a/libc/tools/test_genseccomp.py
+++ b/libc/tools/test_genseccomp.py
@@ -29,20 +29,20 @@
 int         fchown:fchown(int, uid_t, gid_t)    arm64,x86_64
     """))
 
-    whitelist = cStringIO.StringIO(textwrap.dedent("""\
+    allowlist = cStringIO.StringIO(textwrap.dedent("""\
 ssize_t     read(int, void*, size_t)        all
     """))
 
     empty = cStringIO.StringIO(textwrap.dedent("""\
     """))
 
-    names = genseccomp.get_names([bionic, whitelist, empty], "arm")
+    names = genseccomp.get_names([bionic, allowlist, empty], "arm")
     bionic.seek(0)
-    whitelist.seek(0)
+    allowlist.seek(0)
     empty.seek(0)
-    names64 = genseccomp.get_names([bionic, whitelist, empty], "arm64")
+    names64 = genseccomp.get_names([bionic, allowlist, empty], "arm64")
     bionic.seek(0)
-    whitelist.seek(0)
+    allowlist.seek(0)
     empty.seek(0)
 
     self.assertIn("fchown", names64)
@@ -52,45 +52,45 @@
     self.assertIn("read", names)
     self.assertIn("read", names64)
 
-    # Blacklist item must be in bionic
-    blacklist = cStringIO.StringIO(textwrap.dedent("""\
+    # Blocklist item must be in bionic
+    blocklist = cStringIO.StringIO(textwrap.dedent("""\
 int         fchown2:fchown2(int, uid_t, gid_t)    arm64,x86_64
     """))
     with self.assertRaises(RuntimeError):
-      genseccomp.get_names([bionic, whitelist, blacklist], "arm")
+      genseccomp.get_names([bionic, allowlist, blocklist], "arm")
     bionic.seek(0)
-    whitelist.seek(0)
-    blacklist.seek(0)
+    allowlist.seek(0)
+    blocklist.seek(0)
 
-    # Test blacklist item is removed
-    blacklist = cStringIO.StringIO(textwrap.dedent("""\
+    # Test blocklist item is removed
+    blocklist = cStringIO.StringIO(textwrap.dedent("""\
 int         fchown:fchown(int, uid_t, gid_t)    arm64,x86_64
     """))
-    names = genseccomp.get_names([bionic, whitelist, blacklist], "arm64")
+    names = genseccomp.get_names([bionic, allowlist, blocklist], "arm64")
     bionic.seek(0)
-    whitelist.seek(0)
-    blacklist.seek(0)
+    allowlist.seek(0)
+    blocklist.seek(0)
     self.assertIn("read", names)
     self.assertNotIn("fchown", names)
 
-    # Blacklist item must not be in whitelist
-    whitelist = cStringIO.StringIO(textwrap.dedent("""\
+    # Blocklist item must not be in allowlist
+    allowlist = cStringIO.StringIO(textwrap.dedent("""\
 int         fchown:fchown(int, uid_t, gid_t)    arm64,x86_64
     """))
     with self.assertRaises(RuntimeError):
-      genseccomp.get_names([empty, whitelist, blacklist], "arm")
+      genseccomp.get_names([empty, allowlist, blocklist], "arm")
     empty.seek(0)
-    whitelist.seek(0)
-    blacklist.seek(0)
+    allowlist.seek(0)
+    blocklist.seek(0)
 
-    # No dups in bionic and whitelist
-    whitelist = cStringIO.StringIO(textwrap.dedent("""\
+    # No dups in bionic and allowlist
+    allowlist = cStringIO.StringIO(textwrap.dedent("""\
 int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
     """))
     with self.assertRaises(RuntimeError):
-      genseccomp.get_names([bionic, whitelist, empty], "arm")
+      genseccomp.get_names([bionic, allowlist, empty], "arm")
     bionic.seek(0)
-    whitelist.seek(0)
+    allowlist.seek(0)
     empty.seek(0)
 
   def test_convert_names_to_NRs(self):
@@ -186,14 +186,14 @@
     int         fchown:fchown(int, uid_t, gid_t)    arm64,x86_64
     """))
 
-    whitelist = cStringIO.StringIO(textwrap.dedent("""\
+    allowlist = cStringIO.StringIO(textwrap.dedent("""\
     ssize_t     read(int, void*, size_t)        all
     """))
 
-    blacklist = cStringIO.StringIO(textwrap.dedent("""\
+    blocklist = cStringIO.StringIO(textwrap.dedent("""\
     """))
 
-    syscall_files = [syscalls, whitelist, blacklist]
+    syscall_files = [syscalls, allowlist, blocklist]
     output = genseccomp.construct_bpf(syscall_files, "arm", self.get_headers("arm"),
                                       self.get_switches("arm"))
 
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index 6d84303..182fa89 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -105,12 +105,18 @@
   int32_t unused; // Was raw GMT offset; always 0 since tzdata2014f (L).
 };
 
+// Returns -2 for a soft failure (where the caller should try another file),
+// -1 for a hard failure (where the caller should give up), and >= 0 is a
+// file descriptor whose offset points to the data for the given olson id in
+// the given file (and *entry_length is the size of the data).
 static int __bionic_open_tzdata_path(const char* path,
                                      const char* olson_id,
                                      int32_t* entry_length) {
   int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC));
   if (fd == -1) {
-    return -2; // Distinguish failure to find any data from failure to find a specific id.
+    // We don't log here, because this is quite common --- current devices
+    // aren't expected to have the old APK tzdata, for example.
+    return -2;
   }
 
   bionic_tzdata_header_t header = {};
@@ -119,49 +125,49 @@
     fprintf(stderr, "%s: could not read header of \"%s\": %s\n",
             __FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read");
     close(fd);
-    return -1;
+    return -2;
   }
 
   if (strncmp(header.tzdata_version, "tzdata", 6) != 0 || header.tzdata_version[11] != 0) {
     fprintf(stderr, "%s: bad magic in \"%s\": \"%.6s\"\n", __FUNCTION__, path, header.tzdata_version);
     close(fd);
-    return -1;
+    return -2;
   }
 
   if (TEMP_FAILURE_RETRY(lseek(fd, ntohl(header.index_offset), SEEK_SET)) == -1) {
     fprintf(stderr, "%s: couldn't seek to index in \"%s\": %s\n", __FUNCTION__, path, strerror(errno));
     close(fd);
-    return -1;
+    return -2;
   }
 
   if (ntohl(header.index_offset) > ntohl(header.data_offset)) {
     fprintf(stderr, "%s: invalid data and index offsets in \"%s\": %u %u\n",
             __FUNCTION__, path, ntohl(header.data_offset), ntohl(header.index_offset));
     close(fd);
-    return -1;
+    return -2;
   }
   const size_t index_size = ntohl(header.data_offset) - ntohl(header.index_offset);
   if ((index_size % sizeof(index_entry_t)) != 0) {
     fprintf(stderr, "%s: invalid index size in \"%s\": %zd\n", __FUNCTION__, path, index_size);
     close(fd);
-    return -1;
+    return -2;
   }
 
-  off_t specific_zone_offset = -1;
   char* index = reinterpret_cast<char*>(malloc(index_size));
   if (index == nullptr) {
     fprintf(stderr, "%s: couldn't allocate %zd-byte index for \"%s\"\n", __FUNCTION__, index_size, path);
     close(fd);
-    return -1;
+    return -2;
   }
   if (TEMP_FAILURE_RETRY(read(fd, index, index_size)) != static_cast<ssize_t>(index_size)) {
     fprintf(stderr, "%s: could not read index of \"%s\": %s\n",
             __FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read");
     free(index);
     close(fd);
-    return -1;
+    return -2;
   }
 
+  off_t specific_zone_offset = -1;
   size_t id_count = index_size / sizeof(index_entry_t);
   index_entry_t* entry = reinterpret_cast<index_entry_t*>(index);
   for (size_t i = 0; i < id_count; ++i) {
@@ -180,6 +186,9 @@
   free(index);
 
   if (specific_zone_offset == -1) {
+    // We found a valid tzdata file, but didn't find the requested id in it.
+    // Give up now, and don't try fallback tzdata files. We don't log here
+    // because for all we know the given olson id was nonsense.
     close(fd);
     return -1;
   }
@@ -188,11 +197,9 @@
     fprintf(stderr, "%s: could not seek to %ld in \"%s\": %s\n",
             __FUNCTION__, specific_zone_offset, path, strerror(errno));
     close(fd);
-    return -1;
+    return -2;
   }
 
-  // TODO: check that there's TZ_MAGIC at this offset, so we can fall back to the other file if not.
-
   return fd;
 }
 
@@ -204,8 +211,9 @@
   //    tried first because it allows us to test that the time zone updates
   //    via APK mechanism still works even on devices with the time zone
   //    module.
+  //    TODO: remove this when those devices are no longer supported.
   // 2: The time zone data module which contains the main copy. This is the
-  //    common case.
+  //    common case for current devices.
   // 3: The ultimate fallback: the non-updatable copy in /system.
 
 #if defined(__ANDROID__)
@@ -214,15 +222,15 @@
 
   fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
                                  olson_id, entry_length);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 
   fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
                                  olson_id, entry_length);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 
   fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
                                  olson_id, entry_length);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 #else
   // On the host, we don't expect the hard-coded locations above to exist, and
   // we're not worried about security so we trust $ANDROID_DATA,
@@ -232,17 +240,17 @@
   char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
   fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
   free(path);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 
   path = make_path("ANDROID_TZDATA_ROOT", "/etc/tz/tzdata");
   fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
   free(path);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 
   path = make_path("ANDROID_ROOT", "/usr/share/zoneinfo/tzdata");
   fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
   free(path);
-  if (fd >= 0) return fd;
+  if (fd >= -1) return fd;
 #endif
 
   // Not finding any tzdata is more serious that not finding a specific zone,
@@ -253,5 +261,6 @@
     fprintf(stderr, "%s: couldn't find any tzdata when looking for %s!\n", __FUNCTION__, olson_id);
   }
 
+  // Otherwise we were successful.
   return fd;
 }
diff --git a/libc/upstream-openbsd/android/include/arc4random.h b/libc/upstream-openbsd/android/include/arc4random.h
index 5f0b15e..96f94be 100644
--- a/libc/upstream-openbsd/android/include/arc4random.h
+++ b/libc/upstream-openbsd/android/include/arc4random.h
@@ -36,14 +36,6 @@
 //#define _ARC4_LOCK()   pthread_mutex_lock(&arc4random_mtx)
 //#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
 
-#ifdef __GLIBC__
-extern void *__dso_handle;
-extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
-#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
-#else
-#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
-#endif
-
 static inline void _getentropy_fail(void) {
     async_safe_fatal("getentropy failed: %s", strerror(errno));
 }
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index 878f71c..8206269 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -38,6 +38,8 @@
 /* Ignore all __warn_references in OpenBSD. */
 #define __warn_references(sym,msg)
 
+#define PROTO_NORMAL(x)
+
 /* OpenBSD's <ctype.h> uses these names, which conflicted with stlport.
  * Additionally, we changed the numeric/digit type from N to D for libcxx.
  */
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
index 9e1cea0..8d621b0 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
@@ -112,7 +112,18 @@
 extern float  strtof ANSI((CONST char *, char **));
 extern double strtod ANSI((CONST char *, char **));
 extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
+char	*__hdtoa(double, const char *, int, int *, int *, char **);
+char	*__hldtoa(long double, const char *, int, int *, int *, char **);
+char	*__ldtoa(long double *, int, int, int *, int *, char **);
 
+PROTO_NORMAL(__dtoa);
+PROTO_NORMAL(__gdtoa);
+PROTO_NORMAL(__freedtoa);
+PROTO_NORMAL(__hdtoa);
+PROTO_NORMAL(__hldtoa);
+PROTO_NORMAL(__ldtoa);
+
+__BEGIN_HIDDEN_DECLS
 extern char*	__g_ddfmt  ANSI((char*, double*, int, size_t));
 extern char*	__g_dfmt   ANSI((char*, double*, int, size_t));
 extern char*	__g_ffmt   ANSI((char*, float*,  int, size_t));
@@ -148,6 +159,7 @@
 #define __strtopx(s,se,x) strtorx(s,se,1,x)
 #define __strtopxL(s,se,x) strtorxL(s,se,1,x)
 #endif
+__END_HIDDEN_DECLS
 
 #ifdef __cplusplus
 }
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
index 0f3de12..823f2a9 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
@@ -463,7 +463,6 @@
 #define FREE_DTOA_LOCK(n)	/*nothing*/
 #else
 #include "thread_private.h"
-extern void *__dtoa_locks[];
 #define ACQUIRE_DTOA_LOCK(n)	_MUTEX_LOCK(&__dtoa_locks[n])
 #define FREE_DTOA_LOCK(n)	_MUTEX_UNLOCK(&__dtoa_locks[n])
 #endif
@@ -567,6 +566,7 @@
 #define trailz __trailz_D2A
 #define ulp __ulp_D2A
 
+__BEGIN_HIDDEN_DECLS
  extern char *dtoa_result;
  extern CONST double bigtens[], tens[], tinytens[];
  extern unsigned char hexdig[];
@@ -586,8 +586,6 @@
  extern Bigint *d2b ANSI((double, int*, int*));
  extern void decrement ANSI((Bigint*));
  extern Bigint *diff ANSI((Bigint*, Bigint*));
- extern char *dtoa ANSI((double d, int mode, int ndigits,
-			int *decpt, int *sign, char **rve));
  extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
  extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
  extern void __hexdig_init_D2A(Void);
@@ -610,10 +608,10 @@
  extern Bigint *set_ones ANSI((Bigint*, int));
  extern char *strcp ANSI((char*, const char*));
  extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
- extern double strtod ANSI((const char *s00, char **se));
  extern Bigint *sum ANSI((Bigint*, Bigint*));
  extern int trailz ANSI((Bigint*));
  extern double ulp ANSI((U*));
+__END_HIDDEN_DECLS
 
 #ifdef __cplusplus
 }
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c b/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
index f521f15..d48c9ed 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
@@ -57,11 +57,8 @@
 	static unsigned char *decimalpoint_cache;
 	if (!(s0 = decimalpoint_cache)) {
 		s0 = (unsigned char*)localeconv()->decimal_point;
-		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-			strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
-			s0 = decimalpoint_cache;
-			}
-		}
+		decimalpoint_cache = strdup(s0);
+	}
 	decimalpoint = s0;
 #endif
 #endif
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c b/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
index 45caef4..4a7f798 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: hdtoa.c,v 1.3 2015/09/14 12:49:33 guenther Exp $	*/
+/*	$OpenBSD: hdtoa.c,v 1.5 2020/05/31 12:27:19 mortimer Exp $	*/
 /*-
  * Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.ORG>
  * All rights reserved.
@@ -112,7 +112,7 @@
  *
  * Note that the C99 standard does not specify what the leading digit
  * should be for non-zero numbers.  For instance, 0x1.3p3 is the same
- * as 0x2.6p2 is the same as 0x4.cp3.  This implementation chooses the
+ * as 0x2.6p2 is the same as 0x4.cp1.  This implementation chooses the
  * first digit so that subsequent digits are aligned on nibble
  * boundaries (before rounding).
  *
@@ -225,6 +225,7 @@
 	struct ieee_ext *p = (struct ieee_ext *)&e;
 	char *s, *s0;
 	int bufsize;
+	int fbits = 0;
 
 	*sign = p->ext_sign;
 
@@ -273,23 +274,24 @@
 	 */
 	for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
 		*s = 0;
-	for (; s > s0 + sigfigs - (EXT_FRACLBITS / 4) - 1 && s > s0; s--) {
+
+	for (fbits = EXT_FRACLBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
 		*s = p->ext_fracl & 0xf;
 		p->ext_fracl >>= 4;
 	}
-#ifdef EXT_FRACHMBITS
-	for (; s > s0; s--) {
-		*s = p->ext_frachm & 0xf;
-		p->ext_frachm >>= 4;
-	}
-#endif
 #ifdef EXT_FRACLMBITS
-	for (; s > s0; s--) {
+	for (fbits = EXT_FRACLMBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
 		*s = p->ext_fraclm & 0xf;
 		p->ext_fraclm >>= 4;
 	}
 #endif
-	for (; s > s0; s--) {
+#ifdef EXT_FRACHMBITS
+	for (fbits = EXT_FRACHMBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
+		*s = p->ext_frachm & 0xf;
+		p->ext_frachm >>= 4;
+	}
+#endif
+	for (fbits = EXT_FRACHBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
 		*s = p->ext_frach & 0xf;
 		p->ext_frach >>= 4;
 	}
@@ -300,7 +302,7 @@
 	 * (partial) nibble, which is dealt with by the next
 	 * statement.  We also tack on the implicit normalization bit.
 	 */
-	*s = p->ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4));
+	*s = (p->ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4))) & 0xf;
 
 	/* If ndigits < 0, we are expected to auto-size the precision. */
 	if (ndigits < 0) {
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
index b149f07..79a3104 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
@@ -40,6 +40,10 @@
 static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
 #endif
 
+#ifdef MULTIPLE_THREADS
+extern void *__dtoa_locks[];
+#endif
+
  Bigint *
 Balloc
 #ifdef KR_headers
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c b/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
index ac2283c..0fb37fd 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
@@ -114,10 +114,7 @@
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
 		s0 = localeconv()->decimal_point;
-		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-			strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
-			s0 = decimalpoint_cache;
-			}
+		decimalpoint_cache = strdup(s0);
 		dplen = strlen(s0);
 		}
 	decimalpoint = (char*)s0;
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c b/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
index 753f6bf..defb474 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
@@ -363,10 +363,7 @@
 	static int dplen;
 	if (!(s0 = decimalpoint_cache)) {
 		s0 = localeconv()->decimal_point;
-		if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
-			strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
-			s0 = decimalpoint_cache;
-			}
+		decimalpoint_cache = strdup(s0);
 		dplen = strlen(s0);
 		}
 	decimalpoint = (char*)s0;
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 8e3a3fc..6a3a82e 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -25,6 +25,8 @@
 
     stl: "none",
     system_shared_libs: [],
+    header_libs: ["libc_headers"],
+    export_header_lib_headers: ["libc_headers"],
 
     sanitize: {
         never: true,
@@ -97,6 +99,7 @@
 
     nocrt: true,
     system_shared_libs: [],
+    header_libs: ["libc_headers"],
 
     // Opt out of native_coverage when opting out of system_shared_libs
     native_coverage: false,
@@ -175,6 +178,7 @@
 
     nocrt: true,
     system_shared_libs: [],
+    header_libs: ["libc_headers"],
 
     // Opt out of native_coverage when opting out of system_shared_libs
     native_coverage: false,
diff --git a/libfdtrack/fdtrack.cpp b/libfdtrack/fdtrack.cpp
index d371577..898bc43 100644
--- a/libfdtrack/fdtrack.cpp
+++ b/libfdtrack/fdtrack.cpp
@@ -57,7 +57,10 @@
 
 // Backtraces for the first 4k file descriptors ought to be enough to diagnose an fd leak.
 static constexpr size_t kFdTableSize = 4096;
-static constexpr size_t kStackDepth = 10;
+
+// 32 frames, plus two to skip from fdtrack itself.
+static constexpr size_t kStackDepth = 34;
+static constexpr size_t kStackFrameSkip = 2;
 
 static bool installed = false;
 static std::array<FdEntry, kFdTableSize> stack_traces [[clang::no_destroy]];
@@ -134,15 +137,14 @@
       continue;
     }
 
-    constexpr size_t frame_skip = 2;
-    for (size_t i = frame_skip; i < entry->backtrace.size(); ++i) {
-      size_t j = i - frame_skip;
+    for (size_t i = kStackFrameSkip; i < entry->backtrace.size(); ++i) {
+      size_t j = i - kStackFrameSkip;
       function_names[j] = entry->backtrace[i].function_name.c_str();
       function_offsets[j] = entry->backtrace[i].function_offset;
     }
 
-    bool should_continue =
-        callback(fd, function_names, function_offsets, entry->backtrace.size() - frame_skip, arg);
+    bool should_continue = callback(fd, function_names, function_offsets,
+                                    entry->backtrace.size() - kStackFrameSkip, arg);
 
     entry->mutex.unlock();
 
diff --git a/linker/Android.bp b/linker/Android.bp
index f75088d..08b2c7b 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -46,6 +46,8 @@
 
     prefix_symbols: "__dlwrap_",
 
+    header_libs: ["libc_headers"],
+
     // We need to access Bionic private headers in the linker.
     include_dirs: ["bionic/libc"],
 }
@@ -408,6 +410,7 @@
 
     nocrt: true,
     system_shared_libs: [],
+    header_libs: ["libc_headers"],
 
     // Opt out of native_coverage when opting out of system_shared_libs
     native_coverage: false,
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f241677..10608f4 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -498,10 +498,10 @@
 
   static deleter_t deleter;
 
-  static LoadTask* create(const char* name,
-                          soinfo* needed_by,
-                          android_namespace_t* start_from,
-                          std::unordered_map<const soinfo*, ElfReader>* readers_map) {
+  // needed_by is NULL iff dlopen is called from memory that isn't part of any known soinfo.
+  static LoadTask* create(const char* _Nonnull name, soinfo* _Nullable needed_by,
+                          android_namespace_t* _Nonnull start_from,
+                          std::unordered_map<const soinfo*, ElfReader>* _Nonnull readers_map) {
     LoadTask* ptr = TypeBasedAllocator<LoadTask>::alloc();
     return new (ptr) LoadTask(name, needed_by, start_from, readers_map);
   }
@@ -563,6 +563,11 @@
     return start_from_;
   }
 
+  void remove_cached_elf_reader() {
+    CHECK(si_ != nullptr);
+    (*elf_readers_map_).erase(si_);
+  }
+
   const ElfReader& get_elf_reader() const {
     CHECK(si_ != nullptr);
     return (*elf_readers_map_)[si_];
@@ -1001,47 +1006,24 @@
 
   // If the name contains a slash, we should attempt to open it directly and not search the paths.
   if (strchr(name, '/') != nullptr) {
-    int fd = -1;
-
-    if (strstr(name, kZipFileSeparator) != nullptr) {
-      fd = open_library_in_zipfile(zip_archive_cache, name, file_offset, realpath);
-    }
-
-    if (fd == -1) {
-      fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CLOEXEC));
-      if (fd != -1) {
-        *file_offset = 0;
-        if (!realpath_fd(fd, realpath)) {
-          if (!is_first_stage_init()) {
-            PRINT("warning: unable to get realpath for the library \"%s\". Will use given path.",
-                  name);
-          }
-          *realpath = name;
-        }
-      }
-    }
-
-    return fd;
+    return open_library_at_path(zip_archive_cache, name, file_offset, realpath);
   }
 
-  // Otherwise we try LD_LIBRARY_PATH first, and fall back to the default library path
+  // LD_LIBRARY_PATH has the highest priority. We don't have to check accessibility when searching
+  // the namespace's path lists, because anything found on a namespace path list should always be
+  // accessible.
   int fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_ld_library_paths(), realpath);
+
+  // Try the DT_RUNPATH, and verify that the library is accessible.
   if (fd == -1 && needed_by != nullptr) {
     fd = open_library_on_paths(zip_archive_cache, name, file_offset, needed_by->get_dt_runpath(), realpath);
-    // Check if the library is accessible
     if (fd != -1 && !ns->is_accessible(*realpath)) {
       close(fd);
       fd = -1;
     }
   }
 
-#if !defined(__ANDROID_APEX__)
-  if (fd == -1) {
-    std::vector<std::string> bootstrap_paths = { std::string(kSystemLibDir) + "/bootstrap" };
-    fd = open_library_on_paths(zip_archive_cache, name, file_offset, bootstrap_paths, realpath);
-  }
-#endif
-
+  // Finally search the namespace's main search path list.
   if (fd == -1) {
     fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_default_library_paths(), realpath);
   }
@@ -1243,16 +1225,14 @@
   }
 
   soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);
-  if (si == nullptr) {
-    return false;
-  }
 
   task->set_soinfo(si);
 
   // Read the ELF header and some of the segments.
   if (!task->read(realpath.c_str(), file_stat.st_size)) {
-    soinfo_free(si);
+    task->remove_cached_elf_reader();
     task->set_soinfo(nullptr);
+    soinfo_free(si);
     return false;
   }
 
@@ -1298,14 +1278,13 @@
   soinfo* needed_by = task->get_needed_by();
   const android_dlextinfo* extinfo = task->get_extinfo();
 
-  off64_t file_offset;
-  std::string realpath;
   if (extinfo != nullptr && (extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD) != 0) {
-    file_offset = 0;
+    off64_t file_offset = 0;
     if ((extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET) != 0) {
       file_offset = extinfo->library_fd_offset;
     }
 
+    std::string realpath;
     if (!realpath_fd(extinfo->library_fd, &realpath)) {
       if (!is_first_stage_init()) {
         PRINT(
@@ -1323,10 +1302,12 @@
 
   LD_LOG(kLogDlopen,
          "load_library(ns=%s, task=%s, flags=0x%x, search_linked_namespaces=%d): calling "
-         "open_library with realpath=%s",
-         ns->get_name(), name, rtld_flags, search_linked_namespaces, realpath.c_str());
+         "open_library",
+         ns->get_name(), name, rtld_flags, search_linked_namespaces);
 
   // Open the file.
+  off64_t file_offset;
+  std::string realpath;
   int fd = open_library(ns, zip_archive_cache, name, needed_by, &file_offset, &realpath);
   if (fd == -1) {
     if (task->is_dt_needed()) {
@@ -1437,11 +1418,11 @@
                                   LoadTask* task,
                                   ZipArchiveCache* zip_archive_cache,
                                   LoadTaskList* load_tasks,
-                                  int rtld_flags,
-                                  bool search_linked_namespaces) {
+                                  int rtld_flags) {
   soinfo* candidate;
 
-  if (find_loaded_library_by_soname(ns, task->get_name(), search_linked_namespaces, &candidate)) {
+  if (find_loaded_library_by_soname(ns, task->get_name(), true /* search_linked_namespaces */,
+                                    &candidate)) {
     LD_LOG(kLogDlopen,
            "find_library_internal(ns=%s, task=%s): Already loaded (by soname): %s",
            ns->get_name(), task->get_name(), candidate->get_realpath());
@@ -1454,7 +1435,8 @@
   TRACE("[ \"%s\" find_loaded_library_by_soname failed (*candidate=%s@%p). Trying harder... ]",
         task->get_name(), candidate == nullptr ? "n/a" : candidate->get_realpath(), candidate);
 
-  if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags, search_linked_namespaces)) {
+  if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags,
+                   true /* search_linked_namespaces */)) {
     return true;
   }
 
@@ -1469,39 +1451,33 @@
            ns->get_name(), task->get_name(), g_default_namespace.get_name());
     ns = &g_default_namespace;
     if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags,
-                     search_linked_namespaces)) {
+                     true /* search_linked_namespaces */)) {
       return true;
     }
   }
   // END OF WORKAROUND
 
-  if (search_linked_namespaces) {
-    // if a library was not found - look into linked namespaces
-    // preserve current dlerror in the case it fails.
-    DlErrorRestorer dlerror_restorer;
-    LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Trying %zu linked namespaces",
-           ns->get_name(), task->get_name(), ns->linked_namespaces().size());
-    for (auto& linked_namespace : ns->linked_namespaces()) {
-      if (find_library_in_linked_namespace(linked_namespace, task)) {
-        if (task->get_soinfo() == nullptr) {
-          // try to load the library - once namespace boundary is crossed
-          // we need to load a library within separate load_group
-          // to avoid using symbols from foreign namespace while.
-          //
-          // However, actual linking is deferred until when the global group
-          // is fully identified and is applied to all namespaces.
-          // Otherwise, the libs in the linked namespace won't get symbols from
-          // the global group.
-          if (load_library(linked_namespace.linked_namespace(), task, zip_archive_cache, load_tasks, rtld_flags, false)) {
-            LD_LOG(
-                kLogDlopen, "find_library_internal(ns=%s, task=%s): Found in linked namespace %s",
-                ns->get_name(), task->get_name(), linked_namespace.linked_namespace()->get_name());
-            return true;
-          }
-        } else {
-          // lib is already loaded
-          return true;
-        }
+  // if a library was not found - look into linked namespaces
+  // preserve current dlerror in the case it fails.
+  DlErrorRestorer dlerror_restorer;
+  LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Trying %zu linked namespaces",
+         ns->get_name(), task->get_name(), ns->linked_namespaces().size());
+  for (auto& linked_namespace : ns->linked_namespaces()) {
+    if (find_library_in_linked_namespace(linked_namespace, task)) {
+      // Library is already loaded.
+      if (task->get_soinfo() != nullptr) {
+        // n.b. This code path runs when find_library_in_linked_namespace found an already-loaded
+        // library by soname. That should only be possible with a greylist lookup, where we switch
+        // the namespace, because otherwise, find_library_in_linked_namespace is duplicating the
+        // soname scan done in this function's first call to find_loaded_library_by_soname.
+        return true;
+      }
+
+      if (load_library(linked_namespace.linked_namespace(), task, zip_archive_cache, load_tasks,
+                       rtld_flags, false /* search_linked_namespaces */)) {
+        LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Found in linked namespace %s",
+               ns->get_name(), task->get_name(), linked_namespace.linked_namespace()->get_name());
+        return true;
       }
     }
   }
@@ -1538,7 +1514,6 @@
                     int rtld_flags,
                     const android_dlextinfo* extinfo,
                     bool add_as_children,
-                    bool search_linked_namespaces,
                     std::vector<android_namespace_t*>* namespaces) {
   // Step 0: prepare.
   std::unordered_map<const soinfo*, ElfReader> readers_map;
@@ -1594,8 +1569,7 @@
                                task,
                                &zip_archive_cache,
                                &load_tasks,
-                               rtld_flags,
-                               search_linked_namespaces || is_dt_needed)) {
+                               rtld_flags)) {
       return false;
     }
 
@@ -1837,8 +1811,7 @@
                              0,
                              rtld_flags,
                              extinfo,
-                             false /* add_as_children */,
-                             true /* search_linked_namespaces */)) {
+                             false /* add_as_children */)) {
     if (si != nullptr) {
       soinfo_unload(si);
     }
@@ -2404,6 +2377,21 @@
   }
 }
 
+std::vector<std::string> fix_lib_paths(std::vector<std::string> paths) {
+  // For the bootstrap linker, insert /system/${LIB}/bootstrap in front of /system/${LIB} in any
+  // namespace search path. The bootstrap linker should prefer to use the bootstrap bionic libraries
+  // (e.g. libc.so).
+#if !defined(__ANDROID_APEX__)
+  for (size_t i = 0; i < paths.size(); ++i) {
+    if (paths[i] == kSystemLibDir) {
+      paths.insert(paths.begin() + i, std::string(kSystemLibDir) + "/bootstrap");
+      ++i;
+    }
+  }
+#endif
+  return paths;
+}
+
 android_namespace_t* create_namespace(const void* caller_addr,
                                       const char* name,
                                       const char* ld_library_path,
@@ -3259,9 +3247,8 @@
     // Fail if app is targeting M or above.
     int app_target_api_level = get_application_target_sdk_version();
     if (app_target_api_level >= 23) {
-      DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
-                     "bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
-                     "Enforced-for-API-level-23)", get_realpath());
+      DL_ERR_AND_LOG("\"%s\" has text relocations (%s#Text-Relocations-Enforced-for-API-level-23)",
+                     get_realpath(), kBionicChangesUrl);
       return false;
     }
     // Make segments writable to allow text relocations to work properly. We will later call
@@ -3385,6 +3372,22 @@
   return ld_config_file_vndk;
 }
 
+bool is_linker_config_expected(const char* executable_path) {
+  // Do not raise message from a host environment which is expected to miss generated linker
+  // configuration.
+#if !defined(__ANDROID__)
+  return false;
+#endif
+
+  if (strcmp(executable_path, "/system/bin/init") == 0) {
+    // Generated linker configuration can be missed from processes executed
+    // with init binary
+    return false;
+  }
+
+  return true;
+}
+
 static std::string get_ld_config_file_path(const char* executable_path) {
 #ifdef USE_LD_CONFIG_FILE
   // This is a debugging/testing only feature. Must not be available on
@@ -3411,10 +3414,11 @@
 
   if (file_exists(kLdGeneratedConfigFilePath)) {
     return kLdGeneratedConfigFilePath;
-  } else {
-    // TODO(b/146386369) : Adjust log level and add more condition to log only when necessary
-    INFO("Warning: failed to find generated linker configuration from \"%s\"",
-         kLdGeneratedConfigFilePath);
+  }
+
+  if (is_linker_config_expected(executable_path)) {
+    DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
+            kLdGeneratedConfigFilePath);
   }
 
   path = get_ld_config_file_vndk_path();
diff --git a/linker/linker.h b/linker/linker.h
index 2da1404..9b6af3b 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -71,6 +71,10 @@
   DISALLOW_COPY_AND_ASSIGN(VersionTracker);
 };
 
+static constexpr const char* kBionicChangesUrl =
+    "https://android.googlesource.com/platform/bionic/+/master/"
+    "android-changes-for-ndk-developers.md";
+
 soinfo* get_libdl_info(const soinfo& linker_si);
 
 soinfo* find_containing_library(const void* p);
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index 1e2f9a2..5b68b1d 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -27,12 +27,15 @@
  */
 
 #include "linker_block_allocator.h"
+
 #include <inttypes.h>
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
 #include <unistd.h>
 
+#include "linker_debug.h"
+
 static constexpr size_t kAllocateSize = PAGE_SIZE * 100;
 static_assert(kAllocateSize % PAGE_SIZE == 0, "Invalid kAllocateSize.");
 
@@ -88,16 +91,10 @@
   }
 
   LinkerBlockAllocatorPage* page = find_page(block);
-
-  if (page == nullptr) {
-    abort();
-  }
+  CHECK(page != nullptr);
 
   ssize_t offset = reinterpret_cast<uint8_t*>(block) - page->bytes;
-
-  if (offset % block_size_ != 0) {
-    abort();
-  }
+  CHECK((offset % block_size_) == 0);
 
   memset(block, 0, block_size_);
 
@@ -114,7 +111,7 @@
 void LinkerBlockAllocator::protect_all(int prot) {
   for (LinkerBlockAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
     if (mprotect(page, kAllocateSize, prot) == -1) {
-      abort();
+      async_safe_fatal("mprotect(%p, %zu, %d) failed: %m", page, kAllocateSize, prot);
     }
   }
 }
@@ -125,10 +122,7 @@
 
   LinkerBlockAllocatorPage* page = reinterpret_cast<LinkerBlockAllocatorPage*>(
       mmap(nullptr, kAllocateSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0));
-
-  if (page == MAP_FAILED) {
-    abort(); // oom
-  }
+  CHECK(page != MAP_FAILED);
 
   prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, page, kAllocateSize, "linker_alloc");
 
@@ -143,9 +137,7 @@
 }
 
 LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
-  if (block == nullptr) {
-    abort();
-  }
+  CHECK(block != nullptr);
 
   LinkerBlockAllocatorPage* page = page_list_;
   while (page != nullptr) {
@@ -157,7 +149,7 @@
     page = page->next;
   }
 
-  abort();
+  async_safe_fatal("couldn't find page for %p", block);
 }
 
 void LinkerBlockAllocator::purge() {
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index ada25a5..aaa3a03 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -325,7 +325,8 @@
           value = "," + value;
           (*properties)[name].append_value(std::move(value));
         } else if (android::base::EndsWith(name, ".paths") ||
-                   android::base::EndsWith(name, ".shared_libs")) {
+                   android::base::EndsWith(name, ".shared_libs") ||
+                   android::base::EndsWith(name, ".whitelisted")) {
           value = ":" + value;
           (*properties)[name].append_value(std::move(value));
         } else {
diff --git a/linker/linker_config_test.cpp b/linker/linker_config_test.cpp
index 4937056..3caa4d4 100644
--- a/linker/linker_config_test.cpp
+++ b/linker/linker_config_test.cpp
@@ -47,6 +47,7 @@
 #define ARCH_SUFFIX ""
 #endif
 
+// clang-format off
 static const char* config_str =
   "# comment \n"
   "dir.test = /data/local/tmp\n"
@@ -88,8 +89,10 @@
   "namespace.vndk_in_system.visible = true\n"
   "namespace.vndk_in_system.search.paths = /system/${LIB}\n"
   "namespace.vndk_in_system.permitted.paths = /system/${LIB}\n"
-  "namespace.vndk_in_system.whitelisted = libz.so:libyuv.so:libtinyxml2.so\n"
+  "namespace.vndk_in_system.whitelisted = libz.so:libyuv.so\n"
+  "namespace.vndk_in_system.whitelisted += libtinyxml2.so\n"
   "\n";
+// clang-format on
 
 static bool write_version(const std::string& path, uint32_t version) {
   std::string content = android::base::StringPrintf("%d", version);
diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp
index 42ea2b7..203e441 100644
--- a/linker/linker_debuggerd_android.cpp
+++ b/linker/linker_debuggerd_android.cpp
@@ -33,18 +33,27 @@
 
 #include "linker_gdb_support.h"
 
+#if defined(__ANDROID_APEX__)
+static debugger_process_info get_process_info() {
+  return {
+      .abort_msg = __libc_shared_globals()->abort_msg,
+      .fdsan_table = &__libc_shared_globals()->fd_table,
+      .gwp_asan_state = __libc_shared_globals()->gwp_asan_state,
+      .gwp_asan_metadata = __libc_shared_globals()->gwp_asan_metadata,
+      .scudo_stack_depot = __libc_shared_globals()->scudo_stack_depot,
+      .scudo_region_info = __libc_shared_globals()->scudo_region_info,
+  };
+}
+#endif
+
 void linker_debuggerd_init() {
+  // There may be a version mismatch between the bootstrap linker and the crash_dump in the APEX,
+  // so don't pass in any process info from the bootstrap linker.
   debuggerd_callbacks_t callbacks = {
-    .get_abort_message = []() {
-      return __libc_shared_globals()->abort_msg;
-    },
-    .post_dump = &notify_gdb_of_libraries,
-    .get_gwp_asan_state = []() {
-      return __libc_shared_globals()->gwp_asan_state;
-    },
-    .get_gwp_asan_metadata = []() {
-      return __libc_shared_globals()->gwp_asan_metadata;
-    },
+#if defined(__ANDROID_APEX__)
+      .get_process_info = get_process_info,
+#endif
+      .post_dump = notify_gdb_of_libraries,
   };
   debuggerd_init(&callbacks);
 }
diff --git a/linker/linker_globals.cpp b/linker/linker_globals.cpp
index bcc2a1e..31da02c 100644
--- a/linker/linker_globals.cpp
+++ b/linker/linker_globals.cpp
@@ -50,7 +50,7 @@
   return sizeof(__linker_dl_err_buf);
 }
 
-void DL_WARN_documented_change(int api_level, const char* doc_link, const char* fmt, ...) {
+void DL_WARN_documented_change(int api_level, const char* doc_fragment, const char* fmt, ...) {
   std::string result{"Warning: "};
 
   va_list ap;
@@ -60,8 +60,9 @@
 
   android::base::StringAppendF(&result,
                                " and will not work when the app moves to API level %d or later "
-                               "(https://android.googlesource.com/platform/bionic/+/master/%s) "
-                               "(allowing for now because this app's target API level is still %d)",
-                               api_level, doc_link, get_application_target_sdk_version());
+                               "(%s#%s) (allowing for now because this app's target API level is "
+                               "still %d)",
+                               api_level, kBionicChangesUrl, doc_fragment,
+                               get_application_target_sdk_version());
   DL_WARN("%s", result.c_str());
 }
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 98af54a..41bb4ba 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -460,7 +460,6 @@
                       RTLD_GLOBAL,
                       nullptr,
                       true /* add_as_children */,
-                      true /* search_linked_namespaces */,
                       &namespaces)) {
     __linker_cannot_link(g_argv[0]);
   } else if (needed_libraries_count == 0) {
diff --git a/linker/linker_main.h b/linker/linker_main.h
index 47d4bdb..724f43c 100644
--- a/linker/linker_main.h
+++ b/linker/linker_main.h
@@ -63,7 +63,6 @@
                     int rtld_flags,
                     const android_dlextinfo* extinfo,
                     bool add_as_children,
-                    bool search_linked_namespaces,
                     std::vector<android_namespace_t*>* namespaces = nullptr);
 
 void solist_add_soinfo(soinfo* si);
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index 9561bb4..6843ebc 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -34,6 +34,8 @@
 #include <vector>
 #include <unordered_set>
 
+std::vector<std::string> fix_lib_paths(std::vector<std::string> paths);
+
 struct android_namespace_t;
 
 struct android_namespace_link_t {
@@ -100,10 +102,10 @@
     return default_library_paths_;
   }
   void set_default_library_paths(std::vector<std::string>&& library_paths) {
-    default_library_paths_ = std::move(library_paths);
+    default_library_paths_ = fix_lib_paths(std::move(library_paths));
   }
   void set_default_library_paths(const std::vector<std::string>& library_paths) {
-    default_library_paths_ = library_paths;
+    default_library_paths_ = fix_lib_paths(library_paths);
   }
 
   const std::vector<std::string>& get_permitted_paths() const {
diff --git a/linker/linker_translate_path.cpp b/linker/linker_translate_path.cpp
index df7d0aa..4f3fdfb 100644
--- a/linker/linker_translate_path.cpp
+++ b/linker/linker_translate_path.cpp
@@ -31,13 +31,14 @@
 #include "linker_utils.h"
 
 #if defined(__LP64__)
-static const char* const kSystemLibDir        = "/system/lib64";
-static const char* const kI18nApexLibDir      = "/apex/com.android.i18n/lib64";
+#define APEX_LIB(apex, name) \
+  { "/system/lib64/" name, "/apex/" apex "/lib64/" name }
 #else
-static const char* const kSystemLibDir        = "/system/lib";
-static const char* const kI18nApexLibDir      = "/apex/com.android.i18n/lib";
+#define APEX_LIB(apex, name) \
+  { "/system/lib/" name, "/apex/" apex "/lib/" name }
 #endif
 
+
 // Workaround for dlopen(/system/lib(64)/<soname>) when .so is in /apex. http://b/121248172
 /**
  * Translate /system path to /apex path if needed
@@ -47,27 +48,22 @@
  * return true if translation is needed
  */
 bool translateSystemPathToApexPath(const char* name, std::string* out_name_to_apex) {
-  static const char* const kSystemToArtApexLibs[] = {
-      "libicuuc.so",
-      "libicui18n.so",
+  static constexpr const char* kPathTranslationQ[][2] = {
+      APEX_LIB("com.android.i18n", "libicui18n.so"),
+      APEX_LIB("com.android.i18n", "libicuuc.so")
   };
-  // New mapping for new apex should be added below
 
-  // Nothing to do if target sdk version is Q or above
-  if (get_application_target_sdk_version() >= 29) {
+  if (name == nullptr) {
     return false;
   }
 
-  // If the path isn't /system/lib, there's nothing to do.
-  if (name == nullptr || dirname(name) != kSystemLibDir) {
-    return false;
-  }
+  auto comparator = [name](auto p) { return strcmp(name, p[0]) == 0; };
 
-  const char* base_name = basename(name);
-
-  for (const char* soname : kSystemToArtApexLibs) {
-    if (strcmp(base_name, soname) == 0) {
-      *out_name_to_apex = std::string(kI18nApexLibDir) + "/" + base_name;
+  if (get_application_target_sdk_version() < __ANDROID_API_Q__) {
+    if (auto it =
+            std::find_if(std::begin(kPathTranslationQ), std::end(kPathTranslationQ), comparator);
+        it != std::end(kPathTranslationQ)) {
+      *out_name_to_apex = (*it)[1];
       return true;
     }
   }
diff --git a/tests/Android.bp b/tests/Android.bp
index 8b1eebc..598865b 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -22,6 +22,12 @@
         darwin: {
             enabled: false,
         },
+        android: {
+            header_libs: ["bionic_libc_platform_headers"],
+        },
+        linux_bionic: {
+            header_libs: ["bionic_libc_platform_headers"],
+        },
     },
     cflags: [
         "-fstack-protector-all",
@@ -38,17 +44,24 @@
         // For glibc.
         "-D__STDC_LIMIT_MACROS",
     ],
-    header_libs: ["bionic_libc_platform_headers"],
-    // Make the bionic tests implicitly test bionic's shadow call stack support.
+    // Ensure that the tests exercise shadow call stack support and
+    // the hint space PAC/BTI instructions.
     arch: {
         arm64: {
-           cflags: ["-fsanitize=shadow-call-stack"],
+            cflags: [
+                "-fsanitize=shadow-call-stack",
+                // Disable this option for now: see b/151372823
+                //"-mbranch-protection=standard",
+            ],
         },
     },
     stl: "libc++",
     sanitize: {
         address: false,
     },
+
+    // Use the bootstrap version of bionic because some tests call private APIs
+    // that aren't exposed by the APEX bionic stubs.
     bootstrap: true,
 
     product_variables: {
@@ -109,6 +122,7 @@
         "glob_test.cpp",
         "grp_pwd_test.cpp",
         "grp_pwd_file_test.cpp",
+        "heap_tagging_level_test.cpp",
         "iconv_test.cpp",
         "ifaddrs_test.cpp",
         "ifunc_test.cpp",
@@ -167,6 +181,7 @@
         "strings_nofortify_test.cpp",
         "strings_test.cpp",
         "sstream_test.cpp",
+        "sys_auxv_test.cpp",
         "sys_epoll_test.cpp",
         "sys_mman_test.cpp",
         "sys_msg_test.cpp",
@@ -222,9 +237,6 @@
                 "libprocinfo",
                 "libsystemproperties",
             ],
-            srcs: [
-                "tagged_pointers_test.cpp",
-            ],
         },
     },
 
@@ -773,17 +785,6 @@
 }
 
 cc_test {
-    name: "bionic-unit-tests-scudo",
-    defaults: [
-        "bionic_unit_tests_defaults",
-    ],
-
-    shared_libs: [
-        "libc_scudo",
-    ],
-}
-
-cc_test {
     name: "bionic-stress-tests",
     defaults: [
         "bionic_tests_defaults",
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 293c17b..1139e53 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -237,6 +237,24 @@
   ASSERT_TRUE(dlopen(nullptr, RTLD_NOW) != nullptr);
 }
 
+// Test system path translation for backward compatibility. http://b/130219528
+TEST(dlfcn, dlopen_system_libicuuc_android_api_level_28) {
+  android_set_application_target_sdk_version(28);
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) != nullptr);
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) != nullptr);
+}
+
+TEST(dlfcn, dlopen_system_libicuuc_android_api_level_29) {
+  android_set_application_target_sdk_version(29);
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) == nullptr);
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) == nullptr);
+}
+
+TEST(dlfcn, dlopen_system_libicuuc_android_api_level_current) {
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) == nullptr);
+  ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) == nullptr);
+}
+
 TEST(dlfcn, dlopen_from_zip_absolute_path) {
   const std::string lib_zip_path = "/libdlext_test_zip/libdlext_test_zip_zipaligned.zip";
   const std::string lib_path = GetTestlibRoot() + lib_zip_path;
diff --git a/tests/fdtrack_test.cpp b/tests/fdtrack_test.cpp
index 44aa033..fe9a61c 100644
--- a/tests/fdtrack_test.cpp
+++ b/tests/fdtrack_test.cpp
@@ -29,11 +29,13 @@
 
 #if defined(__BIONIC__)
 #include "platform/bionic/fdtrack.h"
+#include "platform/bionic/reserved_signals.h"
 #endif
 
 #include <vector>
 
 #include <android-base/cmsg.h>
+#include <android-base/logging.h>
 #include <android-base/unique_fd.h>
 
 using android::base::ReceiveFileDescriptors;
@@ -41,6 +43,18 @@
 using android::base::unique_fd;
 
 #if defined(__BIONIC__)
+void DumpEvent(std::vector<android_fdtrack_event>* events, size_t index) {
+  auto& event = (*events)[index];
+  if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
+    fprintf(stderr, "  event %zu: fd %d created by %s\n", index, event.fd,
+            event.data.create.function_name);
+  } else if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CLOSE) {
+    fprintf(stderr, "  event %zu: fd %d closed\n", index, event.fd);
+  } else {
+    errx(1, "unexpected fdtrack event type: %d", event.type);
+  }
+}
+
 std::vector<android_fdtrack_event> FdtrackRun(void (*func)()) {
   // Each bionic test is run in separate process, so we can safely use a static here.
   static std::vector<android_fdtrack_event> events;
@@ -48,6 +62,7 @@
 
   android_fdtrack_hook_t previous = nullptr;
   android_fdtrack_hook_t hook = [](android_fdtrack_event* event) {
+    raise(BIONIC_SIGNAL_DEBUGGER);
     events.push_back(*event);
   };
 
@@ -66,6 +81,30 @@
     errx(1, "failed to reset hook");
   }
 
+  // Filter out temporary fds created and closed as a result of the call.
+  // (e.g. accept creating a socket to tell netd about the newly accepted socket)
+  size_t i = 0;
+  while (i + 1 < events.size()) {
+    auto& event = events[i];
+    if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
+      for (size_t j = i + 1; j < events.size(); ++j) {
+        if (event.fd == events[j].fd) {
+          if (events[j].type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
+            fprintf(stderr, "error: multiple create events for the same fd:\n");
+            DumpEvent(&events, i);
+            DumpEvent(&events, j);
+            exit(1);
+          }
+
+          events.erase(events.begin() + j);
+          events.erase(events.begin() + i);
+          continue;
+        }
+      }
+    }
+    ++i;
+  }
+
   return std::move(events);
 }
 
@@ -146,15 +185,7 @@
       fprintf(stderr, "too many events received: expected %zu, got %zu:\n", expected_fds.size(), \
               events.size());                                                                    \
       for (size_t i = 0; i < events.size(); ++i) {                                               \
-        auto& event = events[i];                                                                 \
-        if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {                                   \
-          fprintf(stderr, "  event %zu: fd %d created by %s\n", i, event.fd,                     \
-                  event.data.create.function_name);                                              \
-        } else if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CLOSE) {                             \
-          fprintf(stderr, "  event %zu: fd %d closed\n", i, event.fd);                           \
-        } else {                                                                                 \
-          errx(1, "unexpected fdtrack event type: %d", event.type);                              \
-        }                                                                                        \
+        DumpEvent(&events, i);                                                                   \
       }                                                                                          \
       FAIL();                                                                                    \
       return;                                                                                    \
@@ -216,12 +247,11 @@
 
 FDTRACK_TEST(eventfd, eventfd(0, 0));
 
-#if 0
-// Why is this generating an extra socket/close event?
-FDTRACK_TEST(accept, ({
+#if defined(__BIONIC__)
+static int CreateListener() {
   android_fdtrack_set_enabled(false);
   int listener = socket(AF_INET, SOCK_STREAM, 0);
-  ASSERT_NE(-1, listener);
+  CHECK_NE(-1, listener);
 
   sockaddr_in addr = {
       .sin_family = AF_INET,
@@ -230,21 +260,23 @@
   };
   socklen_t addrlen = sizeof(addr);
 
-  ASSERT_NE(-1, bind(listener, reinterpret_cast<sockaddr*>(&addr), addrlen)) << strerror(errno);
-  ASSERT_NE(-1, getsockname(listener, reinterpret_cast<sockaddr*>(&addr), &addrlen));
-  ASSERT_EQ(static_cast<size_t>(addrlen), sizeof(addr));
-  ASSERT_NE(-1, listen(listener, 1));
+  CHECK_NE(-1, bind(listener, reinterpret_cast<sockaddr*>(&addr), addrlen)) << strerror(errno);
+  CHECK_NE(-1, getsockname(listener, reinterpret_cast<sockaddr*>(&addr), &addrlen));
+  CHECK_EQ(static_cast<size_t>(addrlen), sizeof(addr));
+  CHECK_NE(-1, listen(listener, 1));
 
   int connector = socket(AF_INET, SOCK_STREAM, 0);
-  ASSERT_NE(-1, connector);
-  ASSERT_NE(-1, connect(connector, reinterpret_cast<sockaddr*>(&addr), addrlen));
-
+  CHECK_NE(-1, connector);
+  CHECK_NE(-1, connect(connector, reinterpret_cast<sockaddr*>(&addr), addrlen));
   android_fdtrack_set_enabled(true);
-  int accepted = accept(listener, nullptr, nullptr);
-  accepted;
-}));
+
+  return listener;
+}
 #endif
 
+FDTRACK_TEST_NAME(accept, "accept4", accept(CreateListener(), nullptr, nullptr));
+FDTRACK_TEST(accept4, accept4(CreateListener(), nullptr, nullptr, 0));
+
 FDTRACK_TEST(recvmsg, ({
   android_fdtrack_set_enabled(false);
   int sockets[2];
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index cab7175..99117e4 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -409,8 +409,8 @@
   }
   expect_range(AID_ISOLATED_START, AID_ISOLATED_END);
 
-  // TODO(73062966): We still don't have a good way to create vendor AIDs in the system or other
-  // non-vendor partitions, therefore we keep this check disabled.
+  // Prior to R, we didn't have a mechanism to create vendor AIDs in the system or other non-vendor
+  // partitions, therefore we disabled the rest of these checks for older API levels.
   if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= 29) {
     return;
   }
@@ -466,14 +466,7 @@
       EXPECT_STREQ("/data", pwd->pw_dir) << "pwd->pw_uid: " << pwd->pw_uid;
     }
 
-    // TODO(b/27999086): fix this check with the OEM range
-    // If OEMs add their own AIDs to private/android_filesystem_config.h, this check will fail.
-    // Long term we want to create a better solution for OEMs adding AIDs, but we're not there
-    // yet, so therefore we do not check for uid's in the OEM range.
-    if (!(pwd->pw_uid >= 2900 && pwd->pw_uid <= 2999) &&
-        !(pwd->pw_uid >= 5000 && pwd->pw_uid <= 5999)) {
-      EXPECT_EQ(0U, uids.count(pwd->pw_uid)) << "pwd->pw_uid: " << pwd->pw_uid;
-    }
+    EXPECT_EQ(0U, uids.count(pwd->pw_uid)) << "pwd->pw_uid: " << pwd->pw_uid;
     uids.emplace(pwd->pw_uid);
   }
   endpwent();
@@ -816,14 +809,7 @@
     EXPECT_STREQ(grp->gr_name, grp->gr_mem[0]) << "grp->gr_gid: " << grp->gr_gid;
     EXPECT_TRUE(grp->gr_mem[1] == nullptr) << "grp->gr_gid: " << grp->gr_gid;
 
-    // TODO(b/27999086): fix this check with the OEM range
-    // If OEMs add their own AIDs to private/android_filesystem_config.h, this check will fail.
-    // Long term we want to create a better solution for OEMs adding AIDs, but we're not there
-    // yet, so therefore we do not check for gid's in the OEM range.
-    if (!(grp->gr_gid >= 2900 && grp->gr_gid <= 2999) &&
-        !(grp->gr_gid >= 5000 && grp->gr_gid <= 5999)) {
-      EXPECT_EQ(0U, gids.count(grp->gr_gid)) << "grp->gr_gid: " << grp->gr_gid;
-    }
+    EXPECT_EQ(0U, gids.count(grp->gr_gid)) << "grp->gr_gid: " << grp->gr_gid;
     gids.emplace(grp->gr_gid);
   }
   endgrent();
diff --git a/tests/gtest_globals.cpp b/tests/gtest_globals.cpp
index 607544a..4160237 100644
--- a/tests/gtest_globals.cpp
+++ b/tests/gtest_globals.cpp
@@ -29,7 +29,7 @@
 
   std::string out_path;
   if (!android::base::Realpath(path.c_str(), &out_path)) {
-    printf("Failed to get realpath for \"%s\"", path.c_str());
+    printf("Failed to get realpath for \"%s\"\n", path.c_str());
     abort();
   }
 
@@ -37,7 +37,7 @@
 
   std::string real_path;
   if (!android::base::Realpath(out_path, &real_path)) {
-    printf("\"%s\": does not exists", out_path.c_str());
+    printf("\"%s\": does not exists\n", out_path.c_str());
     abort();
   }
 
diff --git a/tests/gtest_globals_cts.cpp b/tests/gtest_globals_cts.cpp
index 8e67f29..78bb3ca 100644
--- a/tests/gtest_globals_cts.cpp
+++ b/tests/gtest_globals_cts.cpp
@@ -16,17 +16,6 @@
 
 #include "gtest_globals.h"
 
-#include <string>
-#include <vector>
-
-// Use the normal gtest format so that cts can parse the results.
-extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
-  static const char* initial_args[] = {"--gtest_format"};
-  *args = initial_args;
-  *num_args = 1;
-  return true;
-}
-
 std::string GetTestlibRoot() {
   return "/data/local/tmp/lib/bionic-loader-test-libs";
 }
diff --git a/tests/headers/posix/strings_h.c b/tests/headers/posix/strings_h.c
index 0a2fa84..2051c8b 100644
--- a/tests/headers/posix/strings_h.c
+++ b/tests/headers/posix/strings_h.c
@@ -32,6 +32,10 @@
 
 static void strings_h() {
   FUNCTION(ffs, int (*f)(int));
+#if !defined(__GLIBC__)
+  FUNCTION(ffsl, int (*f)(long));
+  FUNCTION(ffsll, int (*f)(long long));
+#endif
   FUNCTION(strcasecmp, int (*f)(const char*, const char*));
   FUNCTION(strcasecmp_l, int (*f)(const char*, const char*, locale_t));
   FUNCTION(strncasecmp, int (*f)(const char*, const char*, size_t));
diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp
new file mode 100644
index 0000000..05123fd
--- /dev/null
+++ b/tests/heap_tagging_level_test.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <sys/prctl.h>
+
+#if defined(__BIONIC__)
+#include "platform/bionic/malloc.h"
+#include "platform/bionic/mte.h"
+#include "utils.h"
+
+#include "SignalUtils.h"
+
+#include <bionic/malloc_tagged_pointers.h>
+
+static bool KernelSupportsTaggedPointers() {
+#ifdef __aarch64__
+  int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
+  return res >= 0 && res & PR_TAGGED_ADDR_ENABLE;
+#else
+  return false;
+#endif
+}
+
+static bool SetHeapTaggingLevel(HeapTaggingLevel level) {
+  return android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &level, sizeof(level));
+}
+#endif
+
+TEST(heap_tagging_level, tagged_pointer_dies) {
+#if defined(__BIONIC__)
+  if (!KernelSupportsTaggedPointers()) {
+    GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
+  }
+
+#ifdef __aarch64__
+  if (mte_supported()) {
+    GTEST_SKIP() << "Tagged pointers are not used on MTE hardware.";
+  }
+
+  void *x = malloc(1);
+
+  // Ensure that `x` has a pointer tag.
+  EXPECT_NE(reinterpret_cast<uintptr_t>(x) >> 56, 0u);
+
+  x = untag_address(x);
+  EXPECT_DEATH(free(x), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
+
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
+  EXPECT_DEATH(free(untag_address(malloc(1))), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
+
+  x = malloc(1);
+  void *y = malloc(1);
+  // Disable heap tagging.
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
+  // Ensure an older tagged pointer can still be freed.
+  free(x);
+  // Tag mismatch is not detected on old pointers.
+  free(untag_address(y));
+#endif // defined(__aarch64__)
+#else
+  GTEST_SKIP() << "bionic-only test";
+#endif // defined(__BIONIC__)
+}
+
+#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+template <int SiCode> void CheckSiCode(int, siginfo_t* info, void*) {
+  if (info->si_code != SiCode) {
+    _exit(2);
+  }
+  _exit(1);
+}
+
+static bool SetTagCheckingLevel(int level) {
+  int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
+  if (tagged_addr_ctrl < 0) {
+    return false;
+  }
+
+  tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | level;
+  return prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) == 0;
+}
+#endif
+
+TEST(heap_tagging_level, sync_async_bad_accesses_die) {
+#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+  if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE)) {
+    GTEST_SKIP() << "requires MTE support";
+  }
+
+  std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
+
+  // First, check that memory tagging is enabled and the default tag checking level is async.
+  // We assume that scudo is used on all MTE enabled hardware; scudo inserts a header with a
+  // mismatching tag before each allocation.
+  EXPECT_EXIT(
+      {
+        ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTEAERR>, SA_SIGINFO);
+        p[-1] = 42;
+      },
+      testing::ExitedWithCode(1), "");
+
+  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_SYNC));
+  EXPECT_EXIT(
+      {
+        ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTESERR>, SA_SIGINFO);
+        p[-1] = 42;
+      },
+      testing::ExitedWithCode(1), "");
+
+  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
+  volatile int oob ATTRIBUTE_UNUSED = p[-1];
+#endif
+}
+
+TEST(heap_tagging_level, none_pointers_untagged) {
+#if defined(__BIONIC__)
+#if defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
+#endif
+
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
+  std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
+  EXPECT_EQ(untag_address(p.get()), p.get());
+#else
+  GTEST_SKIP() << "bionic-only test";
+#endif
+}
+
+TEST(heap_tagging_level, tagging_level_transitions) {
+#if defined(__BIONIC__) && defined(__aarch64__)
+  if (!KernelSupportsTaggedPointers()) {
+    GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
+  }
+
+#if defined(ANDROID_EXPERIMENTAL_MTE)
+  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
+#endif
+
+  EXPECT_FALSE(SetHeapTaggingLevel(static_cast<HeapTaggingLevel>(12345)));
+
+  if (mte_supported()) {
+    // ASYNC -> ...
+    EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
+    EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
+    EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
+
+    // SYNC -> ...
+    EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
+    EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
+    EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
+  } else {
+    // TBI -> ...
+    EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
+    EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
+    EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
+  }
+
+  // TBI -> NONE on non-MTE, ASYNC -> NONE on MTE.
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
+
+  // NONE -> ...
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
+  EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
+  EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
+  EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
+#else
+  GTEST_SKIP() << "bionic/arm64 only";
+#endif
+}
+
+TEST(heap_tagging_level, tagging_level_transition_sync_none) {
+#if defined(__BIONIC__) && defined(__aarch64__)
+  // We can't test SYNC -> NONE in tagging_level_transitions because we can only make one transition
+  // to NONE (which we use to test ASYNC -> NONE), so we test it here separately.
+  if (!mte_supported()) {
+    GTEST_SKIP() << "requires MTE support";
+  }
+
+#if defined(ANDROID_EXPERIMENTAL_MTE)
+  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
+#endif
+
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
+  EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
+#else
+  GTEST_SKIP() << "bionic/arm64 only";
+#endif
+}
diff --git a/tests/ifunc_test.cpp b/tests/ifunc_test.cpp
index e69271f..e3c437e 100644
--- a/tests/ifunc_test.cpp
+++ b/tests/ifunc_test.cpp
@@ -44,7 +44,8 @@
 static uint64_t g_hwcap;
 static __ifunc_arg_t g_arg;
 
-extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg) {
+extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg)
+    __attribute__((no_sanitize("hwaddress"))) {
   g_hwcap = hwcap;
   g_arg = *arg;
   return ret42;
diff --git a/tests/leak_test.cpp b/tests/leak_test.cpp
index e0a3d57..4ebf41f 100644
--- a/tests/leak_test.cpp
+++ b/tests/leak_test.cpp
@@ -109,23 +109,21 @@
 
 // http://b/36045112
 TEST(pthread_leak, join) {
+  SKIP_WITH_NATIVE_BRIDGE;  // http://b/37920774
+
   LeakChecker lc;
 
-  for (size_t pass = 0; pass < 2; ++pass) {
-    for (int i = 0; i < 100; ++i) {
-      pthread_t thread;
-      ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
-      ASSERT_EQ(0, pthread_join(thread, nullptr));
-    }
-
-    // A native bridge implementation might need a warm up pass to reach a steady state.
-    // http://b/37920774.
-    if (pass == 0) lc.Reset();
+  for (int i = 0; i < 100; ++i) {
+    pthread_t thread;
+    ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
+    ASSERT_EQ(0, pthread_join(thread, nullptr));
   }
 }
 
 // http://b/36045112
 TEST(pthread_leak, detach) {
+  SKIP_WITH_NATIVE_BRIDGE;  // http://b/37920774
+
   LeakChecker lc;
 
   // Ancient devices with only 2 cores need a lower limit.
@@ -158,8 +156,7 @@
 
     WaitUntilAllThreadsExited(tids, thread_count);
 
-    // A native bridge implementation might need a warm up pass to reach a steady state.
-    // http://b/37920774.
+    // TODO(b/158573595): the test is flaky without the warmup pass.
     if (pass == 0) lc.Reset();
   }
 }
diff --git a/tests/libs/segment_gap_outer.cpp b/tests/libs/segment_gap_outer.cpp
index fb448e7..18aa3ee 100644
--- a/tests/libs/segment_gap_outer.cpp
+++ b/tests/libs/segment_gap_outer.cpp
@@ -1,6 +1,5 @@
 #include <android/dlext.h>
 #include <dlfcn.h>
-#include <jni.h>
 #include <stdlib.h>
 
 extern "C" void text_before_start_of_gap() {}
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 5944414..47a9033 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -1201,70 +1201,3 @@
   GTEST_SKIP() << "bionic extension";
 #endif
 }
-
-#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
-template <int SiCode> void CheckSiCode(int, siginfo_t* info, void*) {
-  if (info->si_code != SiCode) {
-    _exit(2);
-  }
-  _exit(1);
-}
-
-static bool SetTagCheckingLevel(int level) {
-  int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
-  if (tagged_addr_ctrl < 0) {
-    return false;
-  }
-
-  tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | level;
-  return prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) == 0;
-}
-#endif
-
-TEST(android_mallopt, tag_level) {
-#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
-  if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE)) {
-    GTEST_SKIP() << "requires MTE support";
-    return;
-  }
-
-  std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
-
-  // First, check that memory tagging is enabled and the default tag checking level is async.
-  // We assume that scudo is used on all MTE enabled hardware; scudo inserts a header with a
-  // mismatching tag before each allocation.
-  EXPECT_EXIT(
-      {
-        ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTEAERR>, SA_SIGINFO);
-        p[-1] = 42;
-      },
-      testing::ExitedWithCode(1), "");
-
-  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_SYNC));
-  EXPECT_EXIT(
-      {
-        ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTESERR>, SA_SIGINFO);
-        p[-1] = 42;
-      },
-      testing::ExitedWithCode(1), "");
-
-  EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
-  volatile int oob ATTRIBUTE_UNUSED = p[-1];
-
-  HeapTaggingLevel tag_level = M_HEAP_TAGGING_LEVEL_TBI;
-  EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-
-  tag_level = M_HEAP_TAGGING_LEVEL_NONE;
-  EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-  std::unique_ptr<int[]> p2 = std::make_unique<int[]>(4);
-  EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(p2.get()) >> 56);
-
-  tag_level = M_HEAP_TAGGING_LEVEL_ASYNC;
-  EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-
-  tag_level = M_HEAP_TAGGING_LEVEL_NONE;
-  EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-#else
-  GTEST_SKIP() << "arm64 only";
-#endif
-}
diff --git a/tests/mte_test.cpp b/tests/mte_test.cpp
index 8928805..f329d8d 100644
--- a/tests/mte_test.cpp
+++ b/tests/mte_test.cpp
@@ -14,10 +14,15 @@
  * limitations under the License.
  */
 
+#include <sys/cdefs.h>
+
+#if defined(__BIONIC__)
+
 #include <gtest/gtest.h>
 
 #include <android-base/macros.h>
 #include <bionic/mte.h>
+#include "utils.h"
 
 __attribute__((no_sanitize("hwaddress")))
 static void test_tag_mismatch() {
@@ -44,5 +49,12 @@
 }
 
 TEST(mte_test, ScopedDisableMTE) {
+  // With native_bridge, native and emulated parts exchange data, including pointers.
+  // This implies tagging on native and emulated architectures should match, which is
+  // not the case at the moment.
+  SKIP_WITH_NATIVE_BRIDGE;
+
   test_tag_mismatch();
 }
+
+#endif  // __BIONIC__
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index d825738..851b86f 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -2821,6 +2821,9 @@
 }
 
 TEST(pthread, pthread_create__mmap_failures) {
+  // After thread is successfully created, native_bridge might need more memory to run it.
+  SKIP_WITH_NATIVE_BRIDGE;
+
   pthread_attr_t attr;
   ASSERT_EQ(0, pthread_attr_init(&attr));
   ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index 3c66034..f465458 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -154,44 +154,6 @@
   raise(SIGALRM);
 }
 
-TEST(signal, sigwait_SIGALRM) {
-  ScopedSignalHandler ssh(SIGALRM, [](int sig) { ASSERT_EQ(SIGALRM, sig); });
-
-  sigset_t wait_set;
-  sigemptyset(&wait_set);
-  sigaddset(&wait_set, SIGALRM);
-
-  alarm(1);
-
-  int received_signal;
-  errno = 0;
-  ASSERT_EQ(0, sigwait(&wait_set, &received_signal));
-  ASSERT_EQ(0, errno);
-  ASSERT_EQ(SIGALRM, received_signal);
-}
-
-TEST(signal, sigwait64_SIGRTMIN) {
-  ScopedSignalHandler ssh(SIGRTMIN, [](int sig) { ASSERT_EQ(SIGRTMIN, sig); });
-
-  sigset64_t wait_set;
-  sigemptyset64(&wait_set);
-  sigaddset64(&wait_set, SIGRTMIN);
-
-  pid_t tid = gettid();
-  std::thread thread([&tid]() {
-    sleep(1);
-    tgkill(getpid(), tid, SIGRTMIN);
-  });
-
-  int received_signal;
-  errno = 0;
-  ASSERT_EQ(0, sigwait64(&wait_set, &received_signal));
-  ASSERT_EQ(0, errno);
-  ASSERT_EQ(SIGRTMIN, received_signal);
-
-  thread.join();
-}
-
 static int g_sigsuspend_signal_handler_call_count = 0;
 
 TEST(signal, sigsuspend_sigpending) {
@@ -620,8 +582,7 @@
 
 TEST(signal, sigqueue) {
   ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
-  sigval_t sigval;
-  sigval.sival_int = 1;
+  sigval_t sigval = {.sival_int = 1};
   errno = 0;
   ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
   ASSERT_EQ(0, errno);
@@ -630,8 +591,7 @@
 
 TEST(signal, pthread_sigqueue_self) {
   ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
-  sigval_t sigval;
-  sigval.sival_int = 1;
+  sigval_t sigval = {.sival_int = 1};
   errno = 0;
   ASSERT_EQ(0, pthread_sigqueue(pthread_self(), SIGALRM, sigval));
   ASSERT_EQ(0, errno);
@@ -640,8 +600,7 @@
 
 TEST(signal, pthread_sigqueue_other) {
   ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
-  sigval_t sigval;
-  sigval.sival_int = 1;
+  sigval_t sigval = {.sival_int = 1};
 
   sigset_t mask;
   sigfillset(&mask);
@@ -664,6 +623,44 @@
   ASSERT_EQ(1, g_sigqueue_signal_handler_call_count);
 }
 
+TEST(signal, sigwait_SIGALRM) {
+  SignalMaskRestorer smr;
+
+  // Block SIGALRM.
+  sigset_t just_SIGALRM;
+  sigemptyset(&just_SIGALRM);
+  sigaddset(&just_SIGALRM, SIGALRM);
+  ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, nullptr));
+
+  // Raise SIGALRM.
+  sigval_t sigval = {.sival_int = 1};
+  ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
+
+  // Get pending SIGALRM.
+  int sig;
+  ASSERT_EQ(0, sigwait(&just_SIGALRM, &sig));
+  ASSERT_EQ(SIGALRM, sig);
+}
+
+TEST(signal, sigwait64_SIGRTMIN) {
+  SignalMaskRestorer smr;
+
+  // Block SIGRTMIN.
+  sigset64_t just_SIGRTMIN;
+  sigemptyset64(&just_SIGRTMIN);
+  sigaddset64(&just_SIGRTMIN, SIGRTMIN);
+  ASSERT_EQ(0, sigprocmask64(SIG_BLOCK, &just_SIGRTMIN, nullptr));
+
+  // Raise SIGRTMIN.
+  sigval_t sigval = {.sival_int = 1};
+  ASSERT_EQ(0, sigqueue(getpid(), SIGRTMIN, sigval));
+
+  // Get pending SIGRTMIN.
+  int sig;
+  ASSERT_EQ(0, sigwait64(&just_SIGRTMIN, &sig));
+  ASSERT_EQ(SIGRTMIN, sig);
+}
+
 TEST(signal, sigwaitinfo) {
   SignalMaskRestorer smr;
 
@@ -674,8 +671,7 @@
   ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, nullptr));
 
   // Raise SIGALRM.
-  sigval_t sigval;
-  sigval.sival_int = 1;
+  sigval_t sigval = {.sival_int = 1};
   ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
 
   // Get pending SIGALRM.
@@ -697,8 +693,7 @@
   ASSERT_EQ(0, sigprocmask64(SIG_BLOCK, &just_SIGRTMIN, nullptr));
 
   // Raise SIGRTMIN.
-  sigval_t sigval;
-  sigval.sival_int = 1;
+  sigval_t sigval = {.sival_int = 1};
   ASSERT_EQ(0, sigqueue(getpid(), SIGRTMIN, sigval));
 
   // Get pending SIGRTMIN.
diff --git a/tests/stack_unwinding_test.cpp b/tests/stack_unwinding_test.cpp
index e620ecd..0ff6f30 100644
--- a/tests/stack_unwinding_test.cpp
+++ b/tests/stack_unwinding_test.cpp
@@ -112,10 +112,6 @@
 }
 
 TEST(stack_unwinding, unwind_through_signal_frame) {
-#if defined(__i386__)
-  GTEST_SKIP() << "Temporarily skip test since it fails on x86 see b/132763120.";
-#endif
-
   ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler);
 
   UnwindTest();
@@ -123,10 +119,6 @@
 
 // On LP32, the SA_SIGINFO flag gets you __restore_rt instead of __restore.
 TEST(stack_unwinding, unwind_through_signal_frame_SA_SIGINFO) {
-#if defined(__i386__)
-  GTEST_SKIP() << "Temporarily skip test since it fails on x86 see b/132763120.";
-#endif
-
   ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler, SA_SIGINFO);
 
   UnwindTest();
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 8a6b267..11d41b4 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -181,7 +181,7 @@
 
 // And a rudimentary test of acquire-release memory ordering:
 
-constexpr static uint_least32_t BIG = 10000000ul; // Assumed even below.
+constexpr static uint_least32_t BIG = 30'000'000ul; // Assumed even below.
 
 struct three_atomics {
   atomic_uint_least32_t x;
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 75abbd2..f6eca05 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -294,6 +294,34 @@
   EXPECT_STREQ("<0x1.3831e147ae148p+13>", buf);
 }
 
+// http://b/152588929
+TEST(STDIO_TEST, snprintf_La) {
+#if defined(__LP64__)
+  char buf[BUFSIZ];
+  union {
+    uint64_t a[2];
+    long double v;
+  } u;
+
+  u.a[0] = UINT64_C(0x9b9b9b9b9b9b9b9b);
+  u.a[1] = UINT64_C(0xdfdfdfdfdfdfdfdf);
+  EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v));
+  EXPECT_STREQ("<-0x1.dfdfdfdfdfdf9b9b9b9b9b9b9b9bp+8160>", buf);
+
+  u.a[0] = UINT64_C(0xffffffffffffffff);
+  u.a[1] = UINT64_C(0x7ffeffffffffffff);
+  EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v));
+  EXPECT_STREQ("<0x1.ffffffffffffffffffffffffffffp+16383>", buf);
+
+  u.a[0] = UINT64_C(0x0000000000000000);
+  u.a[1] = UINT64_C(0x0000000000000000);
+  EXPECT_EQ(8, snprintf(buf, sizeof(buf), "<%La>", u.v));
+  EXPECT_STREQ("<0x0p+0>", buf);
+#else
+  GTEST_SKIP() << "no ld128";
+#endif
+}
+
 TEST(STDIO_TEST, snprintf_lc) {
   char buf[BUFSIZ];
   wint_t wc = L'a';
diff --git a/tests/strings_test.cpp b/tests/strings_test.cpp
index ac327d4..0226d1a 100644
--- a/tests/strings_test.cpp
+++ b/tests/strings_test.cpp
@@ -38,6 +38,48 @@
   ASSERT_EQ(32, ffs(0x80000000));
 }
 
+TEST(STRINGS_TEST, ffsl) {
+  ASSERT_EQ( 0, ffsl(0x00000000L));
+  ASSERT_EQ( 1, ffsl(0x00000001L));
+  ASSERT_EQ( 6, ffsl(0x00000020L));
+  ASSERT_EQ(11, ffsl(0x00000400L));
+  ASSERT_EQ(16, ffsl(0x00008000L));
+  ASSERT_EQ(17, ffsl(0x00010000L));
+  ASSERT_EQ(22, ffsl(0x00200000L));
+  ASSERT_EQ(27, ffsl(0x04000000L));
+  ASSERT_EQ(32, ffsl(0x80000000L));
+#if defined(__LP64__)
+  ASSERT_EQ(33, ffsl(0x0000000100000000L));
+  ASSERT_EQ(38, ffsl(0x0000002000000000L));
+  ASSERT_EQ(43, ffsl(0x0000040000000000L));
+  ASSERT_EQ(48, ffsl(0x0000800000000000L));
+  ASSERT_EQ(49, ffsl(0x0001000000000000L));
+  ASSERT_EQ(54, ffsl(0x0020000000000000L));
+  ASSERT_EQ(59, ffsl(0x0400000000000000L));
+  ASSERT_EQ(64, ffsl(0x8000000000000000L));
+#endif
+}
+
+TEST(STRINGS_TEST, ffsll) {
+  ASSERT_EQ( 0, ffsll(0x0000000000000000LL));
+  ASSERT_EQ( 1, ffsll(0x0000000000000001LL));
+  ASSERT_EQ( 6, ffsll(0x0000000000000020LL));
+  ASSERT_EQ(11, ffsll(0x0000000000000400LL));
+  ASSERT_EQ(16, ffsll(0x0000000000008000LL));
+  ASSERT_EQ(17, ffsll(0x0000000000010000LL));
+  ASSERT_EQ(22, ffsll(0x0000000000200000LL));
+  ASSERT_EQ(27, ffsll(0x0000000004000000LL));
+  ASSERT_EQ(32, ffsll(0x0000000080000000LL));
+  ASSERT_EQ(33, ffsll(0x0000000100000000LL));
+  ASSERT_EQ(38, ffsll(0x0000002000000000LL));
+  ASSERT_EQ(43, ffsll(0x0000040000000000LL));
+  ASSERT_EQ(48, ffsll(0x0000800000000000LL));
+  ASSERT_EQ(49, ffsll(0x0001000000000000LL));
+  ASSERT_EQ(54, ffsll(0x0020000000000000LL));
+  ASSERT_EQ(59, ffsll(0x0400000000000000LL));
+  ASSERT_EQ(64, ffsll(0x8000000000000000LL));
+}
+
 TEST(STRINGS_TEST, strcasecmp) {
   ASSERT_EQ(0, strcasecmp("hello", "HELLO"));
   ASSERT_LT(strcasecmp("hello1", "hello2"), 0);
diff --git a/libc/include/android/legacy_strings_inlines.h b/tests/sys_auxv_test.cpp
similarity index 63%
rename from libc/include/android/legacy_strings_inlines.h
rename to tests/sys_auxv_test.cpp
index 2cc2da2..afd62ea 100644
--- a/libc/include/android/legacy_strings_inlines.h
+++ b/tests/sys_auxv_test.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2020 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,19 +26,32 @@
  * SUCH DAMAGE.
  */
 
-#pragma once
+#include <gtest/gtest.h>
 
-#include <sys/cdefs.h>
+#include <sys/auxv.h>
 
-#if defined(__i386__) && __ANDROID_API__ < 18
+TEST(sys_auxv, getauxval_HWCAP) {
+  __attribute__((__unused__)) unsigned long hwcap = getauxval(AT_HWCAP);
 
-#include <strings.h>
-
-__BEGIN_DECLS
-
-/* Everyone except x86 had ffs since the beginning. */
-static __inline int ffs(int __n) { return __builtin_ffs(__n); }
-
-__END_DECLS
-
+  // Check that the constants for *using* AT_HWCAP are also available.
+#if defined(__arm__)
+  ASSERT_NE(0, HWCAP_THUMB);
+#elif defined(__aarch64__)
+  ASSERT_NE(0, HWCAP_FP);
 #endif
+}
+
+TEST(sys_auxv, getauxval_HWCAP2) {
+#if defined(AT_HWCAP2)
+  __attribute__((__unused__)) unsigned long hwcap = getauxval(AT_HWCAP2);
+
+  // Check that the constants for *using* AT_HWCAP2 are also available.
+#if defined(__arm__)
+  ASSERT_NE(0, HWCAP2_AES);
+#elif defined(__aarch64__)
+  ASSERT_NE(0, HWCAP2_SVE2);
+#endif
+#else
+  GTEST_SKIP() << "No AT_HWCAP2 for this architecture.";
+#endif
+}
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index 71591c0..8f1437b 100644
--- a/tests/sys_stat_test.cpp
+++ b/tests/sys_stat_test.cpp
@@ -109,7 +109,6 @@
   int rc = statx(AT_FDCWD, "/proc/version", AT_STATX_SYNC_AS_STAT, STATX_ALL, &sx);
   if (rc == -1 && errno == ENOSYS) {
     GTEST_SKIP() << "statx returned ENOSYS";
-    return;
   }
   ASSERT_EQ(0, rc);
   struct stat64 sb;
diff --git a/tests/tagged_pointers_test.cpp b/tests/tagged_pointers_test.cpp
deleted file mode 100644
index 56d1037..0000000
--- a/tests/tagged_pointers_test.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include <sys/prctl.h>
-
-#include "platform/bionic/malloc.h"
-#include "platform/bionic/mte.h"
-#include "utils.h"
-
-#include <bionic/malloc_tagged_pointers.h>
-
-static bool KernelSupportsTaggedPointers() {
-#ifdef __aarch64__
-#define PR_SET_TAGGED_ADDR_CTRL 55
-#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
-  int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
-  return res >= 0 && res & PR_TAGGED_ADDR_ENABLE;
-#else
-  return false;
-#endif
-}
-
-TEST(tagged_pointers, check_tagged_pointer_dies) {
-  if (!KernelSupportsTaggedPointers()) {
-    GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
-  }
-
-#ifdef __aarch64__
-  if (mte_supported()) {
-    GTEST_SKIP() << "Tagged pointers are not used on MTE hardware.";
-  }
-
-  void *x = malloc(1);
-
-  // Ensure that `x` has a pointer tag.
-  EXPECT_NE(reinterpret_cast<uintptr_t>(x) >> 56, 0u);
-
-  x = untag_address(x);
-  EXPECT_DEATH(free(x), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
-
-  HeapTaggingLevel tag_level = M_HEAP_TAGGING_LEVEL_TBI;
-  EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-  EXPECT_DEATH(free(untag_address(malloc(1))), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
-
-  tag_level = M_HEAP_TAGGING_LEVEL_ASYNC;
-  EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-
-  x = malloc(1);
-  void *y = malloc(1);
-  // Disable heap tagging.
-  tag_level = M_HEAP_TAGGING_LEVEL_NONE;
-  EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-  // Ensure an older tagged pointer can still be freed.
-  free(x);
-  // Tag mismatch is not detected on old pointers.
-  free(untag_address(y));
-  // New pointers are not tagged.
-  x = malloc(1);
-  EXPECT_EQ(untag_address(x), x);
-  free(x);
-
-  // Switching back to checked mode is not possible.
-  tag_level = M_HEAP_TAGGING_LEVEL_TBI;
-  EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
-  // We remain in the unchecked mode.
-  x = malloc(1);
-  EXPECT_EQ(untag_address(x), x);
-  free(x);
-#endif // defined(__aarch64__)
-}
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 378b4ac..74d691d 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -1005,3 +1005,7 @@
   GTEST_SKIP() << "glibc doesn't have timespec_get until 2.21";
 #endif
 }
+
+TEST(time, difftime) {
+  ASSERT_EQ(1.0, difftime(1, 0));
+}
diff --git a/tests/utils.h b/tests/utils.h
index 5014ef7..c1b7f65 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -25,6 +25,16 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#if defined(__BIONIC__)
+#include <sys/system_properties.h>
+#endif
+
+#if defined(__BIONIC__)
+#include <bionic/macros.h>
+#else
+#define untag_address(p) p
+#endif
+
 #include <atomic>
 #include <string>
 #include <regex>
@@ -66,14 +76,21 @@
 
 #define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
 
-static inline void* untag_address(void* addr) {
-#if defined(__LP64__)
-  constexpr uintptr_t mask = (static_cast<uintptr_t>(1) << 56) - 1;
-  addr = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) & mask);
+static inline bool running_with_native_bridge() {
+#if defined(__BIONIC__)
+#if defined(__arm__)
+  static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm");
+  return pi != nullptr;
+#elif defined(__aarch64__)
+  static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa.arm64");
+  return pi != nullptr;
 #endif
-  return addr;
+#endif
+  return false;
 }
 
+#define SKIP_WITH_NATIVE_BRIDGE if (running_with_native_bridge()) GTEST_SKIP()
+
 #if defined(__linux__)
 
 #include <sys/sysmacros.h>
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index 3c6f643..b41c865 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -72,7 +72,7 @@
 
     // <math.h> maps fool onto foo on 32-bit, since long double is the same as double.
     if (auto asm_attr = decl->getAttr<AsmLabelAttr>()) {
-      return asm_attr->getLabel();
+      return asm_attr->getLabel().str();
     }
 
     // The decl might not have a name (e.g. bitfields).
@@ -84,7 +84,7 @@
         return mangled;
       }
 
-      return identifier->getName();
+      return identifier->getName().str();
     }
 
     return "<unnamed>";
@@ -173,7 +173,7 @@
               &arch_availability[Arch::x86_64].introduced } },
         };
 
-        if (auto it = prefix_map.find(fragments[0]); it != prefix_map.end()) {
+        if (auto it = prefix_map.find(fragments[0].str()); it != prefix_map.end()) {
           int value;
           if (fragments[1].getAsInteger(10, value)) {
             errx(1, "invalid __ANDROID_AVAILABILITY_DUMP__ annotation: '%s'",
@@ -201,7 +201,7 @@
     }
 
     Location location = {
-      .filename = filename,
+      .filename = filename.str(),
       .start = {
         .line = src_manager.getExpansionLineNumber(expansion_range.getBegin()),
         .column = src_manager.getExpansionColumnNumber(expansion_range.getBegin()),
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index 4ee3446..7a5b502 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -446,7 +446,7 @@
       continue;
     }
 
-    std::string rel_path = path.substr(src_dir.length() + 1);
+    std::string rel_path = path.substr(src_dir.length() + 1).str();
     std::string dst_path = dst_dir + "/" + rel_path;
     llvm::StringRef parent_path = llvm::sys::path::parent_path(dst_path);
     if (llvm::sys::fs::create_directories(parent_path)) {
@@ -471,13 +471,13 @@
     GuardMap guard_map;
     for (const auto& it : orig_guard_map) {
       Location loc = it.first;
-      loc.end = findNextSemicolon(file_lines[file_path], loc.end);
+      loc.end = findNextSemicolon(file_lines[file_path.str()], loc.end);
       guard_map[loc] = it.second;
     }
 
     // TODO: Make sure that the Locations don't overlap.
     // TODO: Merge adjacent non-identical guards.
-    mergeGuards(file_lines[file_path], guard_map);
+    mergeGuards(file_lines[file_path.str()], guard_map);
 
     if (!file_path.startswith(src_dir)) {
       errx(1, "input file %s is not in %s\n", file_path.str().c_str(), src_dir.c_str());
@@ -487,7 +487,7 @@
     llvm::StringRef rel_path = file_path.substr(src_dir.size(), file_path.size() - src_dir.size());
     std::string output_path = (llvm::Twine(dst_dir) + rel_path).str();
 
-    rewriteFile(output_path, file_lines[file_path], guard_map);
+    rewriteFile(output_path, file_lines[file_path.str()], guard_map);
   }
 
   return true;
diff --git a/tools/versioner/src/versioner.cpp b/tools/versioner/src/versioner.cpp
index 473f1f9..99228dd 100644
--- a/tools/versioner/src/versioner.cpp
+++ b/tools/versioner/src/versioner.cpp
@@ -141,7 +141,7 @@
   }
 
   auto new_end = std::remove_if(headers.begin(), headers.end(), [&arch](llvm::StringRef header) {
-    for (const auto& it : header_blacklist) {
+    for (const auto& it : ignored_headers) {
       if (it.second.find(arch) == it.second.end()) {
         continue;
       }
diff --git a/tools/versioner/src/versioner.h b/tools/versioner/src/versioner.h
index 5e53498..e9c4989 100644
--- a/tools/versioner/src/versioner.h
+++ b/tools/versioner/src/versioner.h
@@ -33,15 +33,11 @@
     }                      \
   } while (0)
 
-static const std::unordered_map<std::string, std::set<Arch>> header_blacklist = {
+static const std::unordered_map<std::string, std::set<Arch>> ignored_headers = {
   // Internal header.
+  // TODO: we should probably just admit we're never getting rid of this.
   { "sys/_system_properties.h", supported_archs },
 
   // time64.h #errors when included on LP64 archs.
   { "time64.h", { Arch::arm64, Arch::x86_64 } },
 };
-
-static const std::unordered_set<std::string> missing_symbol_whitelist = {
-  // atexit comes from crtbegin.
-  "atexit",
-};