Merge "Update OWNERS"
diff --git a/README.md b/README.md
index 388a139..d96608e 100644
--- a/README.md
+++ b/README.md
@@ -271,39 +271,11 @@
 
     $ ./tests/run-on-host.sh glibc
 
-
 ## Gathering test coverage
 
-For either host or target coverage, you must first:
-
- * `$ export NATIVE_COVERAGE=true`
-     * Note that the build system is ignorant to this flag being toggled, i.e. if
-       you change this flag, you will have to manually rebuild bionic.
- * Set `bionic_coverage=true` in `libc/Android.mk` and `libm/Android.mk`.
-
-### Coverage from device tests
-
-    $ mma
-    $ adb sync
-    $ adb shell \
-        GCOV_PREFIX=/data/local/tmp/gcov \
-        GCOV_PREFIX_STRIP=`echo $ANDROID_BUILD_TOP | grep -o / | wc -l` \
-        /data/nativetest/bionic-unit-tests/bionic-unit-tests
-    $ acov
-
-`acov` will pull all coverage information from the device, push it to the right
-directories, run `lcov`, and open the coverage report in your browser.
-
-### Coverage from host tests
-
-First, build and run the host tests as usual (see above).
-
-    $ croot
-    $ lcov -c -d $ANDROID_PRODUCT_OUT -o coverage.info
-    $ genhtml -o covreport coverage.info # or lcov --list coverage.info
-
-The coverage report is now available at `covreport/index.html`.
-
+To get test coverage for bionic, use `//bionic/build/coverage.sh`. Before
+running, follow the instructions at the top of the file to rebuild bionic with
+coverage instrumentation.
 
 ## Attaching GDB to the tests
 
diff --git a/TEST_MAPPING b/TEST_MAPPING
index d809e71..8b01c4e 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,6 +1,15 @@
 {
   "presubmit": [
     {
+      "name": "bionic-unit-tests"
+    },
+    {
+      "name": "bionic-unit-tests-static"
+    },
+    {
+      "name": "linker-unit-tests"
+    },
+    {
       "name": "CtsBionicTestCases"
     },
     {
@@ -16,6 +25,9 @@
       "name": "gwp_asan_unittest"
     },
     {
+      "name": "malloc_debug_unit_tests"
+    },
+    {
       "name": "malloc_debug_system_tests"
     },
     {
diff --git a/apex/Android.bp b/apex/Android.bp
index 4879f47..90a14b2 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -58,7 +58,6 @@
         "bionic-linker-config",
     ],
     updatable: false,
-    generate_hashtree: false,
 }
 
 sdk {
diff --git a/benchmarks/stdlib_benchmark.cpp b/benchmarks/stdlib_benchmark.cpp
index b6ea58d..14b380a 100644
--- a/benchmarks/stdlib_benchmark.cpp
+++ b/benchmarks/stdlib_benchmark.cpp
@@ -155,88 +155,71 @@
 BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_malloc_multiple_8192_allocs_decay1, "AT_SMALL_SIZES");
 #endif
 
-static void BM_stdlib_mbstowcs(benchmark::State& state) {
-  const size_t buf_alignment = state.range(0);
-  const size_t widebuf_alignment = state.range(1);
-
-  std::vector<char> buf;
-  std::vector<wchar_t> widebuf;
-
-  setlocale(LC_CTYPE, "C.UTF-8")
-  || setlocale(LC_CTYPE, "en_US.UTF-8")
-  || setlocale(LC_CTYPE, "en_GB.UTF-8")
-  || setlocale(LC_CTYPE, "en.UTF-8")
-  || setlocale(LC_CTYPE, "de_DE-8")
-  || setlocale(LC_CTYPE, "fr_FR-8");
-  if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
-    errx(1, "ERROR: unable to set locale in BM_stdlib_mbstowcs");
-  }
-
-  char* buf_aligned = GetAlignedPtr(&buf, buf_alignment, 500000);
-  wchar_t* widebuf_aligned = GetAlignedPtr(&widebuf, widebuf_alignment, 500000);
-  size_t i, j, k, l;
-  l = 0;
-  for (i=0xc3; i<0xe0; i++)
-    for (j=0x80; j<0xc0; j++)
-      buf[l++] = i, buf[l++] = j;
-  for (i=0xe1; i<0xed; i++)
-    for (j=0x80; j<0xc0; j++)
-      for (k=0x80; k<0xc0; k++)
-        buf[l++] = i, buf[l++] = j, buf[l++] = k;
-  for (i=0xf1; i<0xf4; i++)
-    for (j=0x80; j<0xc0; j++)
-      for (k=0x80; k<0xc0; k++)
-        buf[l++] = i, buf[l++] = j, buf[l++] = 0x80, buf[l++] = k;
-  buf[l++] = 0;
+static void BM_stdlib_mbstowcs_ascii(benchmark::State& state) {
+  // It doesn't really matter what ASCII character we pick.
+  // The flow through the fast path is the same regardless.
+  const size_t count = 500000;
+  std::vector<char> mbs(count, 'e');
+  std::vector<wchar_t> wcs(count);
 
   for (auto _ : state) {
-    benchmark::DoNotOptimize(mbstowcs(widebuf_aligned, buf_aligned, 500000));
+    benchmark::DoNotOptimize(mbstowcs(&wcs[0], &mbs[0], wcs.size()));
   }
 
-  state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(500000));
+  state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(wcs.size()));
 }
-BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbstowcs, "0 0");
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbstowcs_ascii, "");
 
-static void BM_stdlib_mbrtowc(benchmark::State& state) {
-  const size_t buf_alignment = state.range(0);
-
-  std::vector<char> buf;
-
-  setlocale(LC_CTYPE, "C.UTF-8")
-  || setlocale(LC_CTYPE, "en_US.UTF-8")
-  || setlocale(LC_CTYPE, "en_GB.UTF-8")
-  || setlocale(LC_CTYPE, "en.UTF-8")
-  || setlocale(LC_CTYPE, "de_DE-8")
-  || setlocale(LC_CTYPE, "fr_FR-8");
-  if (strcmp(nl_langinfo(CODESET), "UTF-8")) {
-    errx(1, "ERROR: unable to set locale in BM_stdlib_mbrtowc");
+static void BM_stdlib_mbstowcs_wide(benchmark::State& state) {
+  // It doesn't matter much what wide character we pick.
+  // A three-byte character seems pretty representative, and all three byte
+  // characters are the same from the code's perspective.
+  const size_t count = 500000;
+  std::string mbs;
+  for (size_t i = 0; i < count; i++) {
+    mbs += "\xe5\xb1\xb1";
   }
+  std::vector<wchar_t> wcs(count);
 
-  char* buf_aligned = GetAlignedPtr(&buf, buf_alignment, 500000);
-  size_t i, j, k, l;
-  l = 0;
-  for (i=0xc3; i<0xe0; i++)
-    for (j=0x80; j<0xc0; j++)
-      buf[l++] = i, buf[l++] = j;
-  for (i=0xe1; i<0xed; i++)
-    for (j=0x80; j<0xc0; j++)
-      for (k=0x80; k<0xc0; k++)
-        buf[l++] = i, buf[l++] = j, buf[l++] = k;
-  for (i=0xf1; i<0xf4; i++)
-    for (j=0x80; j<0xc0; j++)
-      for (k=0x80; k<0xc0; k++)
-        buf[l++] = i, buf[l++] = j, buf[l++] = 0x80, buf[l++] = k;
-  buf[l++] = 0;
-
-  wchar_t wc = 0;
   for (auto _ : state) {
-    for (j = 0; buf_aligned[j]; j+=mbrtowc(&wc, buf_aligned + j, 4, nullptr)) {
-    }
+    benchmark::DoNotOptimize(mbstowcs(&wcs[0], &mbs[0], wcs.size()));
   }
 
-  state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(500000));
+  state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(wcs.size()));
 }
-BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc, "0");
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbstowcs_wide, "");
+
+static void BM_stdlib_mbrtowc_1(benchmark::State& state) {
+  wchar_t wc;
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(mbrtowc(&wc, "e", 1, nullptr));
+  }
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc_1, "");
+
+static void BM_stdlib_mbrtowc_2(benchmark::State& state) {
+  wchar_t wc;
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(mbrtowc(&wc, "\xc3\x9f", 3, nullptr));
+  }
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc_2, "");
+
+static void BM_stdlib_mbrtowc_3(benchmark::State& state) {
+  wchar_t wc;
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(mbrtowc(&wc, "\xe5\xb1\xb1", 3, nullptr));
+  }
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc_3, "");
+
+static void BM_stdlib_mbrtowc_4(benchmark::State& state) {
+  wchar_t wc;
+  for (auto _ : state) {
+    benchmark::DoNotOptimize(mbrtowc(&wc, "\xf0\xa4\xad\xa2", 4, nullptr));
+  }
+}
+BIONIC_BENCHMARK_WITH_ARG(BM_stdlib_mbrtowc_4, "");
 
 BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_atoi, atoi(" -123"));
 BIONIC_TRIVIAL_BENCHMARK(BM_stdlib_atol, atol(" -123"));
diff --git a/libc/Android.bp b/libc/Android.bp
index 1472371..00904aa 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -122,6 +122,10 @@
             cflags: ["-DUSE_SCUDO"],
         },
     },
+
+    lto: {
+        never: true,
+    },
 }
 
 libc_scudo_product_variables = {
@@ -1054,6 +1058,7 @@
         "bionic/error.cpp",
         "bionic/eventfd.cpp",
         "bionic/exec.cpp",
+        "bionic/execinfo.cpp",
         "bionic/faccessat.cpp",
         "bionic/fchmod.cpp",
         "bionic/fchmodat.cpp",
@@ -1121,6 +1126,7 @@
         "bionic/posix_fallocate.cpp",
         "bionic/posix_madvise.cpp",
         "bionic/posix_timers.cpp",
+        "bionic/preadv_pwritev.cpp",
         "bionic/ptrace.cpp",
         "bionic/pty.cpp",
         "bionic/raise.cpp",
@@ -1780,8 +1786,12 @@
         "com.android.runtime",
     ],
 
-    lto: {
-        never: true,
+    target: {
+        native_bridge: {
+            shared: {
+                installable: false,
+            },
+        },
     },
 }
 
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 289eddb..22b82f1 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -97,13 +97,14 @@
 ssize_t     pwrite64|pwrite(int, void*, size_t, off_t) lp64
 
 # On LP32, preadv/pwritev don't use off64_t --- they use pairs of 32-bit
-# arguments to avoid problems on architectures like ARM where 64-bit arguments
+# arguments to avoid problems on architectures like arm32 where 64-bit arguments
 # must be in a register pair starting with an even-numbered register.
 # See linux/fs/read_write.c and https://lwn.net/Articles/311630/.
-ssize_t     __preadv64:preadv(int, const struct iovec*, int, long, long) lp32
-ssize_t     preadv|preadv64(int, const struct iovec*, int, off_t) lp64
-ssize_t     __pwritev64:pwritev(int, const struct iovec*, int, long, long) lp32
-ssize_t     pwritev|pwritev64(int, const struct iovec*, int, off_t) lp64
+# Note that there's an unused always-0 second long even on LP64!
+ssize_t     __preadv64:preadv(int, const struct iovec*, int, long, long) all
+ssize_t     __pwritev64:pwritev(int, const struct iovec*, int, long, long) all
+ssize_t     __preadv64v2:preadv2(int, const struct iovec*, int, long, long, int) all
+ssize_t     __pwritev64v2:pwritev2(int, const struct iovec*, int, long, long, int) all
 
 int         __close:close(int)  all
 pid_t       __getpid:getpid()  all
diff --git a/libc/bionic/android_profiling_dynamic.cpp b/libc/bionic/android_profiling_dynamic.cpp
index 9d92a6d..4fafd67 100644
--- a/libc/bionic/android_profiling_dynamic.cpp
+++ b/libc/bionic/android_profiling_dynamic.cpp
@@ -68,8 +68,6 @@
   // does not get loaded for a) non-apps, b) non-profilable apps on user. The default signal
   // disposition is to crash. We do not want the target to crash if we accidentally target a
   // non-app or non-profilable process.
-  //
-  // This does *not* get run for processes that statically link libc, and those will still crash.
   signal(BIONIC_SIGNAL_ART_PROFILER, SIG_IGN);
 }
 
diff --git a/libc/bionic/bionic_systrace.cpp b/libc/bionic/bionic_systrace.cpp
index fd97712..cf5cd82 100644
--- a/libc/bionic/bionic_systrace.cpp
+++ b/libc/bionic/bionic_systrace.cpp
@@ -86,7 +86,21 @@
     return;
   }
 
-  TEMP_FAILURE_RETRY(write(trace_marker_fd, "E|", 2));
+  // This code is intentionally "sub-optimal"; do not optimize this by inlining
+  // the E| string into the write.
+  //
+  // This is because if the const char* string passed to write(trace_marker) is not
+  // in resident memory (e.g. the page of the .rodata section that contains it has
+  // been paged out, or the anonymous page that contained a heap-based string is
+  // swapped in zram), the ftrace code will NOT page it in and instead report
+  // <faulted>.
+  //
+  // We "fix" this by putting the string on the stack, which is more unlikely
+  // to be paged out and pass the pointer to that instead.
+  //
+  // See b/197620214 for more context on this.
+  volatile char buf[2]{'E', '|'};
+  TEMP_FAILURE_RETRY(write(trace_marker_fd, const_cast<const char*>(buf), 2));
 }
 
 ScopedTrace::ScopedTrace(const char* message) : called_end_(false) {
diff --git a/libc/bionic/c16rtomb.cpp b/libc/bionic/c16rtomb.cpp
index 2d6ae93..e052d04 100644
--- a/libc/bionic/c16rtomb.cpp
+++ b/libc/bionic/c16rtomb.cpp
@@ -43,7 +43,7 @@
 size_t c16rtomb(char* s, char16_t c16, mbstate_t* ps) {
   static mbstate_t __private_state;
   mbstate_t* state = (ps == nullptr) ? &__private_state : ps;
-  if (mbsinit(state)) {
+  if (mbstate_is_initial(state)) {
     if (is_high_surrogate(c16)) {
       char32_t c32 = (c16 & ~0xd800) << 10;
       mbstate_set_byte(state, 3, (c32 & 0xff0000) >> 16);
diff --git a/libc/bionic/c32rtomb.cpp b/libc/bionic/c32rtomb.cpp
index 2909d8b..d2519b9 100644
--- a/libc/bionic/c32rtomb.cpp
+++ b/libc/bionic/c32rtomb.cpp
@@ -50,7 +50,7 @@
     return mbstate_reset_and_return(1, state);
   }
 
-  if (!mbsinit(state)) {
+  if (!mbstate_is_initial(state)) {
     return mbstate_reset_and_return_illegal(EILSEQ, state);
   }
 
diff --git a/libc/bionic/execinfo.cpp b/libc/bionic/execinfo.cpp
new file mode 100644
index 0000000..d129f7c
--- /dev/null
+++ b/libc/bionic/execinfo.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2012 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 <dlfcn.h>
+#include <execinfo.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <unwind.h>
+
+#include "private/ScopedFd.h"
+
+struct StackState {
+  void** frames;
+  int frame_count;
+  int cur_frame = 0;
+
+  StackState(void** frames, int frame_count) : frames(frames), frame_count(frame_count) {}
+};
+
+static _Unwind_Reason_Code TraceFunction(_Unwind_Context* context, void* arg) {
+  // The instruction pointer is pointing at the instruction after the return
+  // call on all architectures.
+  // Modify the pc to point at the real function.
+  uintptr_t ip = _Unwind_GetIP(context);
+  if (ip != 0) {
+#if defined(__arm__)
+    // If the ip is suspiciously low, do nothing to avoid a segfault trying
+    // to access this memory.
+    if (ip >= 4096) {
+      // Check bits [15:11] of the first halfword assuming the instruction
+      // is 32 bits long. If the bits are any of these values, then our
+      // assumption was correct:
+      //  b11101
+      //  b11110
+      //  b11111
+      // Otherwise, this is a 16 bit instruction.
+      uint16_t value = (*reinterpret_cast<uint16_t*>(ip - 2)) >> 11;
+      if (value == 0x1f || value == 0x1e || value == 0x1d) {
+        ip -= 4;
+      } else {
+        ip -= 2;
+      }
+    }
+#elif defined(__aarch64__)
+    // All instructions are 4 bytes long, skip back one instruction.
+    ip -= 4;
+#elif defined(__i386__) || defined(__x86_64__)
+    // It's difficult to decode exactly where the previous instruction is,
+    // so subtract 1 to estimate where the instruction lives.
+    ip--;
+#endif
+  }
+
+  StackState* state = static_cast<StackState*>(arg);
+  state->frames[state->cur_frame++] = reinterpret_cast<void*>(ip);
+  return (state->cur_frame >= state->frame_count) ? _URC_END_OF_STACK : _URC_NO_REASON;
+}
+
+int backtrace(void** buffer, int size) {
+  if (size <= 0) {
+    return 0;
+  }
+
+  StackState state(buffer, size);
+  _Unwind_Backtrace(TraceFunction, &state);
+  return state.cur_frame;
+}
+
+char** backtrace_symbols(void* const* buffer, int size) {
+  if (size <= 0) {
+    return nullptr;
+  }
+  // Do this calculation first in case the user passes in a bad value.
+  size_t ptr_size;
+  if (__builtin_mul_overflow(sizeof(char*), size, &ptr_size)) {
+    return nullptr;
+  }
+
+  ScopedFd fd(memfd_create("backtrace_symbols_fd", MFD_CLOEXEC));
+  if (fd.get() == -1) {
+    return nullptr;
+  }
+  backtrace_symbols_fd(buffer, size, fd.get());
+
+  // Get the size of the file.
+  off_t file_size = lseek(fd.get(), 0, SEEK_END);
+  if (file_size <= 0) {
+    return nullptr;
+  }
+
+  // The interface for backtrace_symbols indicates that only the single
+  // returned pointer must be freed by the caller. Therefore, allocate a
+  // buffer that includes the memory for the strings and all of the pointers.
+  // Add one byte at the end just in case the file didn't end with a '\n'.
+  size_t symbol_data_size;
+  if (__builtin_add_overflow(ptr_size, file_size, &symbol_data_size) ||
+      __builtin_add_overflow(symbol_data_size, 1, &symbol_data_size)) {
+    return nullptr;
+  }
+
+  uint8_t* symbol_data = reinterpret_cast<uint8_t*>(malloc(symbol_data_size));
+  if (symbol_data == nullptr) {
+    return nullptr;
+  }
+
+  // Copy the string data into the buffer.
+  char* cur_string = reinterpret_cast<char*>(&symbol_data[ptr_size]);
+  // If this fails, the read won't read back the correct number of bytes.
+  lseek(fd.get(), 0, SEEK_SET);
+  ssize_t num_read = read(fd.get(), cur_string, file_size);
+  fd.reset(-1);
+  if (num_read != file_size) {
+    free(symbol_data);
+    return nullptr;
+  }
+
+  // Make sure the last character in the file is '\n'.
+  if (cur_string[file_size] != '\n') {
+    cur_string[file_size++] = '\n';
+  }
+
+  for (int i = 0; i < size; i++) {
+    (reinterpret_cast<char**>(symbol_data))[i] = cur_string;
+    cur_string = strchr(cur_string, '\n');
+    if (cur_string == nullptr) {
+      free(symbol_data);
+      return nullptr;
+    }
+    cur_string[0] = '\0';
+    cur_string++;
+  }
+  return reinterpret_cast<char**>(symbol_data);
+}
+
+// This function should do no allocations if possible.
+void backtrace_symbols_fd(void* const* buffer, int size, int fd) {
+  if (size <= 0 || fd < 0) {
+    return;
+  }
+
+  for (int frame_num = 0; frame_num < size; frame_num++) {
+    void* address = buffer[frame_num];
+    Dl_info info;
+    if (dladdr(address, &info) != 0) {
+      if (info.dli_fname != nullptr) {
+        write(fd, info.dli_fname, strlen(info.dli_fname));
+      }
+      if (info.dli_sname != nullptr) {
+        dprintf(fd, "(%s+0x%" PRIxPTR ") ", info.dli_sname,
+                reinterpret_cast<uintptr_t>(address) - reinterpret_cast<uintptr_t>(info.dli_saddr));
+      } else {
+        dprintf(fd, "(+%p) ", info.dli_saddr);
+      }
+    }
+
+    dprintf(fd, "[%p]\n", address);
+  }
+}
diff --git a/libc/bionic/legacy_32_bit_support.cpp b/libc/bionic/legacy_32_bit_support.cpp
index f08e582..41108e6 100644
--- a/libc/bionic/legacy_32_bit_support.cpp
+++ b/libc/bionic/legacy_32_bit_support.cpp
@@ -45,8 +45,6 @@
 
 // System calls we need.
 extern "C" int __llseek(int, unsigned long, unsigned long, off64_t*, int);
-extern "C" int __preadv64(int, const struct iovec*, int, long, long);
-extern "C" int __pwritev64(int, const struct iovec*, int, long, long);
 
 // For lseek64 we need to use the llseek system call which splits the off64_t in two and
 // returns the off64_t result via a pointer because 32-bit kernels can't return 64-bit results.
@@ -70,23 +68,6 @@
   return pwrite64(fd, buf, byte_count, static_cast<off64_t>(offset));
 }
 
-// On LP32, there is no off_t preadv/pwritev, and even the 64-bit preadv/pwritev
-// don't use off64_t (see SYSCALLS.TXT for more). Here, this means that we need
-// to implement all four functions because the two system calls don't match any
-// of the userspace functions. Unlike llseek, the pair is split lo-hi, not hi-lo.
-ssize_t preadv(int fd, const struct iovec* ios, int count, off_t offset) {
-  return preadv64(fd, ios, count, offset);
-}
-ssize_t preadv64(int fd, const struct iovec* ios, int count, off64_t offset) {
-  return __preadv64(fd, ios, count, offset, offset >> 32);
-}
-ssize_t pwritev(int fd, const struct iovec* ios, int count, off_t offset) {
-  return pwritev64(fd, ios, count, offset);
-}
-ssize_t pwritev64(int fd, const struct iovec* ios, int count, off64_t offset) {
-  return __pwritev64(fd, ios, count, offset, offset >> 32);
-}
-
 // There is no fallocate for 32-bit off_t, so we need to widen and call fallocate64.
 int fallocate(int fd, int mode, off_t offset, off_t length) {
   return fallocate64(fd, mode, static_cast<off64_t>(offset), static_cast<off64_t>(length));
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index dd623a5..8084e73 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -149,50 +149,25 @@
   _exit(EXIT_FAILURE);
 }
 
-// Force any of the closed stdin, stdout and stderr to be associated with /dev/null.
+// Force any of the stdin/stdout/stderr file descriptors that aren't
+// open to be associated with /dev/null.
 static void __nullify_closed_stdio() {
-  int dev_null = TEMP_FAILURE_RETRY(open("/dev/null", O_RDWR));
-  if (dev_null == -1) {
-    // init won't have /dev/null available, but SELinux provides an equivalent.
-    dev_null = TEMP_FAILURE_RETRY(open("/sys/fs/selinux/null", O_RDWR));
-  }
-  if (dev_null == -1) {
-    __early_abort(__LINE__);
-  }
-
-  // If any of the stdio file descriptors is valid and not associated
-  // with /dev/null, dup /dev/null to it.
   for (int i = 0; i < 3; i++) {
-    // If it is /dev/null already, we are done.
-    if (i == dev_null) {
-      continue;
-    }
+    if (TEMP_FAILURE_RETRY(fcntl(i, F_GETFL)) == -1) {
+      // The only error we allow is that the file descriptor does not exist.
+      if (errno != EBADF) __early_abort(__LINE__);
 
-    // Is this fd already open?
-    int status = TEMP_FAILURE_RETRY(fcntl(i, F_GETFL));
-    if (status != -1) {
-      continue;
-    }
-
-    // The only error we allow is that the file descriptor does not
-    // exist, in which case we dup /dev/null to it.
-    if (errno == EBADF) {
-      // Try dupping /dev/null to this stdio file descriptor and
-      // repeat if there is a signal. Note that any errors in closing
-      // the stdio descriptor are lost.
-      status = TEMP_FAILURE_RETRY(dup2(dev_null, i));
-      if (status == -1) {
+      // This file descriptor wasn't open, so open /dev/null.
+      // init won't have /dev/null available, but SELinux provides an equivalent.
+      // This takes advantage of the fact that open() will take the lowest free
+      // file descriptor, and we're iterating in order from 0, but we'll
+      // double-check we got the right fd anyway...
+      int fd;
+      if (((fd = TEMP_FAILURE_RETRY(open("/dev/null", O_RDWR))) == -1 &&
+           (fd = TEMP_FAILURE_RETRY(open("/sys/fs/selinux/null", O_RDWR))) == -1) ||
+          fd != i) {
         __early_abort(__LINE__);
       }
-    } else {
-      __early_abort(__LINE__);
-    }
-  }
-
-  // If /dev/null is not one of the stdio file descriptors, close it.
-  if (dev_null > 2) {
-    if (close(dev_null) == -1) {
-      __early_abort(__LINE__);
     }
   }
 }
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 3a8513f..67e692c 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -42,6 +42,7 @@
 #include "platform/bionic/macros.h"
 #include "platform/bionic/mte.h"
 #include "platform/bionic/page.h"
+#include "platform/bionic/reserved_signals.h"
 #include "private/KernelArgumentBlock.h"
 #include "private/bionic_asm.h"
 #include "private/bionic_asm_note.h"
@@ -331,6 +332,15 @@
 void __libc_init_mte(const void*, size_t, uintptr_t) {}
 #endif  // __aarch64__
 
+void __libc_init_profiling_handlers() {
+  // The dynamic variant of this function is more interesting, but this
+  // at least ensures that static binaries aren't killed by the kernel's
+  // default disposition for these two real-time signals that would have
+  // handlers installed if this was a dynamic binary.
+  signal(BIONIC_SIGNAL_PROFILER, SIG_IGN);
+  signal(BIONIC_SIGNAL_ART_PROFILER, SIG_IGN);
+}
+
 __noreturn static void __real_libc_init(void *raw_args,
                                         void (*onexit)(void) __unused,
                                         int (*slingshot)(int, char**, char**),
@@ -351,6 +361,7 @@
   __libc_init_mte(reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR)), getauxval(AT_PHNUM),
                   /*load_bias = */ 0);
   __libc_init_scudo();
+  __libc_init_profiling_handlers();
   __libc_init_fork_handler();
 
   call_ifunc_resolvers();
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp
index 9c6ccb4..f017ff5 100644
--- a/libc/bionic/malloc_heapprofd.cpp
+++ b/libc/bionic/malloc_heapprofd.cpp
@@ -273,6 +273,11 @@
         atomic_store(&gPreviousDefaultDispatchTable, nullptr);
         gEphemeralDispatch = *NativeAllocatorDispatch();
       }
+    } else if (expected == kEphemeralHookInstalled) {
+      // Nothing to do here. The ephemeral hook was installed, but
+      // MallocInitHeapprofdHook() was never called. Since the ephemeral hook
+      // is already there, no need to reinstall it.
+      return;
     } else if (atomic_compare_exchange_strong(&gHeapprofdState, &expected2,
                                               kInstallingEphemeralHook)) {
       // if we still have hook installed, we can reuse the previous
diff --git a/libc/bionic/mbrtoc16.cpp b/libc/bionic/mbrtoc16.cpp
index acea426..154b8a3 100644
--- a/libc/bionic/mbrtoc16.cpp
+++ b/libc/bionic/mbrtoc16.cpp
@@ -77,12 +77,15 @@
     return nconv;
   } else if (nconv == 0) {
     return mbstate_reset_and_return(nconv, state);
-  } else if (c32 > 0x10ffff) {
-    // Input cannot be encoded as UTF-16.
-    return mbstate_reset_and_return_illegal(EILSEQ, state);
   } else if (c32 < 0x10000) {
     *pc16 = static_cast<char16_t>(c32);
     return mbstate_reset_and_return(nconv, state);
+  } else if (c32 > 0x10ffff) {
+    // This case is currently handled by mbrtoc32() returning an error, but
+    // if that function is extended to cover 5-byte sequences (which are
+    // illegal at the moment), we'd need to explicitly handle the case of
+    // codepoints that can't be represented as a surrogate pair here.
+    return mbstate_reset_and_return_illegal(EILSEQ, state);
   } else {
     return begin_surrogate(c32, pc16, nconv, state);
   }
diff --git a/libc/bionic/mbrtoc32.cpp b/libc/bionic/mbrtoc32.cpp
index 644e542..21603a1 100644
--- a/libc/bionic/mbrtoc32.cpp
+++ b/libc/bionic/mbrtoc32.cpp
@@ -55,7 +55,7 @@
   }
 
   uint8_t ch;
-  if (mbsinit(state) && (((ch = static_cast<uint8_t>(*s)) & ~0x7f) == 0)) {
+  if (mbstate_is_initial(state) && (((ch = static_cast<uint8_t>(*s)) & ~0x7f) == 0)) {
     // Fast path for plain ASCII characters.
     if (pc32 != nullptr) {
       *pc32 = ch;
@@ -105,7 +105,7 @@
   size_t bytes_wanted = length - bytes_so_far;
   size_t i;
   for (i = 0; i < MIN(bytes_wanted, n); i++) {
-    if (!mbsinit(state) && ((*s & 0xc0) != 0x80)) {
+    if (!mbstate_is_initial(state) && ((*s & 0xc0) != 0x80)) {
       // Malformed input; bad characters in the middle of a character.
       return mbstate_reset_and_return_illegal(EILSEQ, state);
     }
diff --git a/libc/bionic/preadv_pwritev.cpp b/libc/bionic/preadv_pwritev.cpp
new file mode 100644
index 0000000..e44d3a6
--- /dev/null
+++ b/libc/bionic/preadv_pwritev.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2008 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 <sys/uio.h>
+
+// System calls we need.
+extern "C" int __preadv64(int, const struct iovec*, int, long, long);
+extern "C" int __preadv64v2(int, const struct iovec*, int, long, long, int);
+extern "C" int __pwritev64(int, const struct iovec*, int, long, long);
+extern "C" int __pwritev64v2(int, const struct iovec*, int, long, long, int);
+
+// There is no 32-bit off_t preadv/pwritev (even on LP32).
+// To avoid 32-bit ABI issues about which register pairs you're allowed
+// to pass 64-bit values in, the kernel just takes two `long` arguments --
+// which are int32_t for LP32, remember -- and stitches them together.
+// It even does this for LP64, taking a second unused always-zero `long`.
+// (The first long was int64_t, which is the same as off64_t.)
+// The pair is split lo-hi (not hi-lo, as llseek is).
+
+ssize_t preadv(int fd, const struct iovec* ios, int count, off_t offset) {
+  return preadv64(fd, ios, count, offset);
+}
+
+ssize_t preadv64(int fd, const struct iovec* ios, int count, off64_t offset) {
+#if defined(__LP64__)
+  return __preadv64(fd, ios, count, offset, 0);
+#else
+  return __preadv64(fd, ios, count, offset, offset >> 32);
+#endif
+}
+
+ssize_t pwritev(int fd, const struct iovec* ios, int count, off_t offset) {
+  return pwritev64(fd, ios, count, offset);
+}
+
+ssize_t pwritev64(int fd, const struct iovec* ios, int count, off64_t offset) {
+#if defined(__LP64__)
+  return __pwritev64(fd, ios, count, offset, 0);
+#else
+  return __pwritev64(fd, ios, count, offset, offset >> 32);
+#endif
+}
+
+ssize_t preadv2(int fd, const struct iovec* ios, int count, off_t offset, int flags) {
+  return preadv64v2(fd, ios, count, offset, flags);
+}
+
+ssize_t preadv64v2(int fd, const struct iovec* ios, int count, off64_t offset, int flags) {
+#if defined(__LP64__)
+  return __preadv64v2(fd, ios, count, offset, 0, flags);
+#else
+  return __preadv64v2(fd, ios, count, offset, offset >> 32, flags);
+#endif
+}
+
+ssize_t pwritev2(int fd, const struct iovec* ios, int count, off_t offset, int flags) {
+  return pwritev64v2(fd, ios, count, offset, flags);
+}
+
+ssize_t pwritev64v2(int fd, const struct iovec* ios, int count, off64_t offset, int flags) {
+#if defined(__LP64__)
+  return __pwritev64v2(fd, ios, count, offset, 0, flags);
+#else
+  return __pwritev64v2(fd, ios, count, offset, offset >> 32, flags);
+#endif
+}
diff --git a/libc/bionic/system.cpp b/libc/bionic/system.cpp
index 950f05c..93d7497 100644
--- a/libc/bionic/system.cpp
+++ b/libc/bionic/system.cpp
@@ -56,7 +56,7 @@
   if ((errno = posix_spawnattr_setsigmask64(&attributes, &sigchld_blocker.old_set_))) return -1;
   if ((errno = posix_spawnattr_setflags(&attributes, flags))) return -1;
 
-  const char* argv[] = { "sh", "-c", command, nullptr };
+  const char* argv[] = {"sh", "-c", "--", command, nullptr};
   pid_t child;
   if ((errno = posix_spawn(&child, __bionic_get_shell_path(), nullptr, &attributes,
                            const_cast<char**>(argv), environ)) != 0) {
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index dabe824..bd9a45e 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -54,7 +54,7 @@
 //
 
 int mbsinit(const mbstate_t* ps) {
-  return (ps == nullptr || (*(reinterpret_cast<const uint32_t*>(ps->__seq)) == 0));
+  return ps == nullptr || mbstate_is_initial(ps);
 }
 
 size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* ps) {
@@ -148,7 +148,7 @@
   static mbstate_t __private_state;
   mbstate_t* state = (ps == nullptr) ? &__private_state : ps;
 
-  if (!mbsinit(state)) {
+  if (!mbstate_is_initial(state)) {
     return mbstate_reset_and_return_illegal(EILSEQ, state);
   }
 
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index 9b9a119..8c8e65c 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -801,6 +801,9 @@
 #if defined(__NR_process_madvise)
   #define SYS_process_madvise __NR_process_madvise
 #endif
+#if defined(__NR_process_mrelease)
+  #define SYS_process_mrelease __NR_process_mrelease
+#endif
 #if defined(__NR_process_vm_readv)
   #define SYS_process_vm_readv __NR_process_vm_readv
 #endif
diff --git a/libc/include/execinfo.h b/libc/include/execinfo.h
new file mode 100644
index 0000000..347ae92
--- /dev/null
+++ b/libc/include/execinfo.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+#pragma once
+
+#include <sys/cdefs.h>
+
+/**
+ * @file execinfo.h
+ * @brief Functions to do in process backtracing.
+ */
+
+__BEGIN_DECLS
+
+/**
+ * [backtrace(3)](https://man7.org/linux/man-pages/man3/backtrace.3.html)
+ * Saves a backtrace for the current call in the array pointed to by buffer.
+ * "size" indicates the maximum number of void* pointers that can be set.
+ *
+ * Returns the number of addresses stored in "buffer", which is not greater
+ * than "size". If the return value is equal to "size" then the number of
+ * addresses may have been truncated.
+ *
+ * Available since API level 33.
+ */
+int backtrace(void** buffer, int size) __INTRODUCED_IN(33);
+
+/**
+ * [backtrace_symbols(3)](https://man7.org/linux/man-pages/man3/backtrace_symbols.3.html)
+ * Given an array of void* pointers, translate the addresses into an array
+ * of strings that represent the backtrace.
+ *
+ * Returns a pointer to allocated memory, on error NULL is returned. It is
+ * the responsibility of the caller to free the returned memory.
+ *
+ * Available since API level 33.
+ */
+char** backtrace_symbols(void* const* buffer, int size) __INTRODUCED_IN(33);
+
+/**
+ * [backtrace_symbols_fd(3)](https://man7.org/linux/man-pages/man3/backtrace_symbols_fd.3.html)
+ * Given an array of void* pointers, translate the addresses into an array
+ * of strings that represent the backtrace and write to the file represented
+ * by "fd". The file is written such that one line equals one void* address.
+ *
+ * Available since API level 33.
+ */
+void backtrace_symbols_fd(void* const* buffer, int size, int fd) __INTRODUCED_IN(33);
+
+__END_DECLS
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 583287f..252e73a 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -161,11 +161,11 @@
 void setprogname(const char* __name) __INTRODUCED_IN(21);
 
 int mblen(const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
-size_t mbstowcs(wchar_t* __dst, const char* __src, size_t __n);
+size_t mbstowcs(wchar_t* __dst, const char* __src, size_t __n) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
 int mbtowc(wchar_t* __wc_ptr, const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
 int wctomb(char* __dst, wchar_t __wc) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
 
-size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n);
+size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
 
 #if __ANDROID_API__ >= 21
 size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
diff --git a/libc/include/sys/uio.h b/libc/include/sys/uio.h
index 37961e3..583cfc6 100644
--- a/libc/include/sys/uio.h
+++ b/libc/include/sys/uio.h
@@ -26,8 +26,12 @@
  * SUCH DAMAGE.
  */
 
-#ifndef _SYS_UIO_H_
-#define _SYS_UIO_H_
+#pragma once
+
+/**
+ * @file sys/uio.h
+ * @brief Multi-buffer ("vector") I/O operations using `struct iovec`.
+ */
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
@@ -35,21 +39,124 @@
 
 __BEGIN_DECLS
 
+/**
+ * [readv(2)](http://man7.org/linux/man-pages/man2/readv.2.html) reads
+ * from an fd into the `__count` buffers described by `__iov`.
+ *
+ * Returns the number of bytes read on success,
+ * and returns -1 and sets `errno` on failure.
+ */
 ssize_t readv(int __fd, const struct iovec* __iov, int __count);
+
+/**
+ * [writev(2)](http://man7.org/linux/man-pages/man2/writev.2.html) writes
+ * to an fd from the `__count` buffers described by `__iov`.
+ *
+ * Returns the number of bytes written on success,
+ * and returns -1 and sets `errno` on failure.
+ */
 ssize_t writev(int __fd, const struct iovec* __iov, int __count);
 
 #if defined(__USE_GNU)
-ssize_t preadv(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(preadv64) __INTRODUCED_IN(24);
-ssize_t pwritev(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(pwritev64) __INTRODUCED_IN(24);
-ssize_t preadv64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
-ssize_t pwritev64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
-#endif
 
-#if defined(__USE_GNU)
+/**
+ * [preadv(2)](http://man7.org/linux/man-pages/man2/preadv.2.html) reads
+ * from an fd into the `__count` buffers described by `__iov`, starting at
+ * offset `__offset` into the file.
+ *
+ * Returns the number of bytes read on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 24.
+ */
+ssize_t preadv(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(preadv64) __INTRODUCED_IN(24);
+
+/**
+ * [pwritev(2)](http://man7.org/linux/man-pages/man2/pwritev.2.html) writes
+ * to an fd from the `__count` buffers described by `__iov`, starting at offset
+ * `__offset` into the file.
+ *
+ * Returns the number of bytes written on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 24.
+ */
+ssize_t pwritev(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(pwritev64) __INTRODUCED_IN(24);
+
+/**
+ * Like preadv() but with a 64-bit offset even in a 32-bit process.
+ *
+ * Available since API level 24.
+ */
+ssize_t preadv64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
+
+/**
+ * Like pwritev() but with a 64-bit offset even in a 32-bit process.
+ *
+ * Available since API level 24.
+ */
+ssize_t pwritev64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
+
+/**
+ * [preadv2(2)](http://man7.org/linux/man-pages/man2/preadv2.2.html) reads
+ * from an fd into the `__count` buffers described by `__iov`, starting at
+ * offset `__offset` into the file, with the given flags.
+ *
+ * Returns the number of bytes read on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 33.
+ */
+ssize_t preadv2(int __fd, const struct iovec* __iov, int __count, off_t __offset, int __flags) __RENAME_IF_FILE_OFFSET64(preadv64v2) __INTRODUCED_IN(33);
+
+/**
+ * [pwritev2(2)](http://man7.org/linux/man-pages/man2/pwritev2.2.html) writes
+ * to an fd from the `__count` buffers described by `__iov`, starting at offset
+ * `__offset` into the file, with the given flags.
+ *
+ * Returns the number of bytes written on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 33.
+ */
+ssize_t pwritev2(int __fd, const struct iovec* __iov, int __count, off_t __offset, int __flags) __RENAME_IF_FILE_OFFSET64(pwritev64v2) __INTRODUCED_IN(33);
+
+/**
+ * Like preadv2() but with a 64-bit offset even in a 32-bit process.
+ *
+ * Available since API level 33.
+ */
+ssize_t preadv64v2(int __fd, const struct iovec* __iov, int __count, off64_t __offset, int __flags) __INTRODUCED_IN(33);
+
+/**
+ * Like pwritev2() but with a 64-bit offset even in a 32-bit process.
+ *
+ * Available since API level 33.
+ */
+ssize_t pwritev64v2(int __fd, const struct iovec* __iov, int __count, off64_t __offset, int __flags) __INTRODUCED_IN(33);
+
+/**
+ * [process_vm_readv(2)](http://man7.org/linux/man-pages/man2/process_vm_readv.2.html)
+ * reads from the address space of another process.
+ *
+ * Returns the number of bytes read on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 23.
+ */
 ssize_t process_vm_readv(pid_t __pid, const struct iovec* __local_iov, unsigned long __local_iov_count, const struct iovec* __remote_iov, unsigned long __remote_iov_count, unsigned long __flags) __INTRODUCED_IN(23);
+
+/**
+ * [process_vm_writev(2)](http://man7.org/linux/man-pages/man2/process_vm_writev.2.html)
+ * writes to the address space of another process.
+ *
+ * Returns the number of bytes read on success,
+ * and returns -1 and sets `errno` on failure.
+ *
+ * Available since API level 23.
+ */
 ssize_t process_vm_writev(pid_t __pid, const struct iovec* __local_iov, unsigned long __local_iov_count, const struct iovec* __remote_iov, unsigned long __remote_iov_count, unsigned long __flags) __INTRODUCED_IN(23);
+
 #endif
 
 __END_DECLS
-
-#endif
diff --git a/libc/kernel/android/scsi/scsi/scsi.h b/libc/kernel/android/scsi/scsi/scsi.h
index a91a7f6..6d89fa9 100644
--- a/libc/kernel/android/scsi/scsi/scsi.h
+++ b/libc/kernel/android/scsi/scsi/scsi.h
@@ -35,38 +35,12 @@
   __u8 block_length_med;
   __u8 block_length_lo;
 };
-#define COMMAND_COMPLETE 0x00
-#define EXTENDED_MESSAGE 0x01
 #define EXTENDED_MODIFY_DATA_POINTER 0x00
 #define EXTENDED_SDTR 0x01
 #define EXTENDED_EXTENDED_IDENTIFY 0x02
 #define EXTENDED_WDTR 0x03
 #define EXTENDED_PPR 0x04
 #define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05
-#define SAVE_POINTERS 0x02
-#define RESTORE_POINTERS 0x03
-#define DISCONNECT 0x04
-#define INITIATOR_ERROR 0x05
-#define ABORT_TASK_SET 0x06
-#define MESSAGE_REJECT 0x07
-#define NOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define LINKED_CMD_COMPLETE 0x0a
-#define LINKED_FLG_CMD_COMPLETE 0x0b
-#define TARGET_RESET 0x0c
-#define ABORT_TASK 0x0d
-#define CLEAR_TASK_SET 0x0e
-#define INITIATE_RECOVERY 0x0f
-#define RELEASE_RECOVERY 0x10
-#define TERMINATE_IO_PROC 0x11
-#define CLEAR_ACA 0x16
-#define LOGICAL_UNIT_RESET 0x17
-#define SIMPLE_QUEUE_TAG 0x20
-#define HEAD_OF_QUEUE_TAG 0x21
-#define ORDERED_QUEUE_TAG 0x22
-#define IGNORE_WIDE_RESIDUE 0x23
-#define ACA 0x24
-#define QAS_REQUEST 0x55
 #define SCSI_IOCTL_GET_IDLUN 0x5382
 #define SCSI_IOCTL_PROBE_HOST 0x5385
 #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h b/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
index b49f72f..994a669 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
@@ -418,4 +418,5 @@
 #define __NR_landlock_create_ruleset (__NR_SYSCALL_BASE + 444)
 #define __NR_landlock_add_rule (__NR_SYSCALL_BASE + 445)
 #define __NR_landlock_restrict_self (__NR_SYSCALL_BASE + 446)
+#define __NR_process_mrelease (__NR_SYSCALL_BASE + 448)
 #endif
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h b/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
index 2e8769d..21da4d8 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
@@ -430,4 +430,5 @@
 #define __NR_landlock_create_ruleset (__NR_SYSCALL_BASE + 444)
 #define __NR_landlock_add_rule (__NR_SYSCALL_BASE + 445)
 #define __NR_landlock_restrict_self (__NR_SYSCALL_BASE + 446)
+#define __NR_process_mrelease (__NR_SYSCALL_BASE + 448)
 #endif
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd.h b/libc/kernel/uapi/asm-arm/asm/unistd.h
index a602321..8bb0f58 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd.h
@@ -19,6 +19,7 @@
 #ifndef _UAPI__ASM_ARM_UNISTD_H
 #define _UAPI__ASM_ARM_UNISTD_H
 #define __NR_OABI_SYSCALL_BASE 0x900000
+#define __NR_SYSCALL_MASK 0x0fffff
 #define __NR_SYSCALL_BASE 0
 #include <asm/unistd-eabi.h>
 #define __NR_sync_file_range2 __NR_arm_sync_file_range
diff --git a/libc/kernel/uapi/asm-generic/socket.h b/libc/kernel/uapi/asm-generic/socket.h
index 9ee2ada..2c99f48 100644
--- a/libc/kernel/uapi/asm-generic/socket.h
+++ b/libc/kernel/uapi/asm-generic/socket.h
@@ -98,6 +98,7 @@
 #define SO_PREFER_BUSY_POLL 69
 #define SO_BUSY_POLL_BUDGET 70
 #define SO_NETNS_COOKIE 71
+#define SO_BUF_LOCK 72
 #if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
 #define SO_TIMESTAMP SO_TIMESTAMP_OLD
 #define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index ff41c68..e831ce7 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -410,8 +410,9 @@
 #ifdef __ARCH_WANT_MEMFD_SECRET
 #define __NR_memfd_secret 447
 #endif
+#define __NR_process_mrelease 448
 #undef __NR_syscalls
-#define __NR_syscalls 448
+#define __NR_syscalls 449
 #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 4eb8901..2db4566 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -257,6 +257,7 @@
 #define KVM_GUESTDBG_USE_HW_BP 0x00020000
 #define KVM_GUESTDBG_INJECT_DB 0x00040000
 #define KVM_GUESTDBG_INJECT_BP 0x00080000
+#define KVM_GUESTDBG_BLOCKIRQ 0x00100000
 struct kvm_guest_debug_arch {
   __u64 debugreg[8];
 };
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index fc9528f..20810c6 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -455,4 +455,5 @@
 #define __NR_landlock_add_rule 445
 #define __NR_landlock_restrict_self 446
 #define __NR_memfd_secret 447
+#define __NR_process_mrelease 448
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index f02b898..0f33ee6 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -377,4 +377,5 @@
 #define __NR_landlock_add_rule 445
 #define __NR_landlock_restrict_self 446
 #define __NR_memfd_secret 447
+#define __NR_process_mrelease 448
 #endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index 9b26317..c840222 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -330,6 +330,7 @@
 #define __NR_landlock_add_rule (__X32_SYSCALL_BIT + 445)
 #define __NR_landlock_restrict_self (__X32_SYSCALL_BIT + 446)
 #define __NR_memfd_secret (__X32_SYSCALL_BIT + 447)
+#define __NR_process_mrelease (__X32_SYSCALL_BIT + 448)
 #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/drm/drm_fourcc.h b/libc/kernel/uapi/drm/drm_fourcc.h
index 099791c..aaa94cd 100644
--- a/libc/kernel/uapi/drm/drm_fourcc.h
+++ b/libc/kernel/uapi/drm/drm_fourcc.h
@@ -207,6 +207,15 @@
 #define AFBC_FORMAT_MOD_DB (1ULL << 10)
 #define AFBC_FORMAT_MOD_BCH (1ULL << 11)
 #define AFBC_FORMAT_MOD_USM (1ULL << 12)
+#define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
+#define DRM_FORMAT_MOD_ARM_AFRC(__afrc_mode) DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode)
+#define AFRC_FORMAT_MOD_CU_SIZE_MASK 0xf
+#define AFRC_FORMAT_MOD_CU_SIZE_16 (1ULL)
+#define AFRC_FORMAT_MOD_CU_SIZE_24 (2ULL)
+#define AFRC_FORMAT_MOD_CU_SIZE_32 (3ULL)
+#define AFRC_FORMAT_MOD_CU_SIZE_P0(__afrc_cu_size) (__afrc_cu_size)
+#define AFRC_FORMAT_MOD_CU_SIZE_P12(__afrc_cu_size) ((__afrc_cu_size) << 4)
+#define AFRC_FORMAT_MOD_LAYOUT_SCAN (1ULL << 8)
 #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL)
 #define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1)
 #define __fourcc_mod_amlogic_layout_mask 0xff
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index 225c1da..9e56f4c 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -351,6 +351,7 @@
 #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)
 #define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)
 #define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)
+#define I915_SCHEDULER_CAP_STATIC_PRIORITY_MAP (1ul << 5)
 #define I915_PARAM_HUC_STATUS 42
 #define I915_PARAM_HAS_EXEC_ASYNC 43
 #define I915_PARAM_HAS_EXEC_FENCE 44
@@ -365,6 +366,7 @@
 #define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
 #define I915_PARAM_PERF_REVISION 54
 #define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
+#define I915_PARAM_HAS_USERPTR_PROBE 56
 typedef struct drm_i915_getparam {
   __s32 param;
   int __user * value;
@@ -455,6 +457,7 @@
 #define I915_MMAP_OFFSET_WC 1
 #define I915_MMAP_OFFSET_WB 2
 #define I915_MMAP_OFFSET_UC 3
+#define I915_MMAP_OFFSET_FIXED 4
   __u64 extensions;
 };
 struct drm_i915_gem_set_domain {
@@ -592,11 +595,11 @@
   __u32 handle;
   __u32 busy;
 };
+struct drm_i915_gem_caching {
+  __u32 handle;
 #define I915_CACHING_NONE 0
 #define I915_CACHING_CACHED 1
 #define I915_CACHING_DISPLAY 2
-struct drm_i915_gem_caching {
-  __u32 handle;
   __u32 caching;
 };
 #define I915_TILING_NONE 0
@@ -784,20 +787,7 @@
   struct i915_user_extension base;
   struct drm_i915_gem_context_param param;
 };
-struct drm_i915_gem_context_create_ext_clone {
 #define I915_CONTEXT_CREATE_EXT_CLONE 1
-  struct i915_user_extension base;
-  __u32 clone_id;
-  __u32 flags;
-#define I915_CONTEXT_CLONE_ENGINES (1u << 0)
-#define I915_CONTEXT_CLONE_FLAGS (1u << 1)
-#define I915_CONTEXT_CLONE_SCHEDATTR (1u << 2)
-#define I915_CONTEXT_CLONE_SSEU (1u << 3)
-#define I915_CONTEXT_CLONE_TIMELINE (1u << 4)
-#define I915_CONTEXT_CLONE_VM (1u << 5)
-#define I915_CONTEXT_CLONE_UNKNOWN - (I915_CONTEXT_CLONE_VM << 1)
-  __u64 rsvd;
-};
 struct drm_i915_gem_context_destroy {
   __u32 ctx_id;
   __u32 pad;
@@ -825,6 +815,7 @@
   __u64 user_size;
   __u32 flags;
 #define I915_USERPTR_READ_ONLY 0x1
+#define I915_USERPTR_PROBE 0x2
 #define I915_USERPTR_UNSYNCHRONIZED 0x80000000
   __u32 handle;
 };
diff --git a/libc/kernel/uapi/drm/msm_drm.h b/libc/kernel/uapi/drm/msm_drm.h
index 5aabc18..b4ba1d0 100644
--- a/libc/kernel/uapi/drm/msm_drm.h
+++ b/libc/kernel/uapi/drm/msm_drm.h
@@ -39,10 +39,11 @@
 #define MSM_PARAM_MAX_FREQ 0x04
 #define MSM_PARAM_TIMESTAMP 0x05
 #define MSM_PARAM_GMEM_BASE 0x06
-#define MSM_PARAM_NR_RINGS 0x07
+#define MSM_PARAM_PRIORITIES 0x07
 #define MSM_PARAM_PP_PGTABLE 0x08
 #define MSM_PARAM_FAULTS 0x09
 #define MSM_PARAM_SUSPENDS 0x0a
+#define MSM_PARAM_NR_RINGS MSM_PARAM_PRIORITIES
 struct drm_msm_param {
   __u32 pipe;
   __u32 param;
diff --git a/libc/kernel/uapi/drm/tegra_drm.h b/libc/kernel/uapi/drm/tegra_drm.h
index 5244a27..5e90635 100644
--- a/libc/kernel/uapi/drm/tegra_drm.h
+++ b/libc/kernel/uapi/drm/tegra_drm.h
@@ -163,6 +163,104 @@
 #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
 #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
 #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
+#define DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT (1 << 0)
+struct drm_tegra_channel_open {
+  __u32 host1x_class;
+  __u32 flags;
+  __u32 context;
+  __u32 version;
+  __u32 capabilities;
+  __u32 padding;
+};
+struct drm_tegra_channel_close {
+  __u32 context;
+  __u32 padding;
+};
+#define DRM_TEGRA_CHANNEL_MAP_READ (1 << 0)
+#define DRM_TEGRA_CHANNEL_MAP_WRITE (1 << 1)
+#define DRM_TEGRA_CHANNEL_MAP_READ_WRITE (DRM_TEGRA_CHANNEL_MAP_READ | DRM_TEGRA_CHANNEL_MAP_WRITE)
+struct drm_tegra_channel_map {
+  __u32 context;
+  __u32 handle;
+  __u32 flags;
+  __u32 mapping;
+};
+struct drm_tegra_channel_unmap {
+  __u32 context;
+  __u32 mapping;
+};
+#define DRM_TEGRA_SUBMIT_RELOC_SECTOR_LAYOUT (1 << 0)
+struct drm_tegra_submit_buf {
+  __u32 mapping;
+  __u32 flags;
+  struct {
+    __u64 target_offset;
+    __u32 gather_offset_words;
+    __u32 shift;
+  } reloc;
+};
+#define DRM_TEGRA_SUBMIT_CMD_GATHER_UPTR 0
+#define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT 1
+#define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT_RELATIVE 2
+struct drm_tegra_submit_cmd_gather_uptr {
+  __u32 words;
+  __u32 reserved[3];
+};
+struct drm_tegra_submit_cmd_wait_syncpt {
+  __u32 id;
+  __u32 value;
+  __u32 reserved[2];
+};
+struct drm_tegra_submit_cmd {
+  __u32 type;
+  __u32 flags;
+  union {
+    struct drm_tegra_submit_cmd_gather_uptr gather_uptr;
+    struct drm_tegra_submit_cmd_wait_syncpt wait_syncpt;
+    __u32 reserved[4];
+  };
+};
+struct drm_tegra_submit_syncpt {
+  __u32 id;
+  __u32 flags;
+  __u32 increments;
+  __u32 value;
+};
+struct drm_tegra_channel_submit {
+  __u32 context;
+  __u32 num_bufs;
+  __u32 num_cmds;
+  __u32 gather_data_words;
+  __u64 bufs_ptr;
+  __u64 cmds_ptr;
+  __u64 gather_data_ptr;
+  __u32 syncobj_in;
+  __u32 syncobj_out;
+  struct drm_tegra_submit_syncpt syncpt;
+};
+struct drm_tegra_syncpoint_allocate {
+  __u32 id;
+  __u32 padding;
+};
+struct drm_tegra_syncpoint_free {
+  __u32 id;
+  __u32 padding;
+};
+struct drm_tegra_syncpoint_wait {
+  __s64 timeout_ns;
+  __u32 id;
+  __u32 threshold;
+  __u32 value;
+  __u32 padding;
+};
+#define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)
+#define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close)
+#define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map)
+#define DRM_IOCTL_TEGRA_CHANNEL_UNMAP DRM_IOWR(DRM_COMMAND_BASE + 0x13, struct drm_tegra_channel_unmap)
+#define DRM_IOCTL_TEGRA_CHANNEL_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + 0x14, struct drm_tegra_channel_submit)
+#define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate)
+#define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free)
+#define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait)
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/drm/v3d_drm.h b/libc/kernel/uapi/drm/v3d_drm.h
index cdc2cf5..a393e5d 100644
--- a/libc/kernel/uapi/drm/v3d_drm.h
+++ b/libc/kernel/uapi/drm/v3d_drm.h
@@ -30,6 +30,9 @@
 #define DRM_V3D_GET_BO_OFFSET 0x05
 #define DRM_V3D_SUBMIT_TFU 0x06
 #define DRM_V3D_SUBMIT_CSD 0x07
+#define DRM_V3D_PERFMON_CREATE 0x08
+#define DRM_V3D_PERFMON_DESTROY 0x09
+#define DRM_V3D_PERFMON_GET_VALUES 0x0a
 #define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)
 #define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
 #define DRM_IOCTL_V3D_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_CREATE_BO, struct drm_v3d_create_bo)
@@ -38,6 +41,9 @@
 #define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)
 #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
 #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
+#define DRM_IOCTL_V3D_PERFMON_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_CREATE, struct drm_v3d_perfmon_create)
+#define DRM_IOCTL_V3D_PERFMON_DESTROY DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_DESTROY, struct drm_v3d_perfmon_destroy)
+#define DRM_IOCTL_V3D_PERFMON_GET_VALUES DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_PERFMON_GET_VALUES, struct drm_v3d_perfmon_get_values)
 #define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01
 struct drm_v3d_submit_cl {
   __u32 bcl_start;
@@ -53,6 +59,8 @@
   __u64 bo_handles;
   __u32 bo_handle_count;
   __u32 flags;
+  __u32 perfmon_id;
+  __u32 pad;
 };
 struct drm_v3d_wait_bo {
   __u32 handle;
@@ -81,6 +89,7 @@
   DRM_V3D_PARAM_SUPPORTS_TFU,
   DRM_V3D_PARAM_SUPPORTS_CSD,
   DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
+  DRM_V3D_PARAM_SUPPORTS_PERFMON,
 };
 struct drm_v3d_get_param {
   __u32 param;
@@ -111,6 +120,111 @@
   __u32 bo_handle_count;
   __u32 in_sync;
   __u32 out_sync;
+  __u32 perfmon_id;
+};
+enum {
+  V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,
+  V3D_PERFCNT_FEP_VALID_PRIMS,
+  V3D_PERFCNT_FEP_EZ_NFCLIP_QUADS,
+  V3D_PERFCNT_FEP_VALID_QUADS,
+  V3D_PERFCNT_TLB_QUADS_STENCIL_FAIL,
+  V3D_PERFCNT_TLB_QUADS_STENCILZ_FAIL,
+  V3D_PERFCNT_TLB_QUADS_STENCILZ_PASS,
+  V3D_PERFCNT_TLB_QUADS_ZERO_COV,
+  V3D_PERFCNT_TLB_QUADS_NONZERO_COV,
+  V3D_PERFCNT_TLB_QUADS_WRITTEN,
+  V3D_PERFCNT_PTB_PRIM_VIEWPOINT_DISCARD,
+  V3D_PERFCNT_PTB_PRIM_CLIP,
+  V3D_PERFCNT_PTB_PRIM_REV,
+  V3D_PERFCNT_QPU_IDLE_CYCLES,
+  V3D_PERFCNT_QPU_ACTIVE_CYCLES_VERTEX_COORD_USER,
+  V3D_PERFCNT_QPU_ACTIVE_CYCLES_FRAG,
+  V3D_PERFCNT_QPU_CYCLES_VALID_INSTR,
+  V3D_PERFCNT_QPU_CYCLES_TMU_STALL,
+  V3D_PERFCNT_QPU_CYCLES_SCOREBOARD_STALL,
+  V3D_PERFCNT_QPU_CYCLES_VARYINGS_STALL,
+  V3D_PERFCNT_QPU_IC_HIT,
+  V3D_PERFCNT_QPU_IC_MISS,
+  V3D_PERFCNT_QPU_UC_HIT,
+  V3D_PERFCNT_QPU_UC_MISS,
+  V3D_PERFCNT_TMU_TCACHE_ACCESS,
+  V3D_PERFCNT_TMU_TCACHE_MISS,
+  V3D_PERFCNT_VPM_VDW_STALL,
+  V3D_PERFCNT_VPM_VCD_STALL,
+  V3D_PERFCNT_BIN_ACTIVE,
+  V3D_PERFCNT_RDR_ACTIVE,
+  V3D_PERFCNT_L2T_HITS,
+  V3D_PERFCNT_L2T_MISSES,
+  V3D_PERFCNT_CYCLE_COUNT,
+  V3D_PERFCNT_QPU_CYCLES_STALLED_VERTEX_COORD_USER,
+  V3D_PERFCNT_QPU_CYCLES_STALLED_FRAGMENT,
+  V3D_PERFCNT_PTB_PRIMS_BINNED,
+  V3D_PERFCNT_AXI_WRITES_WATCH_0,
+  V3D_PERFCNT_AXI_READS_WATCH_0,
+  V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_0,
+  V3D_PERFCNT_AXI_READ_STALLS_WATCH_0,
+  V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_0,
+  V3D_PERFCNT_AXI_READ_BYTES_WATCH_0,
+  V3D_PERFCNT_AXI_WRITES_WATCH_1,
+  V3D_PERFCNT_AXI_READS_WATCH_1,
+  V3D_PERFCNT_AXI_WRITE_STALLS_WATCH_1,
+  V3D_PERFCNT_AXI_READ_STALLS_WATCH_1,
+  V3D_PERFCNT_AXI_WRITE_BYTES_WATCH_1,
+  V3D_PERFCNT_AXI_READ_BYTES_WATCH_1,
+  V3D_PERFCNT_TLB_PARTIAL_QUADS,
+  V3D_PERFCNT_TMU_CONFIG_ACCESSES,
+  V3D_PERFCNT_L2T_NO_ID_STALL,
+  V3D_PERFCNT_L2T_COM_QUE_STALL,
+  V3D_PERFCNT_L2T_TMU_WRITES,
+  V3D_PERFCNT_TMU_ACTIVE_CYCLES,
+  V3D_PERFCNT_TMU_STALLED_CYCLES,
+  V3D_PERFCNT_CLE_ACTIVE,
+  V3D_PERFCNT_L2T_TMU_READS,
+  V3D_PERFCNT_L2T_CLE_READS,
+  V3D_PERFCNT_L2T_VCD_READS,
+  V3D_PERFCNT_L2T_TMUCFG_READS,
+  V3D_PERFCNT_L2T_SLC0_READS,
+  V3D_PERFCNT_L2T_SLC1_READS,
+  V3D_PERFCNT_L2T_SLC2_READS,
+  V3D_PERFCNT_L2T_TMU_W_MISSES,
+  V3D_PERFCNT_L2T_TMU_R_MISSES,
+  V3D_PERFCNT_L2T_CLE_MISSES,
+  V3D_PERFCNT_L2T_VCD_MISSES,
+  V3D_PERFCNT_L2T_TMUCFG_MISSES,
+  V3D_PERFCNT_L2T_SLC0_MISSES,
+  V3D_PERFCNT_L2T_SLC1_MISSES,
+  V3D_PERFCNT_L2T_SLC2_MISSES,
+  V3D_PERFCNT_CORE_MEM_WRITES,
+  V3D_PERFCNT_L2T_MEM_WRITES,
+  V3D_PERFCNT_PTB_MEM_WRITES,
+  V3D_PERFCNT_TLB_MEM_WRITES,
+  V3D_PERFCNT_CORE_MEM_READS,
+  V3D_PERFCNT_L2T_MEM_READS,
+  V3D_PERFCNT_PTB_MEM_READS,
+  V3D_PERFCNT_PSE_MEM_READS,
+  V3D_PERFCNT_TLB_MEM_READS,
+  V3D_PERFCNT_GMP_MEM_READS,
+  V3D_PERFCNT_PTB_W_MEM_WORDS,
+  V3D_PERFCNT_TLB_W_MEM_WORDS,
+  V3D_PERFCNT_PSE_R_MEM_WORDS,
+  V3D_PERFCNT_TLB_R_MEM_WORDS,
+  V3D_PERFCNT_TMU_MRU_HITS,
+  V3D_PERFCNT_COMPUTE_ACTIVE,
+  V3D_PERFCNT_NUM,
+};
+#define DRM_V3D_MAX_PERF_COUNTERS 32
+struct drm_v3d_perfmon_create {
+  __u32 id;
+  __u32 ncounters;
+  __u8 counters[DRM_V3D_MAX_PERF_COUNTERS];
+};
+struct drm_v3d_perfmon_destroy {
+  __u32 id;
+};
+struct drm_v3d_perfmon_get_values {
+  __u32 id;
+  __u32 pad;
+  __u64 values_ptr;
 };
 #ifdef __cplusplus
 }
diff --git a/libc/kernel/uapi/drm/vmwgfx_drm.h b/libc/kernel/uapi/drm/vmwgfx_drm.h
index 982b64f..f3a67e1 100644
--- a/libc/kernel/uapi/drm/vmwgfx_drm.h
+++ b/libc/kernel/uapi/drm/vmwgfx_drm.h
@@ -56,6 +56,9 @@
 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27
 #define DRM_VMW_GB_SURFACE_REF_EXT 28
 #define DRM_VMW_MSG 29
+#define DRM_VMW_MKSSTAT_RESET 30
+#define DRM_VMW_MKSSTAT_ADD 31
+#define DRM_VMW_MKSSTAT_REMOVE 32
 #define DRM_VMW_PARAM_NUM_STREAMS 0
 #define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
 #define DRM_VMW_PARAM_3D 2
@@ -360,6 +363,19 @@
   __s32 send_only;
   __u32 receive_len;
 };
+struct drm_vmw_mksstat_add_arg {
+  __u64 stat;
+  __u64 info;
+  __u64 strs;
+  __u64 stat_len;
+  __u64 info_len;
+  __u64 strs_len;
+  __u64 description;
+  __u64 id;
+};
+struct drm_vmw_mksstat_remove_arg {
+  __u64 id;
+};
 #ifdef __cplusplus
 }
 #endif
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index d243b97..81d0386 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -226,6 +226,7 @@
   BPF_SK_SKB_VERDICT,
   BPF_SK_REUSEPORT_SELECT,
   BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
+  BPF_PERF_EVENT,
   __MAX_BPF_ATTACH_TYPE
 };
 #define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
@@ -237,6 +238,7 @@
   BPF_LINK_TYPE_ITER = 4,
   BPF_LINK_TYPE_NETNS = 5,
   BPF_LINK_TYPE_XDP = 6,
+  BPF_LINK_TYPE_PERF_EVENT = 7,
   MAX_BPF_LINK_TYPE,
 };
 #define BPF_F_ALLOW_OVERRIDE (1U << 0)
@@ -447,6 +449,9 @@
         __aligned_u64 iter_info;
         __u32 iter_info_len;
       };
+      struct {
+        __u64 bpf_cookie;
+      } perf_event;
     };
   } link_create;
   struct {
@@ -471,7 +476,7 @@
     __u32 flags;
   } prog_bind_map;
 } __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), 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), FN(ktime_get_boot_ns), FN(seq_printf), FN(seq_write), FN(sk_cgroup_id), FN(sk_ancestor_cgroup_id), FN(ringbuf_output), FN(ringbuf_reserve), FN(ringbuf_submit), FN(ringbuf_discard), FN(ringbuf_query), FN(csum_level), FN(skc_to_tcp6_sock), FN(skc_to_tcp_sock), FN(skc_to_tcp_timewait_sock), FN(skc_to_tcp_request_sock), FN(skc_to_udp6_sock), FN(get_task_stack), FN(load_hdr_opt), FN(store_hdr_opt), FN(reserve_hdr_opt), FN(inode_storage_get), FN(inode_storage_delete), FN(d_path), FN(copy_from_user), FN(snprintf_btf), FN(seq_printf_btf), FN(skb_cgroup_classid), FN(redirect_neigh), FN(per_cpu_ptr), FN(this_cpu_ptr), FN(redirect_peer), FN(task_storage_get), FN(task_storage_delete), FN(get_current_task_btf), FN(bprm_opts_set), FN(ktime_get_coarse_ns), FN(ima_inode_hash), FN(sock_from_file), FN(check_mtu), FN(for_each_map_elem), FN(snprintf), FN(sys_bpf), FN(btf_find_by_name_kind), FN(sys_close),
+#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), FN(ktime_get_boot_ns), FN(seq_printf), FN(seq_write), FN(sk_cgroup_id), FN(sk_ancestor_cgroup_id), FN(ringbuf_output), FN(ringbuf_reserve), FN(ringbuf_submit), FN(ringbuf_discard), FN(ringbuf_query), FN(csum_level), FN(skc_to_tcp6_sock), FN(skc_to_tcp_sock), FN(skc_to_tcp_timewait_sock), FN(skc_to_tcp_request_sock), FN(skc_to_udp6_sock), FN(get_task_stack), FN(load_hdr_opt), FN(store_hdr_opt), FN(reserve_hdr_opt), FN(inode_storage_get), FN(inode_storage_delete), FN(d_path), FN(copy_from_user), FN(snprintf_btf), FN(seq_printf_btf), FN(skb_cgroup_classid), FN(redirect_neigh), FN(per_cpu_ptr), FN(this_cpu_ptr), FN(redirect_peer), FN(task_storage_get), FN(task_storage_delete), FN(get_current_task_btf), FN(bprm_opts_set), FN(ktime_get_coarse_ns), FN(ima_inode_hash), FN(sock_from_file), FN(check_mtu), FN(for_each_map_elem), FN(snprintf), FN(sys_bpf), FN(btf_find_by_name_kind), FN(sys_close), FN(timer_init), FN(timer_set_callback), FN(timer_start), FN(timer_cancel), FN(get_func_ip), FN(get_attach_cookie), FN(task_pt_regs),
 #define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
 enum bpf_func_id {
   __BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
@@ -1116,6 +1121,10 @@
 struct bpf_spin_lock {
   __u32 val;
 };
+struct bpf_timer {
+  __u64 : 64;
+  __u64 : 64;
+} __attribute__((aligned(8)));
 struct bpf_sysctl {
   __u32 write;
   __u32 file_pos;
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index c0a586c..a40e24d 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -175,6 +175,7 @@
 };
 #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
 #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
+#define BTRFS_FEATURE_COMPAT_RO_VERITY (1ULL << 2)
 #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
 #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
 #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
diff --git a/libc/kernel/uapi/linux/btrfs_tree.h b/libc/kernel/uapi/linux/btrfs_tree.h
index 4e36c37..0476733 100644
--- a/libc/kernel/uapi/linux/btrfs_tree.h
+++ b/libc/kernel/uapi/linux/btrfs_tree.h
@@ -53,6 +53,8 @@
 #define BTRFS_INODE_REF_KEY 12
 #define BTRFS_INODE_EXTREF_KEY 13
 #define BTRFS_XATTR_ITEM_KEY 24
+#define BTRFS_VERITY_DESC_ITEM_KEY 36
+#define BTRFS_VERITY_MERKLE_ITEM_KEY 37
 #define BTRFS_ORPHAN_ITEM_KEY 48
 #define BTRFS_DIR_LOG_ITEM_KEY 60
 #define BTRFS_DIR_LOG_INDEX_KEY 72
@@ -424,4 +426,9 @@
   __le64 rsv_rfer;
   __le64 rsv_excl;
 } __attribute__((__packed__));
+struct btrfs_verity_descriptor_item {
+  __le64 size;
+  __le64 reserved[2];
+  __u8 encryption;
+} __attribute__((__packed__));
 #endif
diff --git a/libc/kernel/uapi/linux/can/j1939.h b/libc/kernel/uapi/linux/can/j1939.h
index 531a222..42dbf15 100644
--- a/libc/kernel/uapi/linux/can/j1939.h
+++ b/libc/kernel/uapi/linux/can/j1939.h
@@ -50,10 +50,19 @@
 enum {
   J1939_NLA_PAD,
   J1939_NLA_BYTES_ACKED,
+  J1939_NLA_TOTAL_SIZE,
+  J1939_NLA_PGN,
+  J1939_NLA_SRC_NAME,
+  J1939_NLA_DEST_NAME,
+  J1939_NLA_SRC_ADDR,
+  J1939_NLA_DEST_ADDR,
 };
 enum {
   J1939_EE_INFO_NONE,
   J1939_EE_INFO_TX_ABORT,
+  J1939_EE_INFO_RX_RTS,
+  J1939_EE_INFO_RX_DPO,
+  J1939_EE_INFO_RX_ABORT,
 };
 struct j1939_filter {
   name_t name;
diff --git a/libc/kernel/uapi/linux/cec.h b/libc/kernel/uapi/linux/cec.h
index 238fa0a..b90dc49 100644
--- a/libc/kernel/uapi/linux/cec.h
+++ b/libc/kernel/uapi/linux/cec.h
@@ -262,7 +262,7 @@
 #define CEC_OP_REC_SEQ_WEDNESDAY 0x08
 #define CEC_OP_REC_SEQ_THURSDAY 0x10
 #define CEC_OP_REC_SEQ_FRIDAY 0x20
-#define CEC_OP_REC_SEQ_SATERDAY 0x40
+#define CEC_OP_REC_SEQ_SATURDAY 0x40
 #define CEC_OP_REC_SEQ_ONCE_ONLY 0x00
 #define CEC_MSG_CLEAR_DIGITAL_TIMER 0x99
 #define CEC_MSG_CLEAR_EXT_TIMER 0xa1
diff --git a/libc/kernel/uapi/linux/cxl_mem.h b/libc/kernel/uapi/linux/cxl_mem.h
index 2deb45e..15e9e29 100644
--- a/libc/kernel/uapi/linux/cxl_mem.h
+++ b/libc/kernel/uapi/linux/cxl_mem.h
@@ -30,7 +30,7 @@
 #define ___C(a,b) { b }
 static const struct {
   const char * name;
-} cxl_command_names[] = {
+} cxl_command_names[] __attribute__((__unused__)) = {
   CXL_CMDS
 };
 #undef ___C
diff --git a/libc/kernel/uapi/linux/dm-ioctl.h b/libc/kernel/uapi/linux/dm-ioctl.h
index 2d1dded..09f8a98 100644
--- a/libc/kernel/uapi/linux/dm-ioctl.h
+++ b/libc/kernel/uapi/linux/dm-ioctl.h
@@ -126,4 +126,5 @@
 #define DM_DATA_OUT_FLAG (1 << 16)
 #define DM_DEFERRED_REMOVE (1 << 17)
 #define DM_INTERNAL_SUSPEND_FLAG (1 << 18)
+#define DM_IMA_MEASUREMENT_FLAG (1 << 19)
 #endif
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 04a1d3d..5f9da4d 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -232,6 +232,8 @@
 enum ethtool_link_ext_substate_bad_signal_integrity {
   ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
   ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
+  ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST,
+  ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS,
 };
 enum ethtool_link_ext_substate_cable_issue {
   ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,
diff --git a/libc/kernel/uapi/linux/ethtool_netlink.h b/libc/kernel/uapi/linux/ethtool_netlink.h
index 1507a4f..f4595da 100644
--- a/libc/kernel/uapi/linux/ethtool_netlink.h
+++ b/libc/kernel/uapi/linux/ethtool_netlink.h
@@ -288,6 +288,8 @@
   ETHTOOL_A_COALESCE_TX_USECS_HIGH,
   ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH,
   ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL,
+  ETHTOOL_A_COALESCE_USE_CQE_MODE_TX,
+  ETHTOOL_A_COALESCE_USE_CQE_MODE_RX,
   __ETHTOOL_A_COALESCE_CNT,
   ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1)
 };
diff --git a/libc/kernel/uapi/linux/fanotify.h b/libc/kernel/uapi/linux/fanotify.h
index c63d058..954ce96 100644
--- a/libc/kernel/uapi/linux/fanotify.h
+++ b/libc/kernel/uapi/linux/fanotify.h
@@ -49,6 +49,7 @@
 #define FAN_UNLIMITED_QUEUE 0x00000010
 #define FAN_UNLIMITED_MARKS 0x00000020
 #define FAN_ENABLE_AUDIT 0x00000040
+#define FAN_REPORT_PIDFD 0x00000080
 #define FAN_REPORT_TID 0x00000100
 #define FAN_REPORT_FID 0x00000200
 #define FAN_REPORT_DIR_FID 0x00000400
@@ -82,6 +83,7 @@
 #define FAN_EVENT_INFO_TYPE_FID 1
 #define FAN_EVENT_INFO_TYPE_DFID_NAME 2
 #define FAN_EVENT_INFO_TYPE_DFID 3
+#define FAN_EVENT_INFO_TYPE_PIDFD 4
 struct fanotify_event_info_header {
   __u8 info_type;
   __u8 pad;
@@ -92,6 +94,10 @@
   __kernel_fsid_t fsid;
   unsigned char handle[0];
 };
+struct fanotify_event_info_pidfd {
+  struct fanotify_event_info_header hdr;
+  __s32 pidfd;
+};
 struct fanotify_response {
   __s32 fd;
   __u32 response;
@@ -100,6 +106,8 @@
 #define FAN_DENY 0x02
 #define FAN_AUDIT 0x10
 #define FAN_NOFD - 1
+#define FAN_NOPIDFD FAN_NOFD
+#define FAN_EPIDFD - 2
 #define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
 #define FAN_EVENT_NEXT(meta,len) ((len) -= (meta)->event_len, (struct fanotify_event_metadata *) (((char *) (meta)) + (meta)->event_len))
 #define FAN_EVENT_OK(meta,len) ((long) (len) >= (long) FAN_EVENT_METADATA_LEN && (long) (meta)->event_len >= (long) FAN_EVENT_METADATA_LEN && (long) (meta)->event_len <= (long) (len))
diff --git a/libc/kernel/uapi/linux/fs.h b/libc/kernel/uapi/linux/fs.h
index 0601768..3bb4183 100644
--- a/libc/kernel/uapi/linux/fs.h
+++ b/libc/kernel/uapi/linux/fs.h
@@ -129,6 +129,7 @@
 #define BLKSECDISCARD _IO(0x12, 125)
 #define BLKROTATIONAL _IO(0x12, 126)
 #define BLKZEROOUT _IO(0x12, 127)
+#define BLKGETDISKSEQ _IOR(0x12, 128, __u64)
 #define BMAP_IOCTL 1
 #define FIBMAP _IO(0x00, 1)
 #define FIGETBSZ _IO(0x00, 2)
diff --git a/libc/kernel/uapi/linux/hyperv.h b/libc/kernel/uapi/linux/hyperv.h
index daa8fc7..4790bbf 100644
--- a/libc/kernel/uapi/linux/hyperv.h
+++ b/libc/kernel/uapi/linux/hyperv.h
@@ -18,7 +18,7 @@
  ****************************************************************************/
 #ifndef _UAPI_HYPERV_H
 #define _UAPI_HYPERV_H
-#include <linux/uuid.h>
+#include <linux/types.h>
 #define UTIL_FW_MINOR 0
 #define UTIL_WS2K8_FW_MAJOR 1
 #define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
diff --git a/libc/kernel/uapi/linux/idxd.h b/libc/kernel/uapi/linux/idxd.h
index 4f1282e..2966447 100644
--- a/libc/kernel/uapi/linux/idxd.h
+++ b/libc/kernel/uapi/linux/idxd.h
@@ -19,6 +19,27 @@
 #ifndef _USR_IDXD_H_
 #define _USR_IDXD_H_
 #include <stdint.h>
+enum idxd_scmd_stat {
+  IDXD_SCMD_DEV_ENABLED = 0x80000010,
+  IDXD_SCMD_DEV_NOT_ENABLED = 0x80000020,
+  IDXD_SCMD_WQ_ENABLED = 0x80000021,
+  IDXD_SCMD_DEV_DMA_ERR = 0x80020000,
+  IDXD_SCMD_WQ_NO_GRP = 0x80030000,
+  IDXD_SCMD_WQ_NO_NAME = 0x80040000,
+  IDXD_SCMD_WQ_NO_SVM = 0x80050000,
+  IDXD_SCMD_WQ_NO_THRESH = 0x80060000,
+  IDXD_SCMD_WQ_PORTAL_ERR = 0x80070000,
+  IDXD_SCMD_WQ_RES_ALLOC_ERR = 0x80080000,
+  IDXD_SCMD_PERCPU_ERR = 0x80090000,
+  IDXD_SCMD_DMA_CHAN_ERR = 0x800a0000,
+  IDXD_SCMD_CDEV_ERR = 0x800b0000,
+  IDXD_SCMD_WQ_NO_SWQ_SUPPORT = 0x800c0000,
+  IDXD_SCMD_WQ_NONE_CONFIGURED = 0x800d0000,
+  IDXD_SCMD_WQ_NO_SIZE = 0x800e0000,
+  IDXD_SCMD_WQ_NO_PRIV = 0x800f0000,
+};
+#define IDXD_SCMD_SOFTERR_MASK 0x80000000
+#define IDXD_SCMD_SOFTERR_SHIFT 16
 #define IDXD_OP_FLAG_FENCE 0x0001
 #define IDXD_OP_FLAG_BOF 0x0002
 #define IDXD_OP_FLAG_CRAV 0x0004
diff --git a/libc/kernel/uapi/linux/if_arp.h b/libc/kernel/uapi/linux/if_arp.h
index eda888f..1cd23ef 100644
--- a/libc/kernel/uapi/linux/if_arp.h
+++ b/libc/kernel/uapi/linux/if_arp.h
@@ -44,6 +44,7 @@
 #define ARPHRD_X25 271
 #define ARPHRD_HWX25 272
 #define ARPHRD_CAN 280
+#define ARPHRD_MCTP 290
 #define ARPHRD_PPP 512
 #define ARPHRD_CISCO 513
 #define ARPHRD_HDLC ARPHRD_CISCO
diff --git a/libc/kernel/uapi/linux/if_bridge.h b/libc/kernel/uapi/linux/if_bridge.h
index 6b825ce..2054fb3 100644
--- a/libc/kernel/uapi/linux/if_bridge.h
+++ b/libc/kernel/uapi/linux/if_bridge.h
@@ -405,9 +405,11 @@
 };
 #define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
 #define BRIDGE_VLANDB_DUMPF_STATS (1 << 0)
+#define BRIDGE_VLANDB_DUMPF_GLOBAL (1 << 1)
 enum {
   BRIDGE_VLANDB_UNSPEC,
   BRIDGE_VLANDB_ENTRY,
+  BRIDGE_VLANDB_GLOBAL_OPTIONS,
   __BRIDGE_VLANDB_MAX,
 };
 #define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
@@ -418,6 +420,7 @@
   BRIDGE_VLANDB_ENTRY_STATE,
   BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
   BRIDGE_VLANDB_ENTRY_STATS,
+  BRIDGE_VLANDB_ENTRY_MCAST_ROUTER,
   __BRIDGE_VLANDB_ENTRY_MAX,
 };
 #define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
@@ -439,6 +442,28 @@
 };
 #define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
 enum {
+  BRIDGE_VLANDB_GOPTS_UNSPEC,
+  BRIDGE_VLANDB_GOPTS_ID,
+  BRIDGE_VLANDB_GOPTS_RANGE,
+  BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING,
+  BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION,
+  BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION,
+  BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT,
+  BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT,
+  BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL,
+  BRIDGE_VLANDB_GOPTS_PAD,
+  BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL,
+  BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL,
+  BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL,
+  BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL,
+  BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL,
+  BRIDGE_VLANDB_GOPTS_MCAST_QUERIER,
+  BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS,
+  BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE,
+  __BRIDGE_VLANDB_GOPTS_MAX
+};
+#define BRIDGE_VLANDB_GOPTS_MAX (__BRIDGE_VLANDB_GOPTS_MAX - 1)
+enum {
   MDBA_UNSPEC,
   MDBA_MDB,
   MDBA_ROUTER,
@@ -498,6 +523,7 @@
   MDBA_ROUTER_PATTR_TYPE,
   MDBA_ROUTER_PATTR_INET_TIMER,
   MDBA_ROUTER_PATTR_INET6_TIMER,
+  MDBA_ROUTER_PATTR_VID,
   __MDBA_ROUTER_PATTR_MAX
 };
 #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
@@ -572,10 +598,23 @@
 };
 enum br_boolopt_id {
   BR_BOOLOPT_NO_LL_LEARN,
+  BR_BOOLOPT_MCAST_VLAN_SNOOPING,
   BR_BOOLOPT_MAX
 };
 struct br_boolopt_multi {
   __u32 optval;
   __u32 optmask;
 };
+enum {
+  BRIDGE_QUERIER_UNSPEC,
+  BRIDGE_QUERIER_IP_ADDRESS,
+  BRIDGE_QUERIER_IP_PORT,
+  BRIDGE_QUERIER_IP_OTHER_TIMER,
+  BRIDGE_QUERIER_PAD,
+  BRIDGE_QUERIER_IPV6_ADDRESS,
+  BRIDGE_QUERIER_IPV6_PORT,
+  BRIDGE_QUERIER_IPV6_OTHER_TIMER,
+  __BRIDGE_QUERIER_MAX
+};
+#define BRIDGE_QUERIER_MAX (__BRIDGE_QUERIER_MAX - 1)
 #endif
diff --git a/libc/kernel/uapi/linux/if_ether.h b/libc/kernel/uapi/linux/if_ether.h
index 8405653..2890b36 100644
--- a/libc/kernel/uapi/linux/if_ether.h
+++ b/libc/kernel/uapi/linux/if_ether.h
@@ -123,6 +123,7 @@
 #define ETH_P_CAIF 0x00F7
 #define ETH_P_XDSA 0x00F8
 #define ETH_P_MAP 0x00F9
+#define ETH_P_MCTP 0x00FA
 #ifndef __UAPI_DEF_ETHHDR
 #define __UAPI_DEF_ETHHDR 1
 #endif
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 0d06cbb..6a1d89f 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -178,6 +178,7 @@
   IFLA_INET6_ICMP6STATS,
   IFLA_INET6_TOKEN,
   IFLA_INET6_ADDR_GEN_MODE,
+  IFLA_INET6_RA_MTU,
   __IFLA_INET6_MAX
 };
 #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
@@ -235,6 +236,7 @@
   IFLA_BR_MCAST_MLD_VERSION,
   IFLA_BR_VLAN_STATS_PER_PORT,
   IFLA_BR_MULTI_BOOLOPT,
+  IFLA_BR_MCAST_QUERIER_STATE,
   __IFLA_BR_MAX,
 };
 #define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
@@ -553,6 +555,7 @@
   IFLA_BOND_AD_ACTOR_SYSTEM,
   IFLA_BOND_TLB_DYNAMIC_LB,
   IFLA_BOND_PEER_NOTIF_DELAY,
+  IFLA_BOND_AD_LACP_ACTIVE,
   __IFLA_BOND_MAX,
 };
 #define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
@@ -851,4 +854,10 @@
   __u32 flags;
   __u32 mask;
 };
+enum {
+  IFLA_MCTP_UNSPEC,
+  IFLA_MCTP_NET,
+  __IFLA_MCTP_MAX,
+};
+#define IFLA_MCTP_MAX (__IFLA_MCTP_MAX - 1)
 #endif
diff --git a/libc/kernel/uapi/linux/in.h b/libc/kernel/uapi/linux/in.h
index 6f11f52..d4060e7 100644
--- a/libc/kernel/uapi/linux/in.h
+++ b/libc/kernel/uapi/linux/in.h
@@ -163,11 +163,22 @@
   struct __kernel_sockaddr_storage gsr_source;
 };
 struct group_filter {
-  __u32 gf_interface;
-  struct __kernel_sockaddr_storage gf_group;
-  __u32 gf_fmode;
-  __u32 gf_numsrc;
-  struct __kernel_sockaddr_storage gf_slist[1];
+  union {
+    struct {
+      __u32 gf_interface_aux;
+      struct __kernel_sockaddr_storage gf_group_aux;
+      __u32 gf_fmode_aux;
+      __u32 gf_numsrc_aux;
+      struct __kernel_sockaddr_storage gf_slist[1];
+    };
+    struct {
+      __u32 gf_interface;
+      struct __kernel_sockaddr_storage gf_group;
+      __u32 gf_fmode;
+      __u32 gf_numsrc;
+      struct __kernel_sockaddr_storage gf_slist_flex[];
+    };
+  };
 };
 #define GROUP_FILTER_SIZE(numsrc) (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
 #endif
diff --git a/libc/kernel/uapi/linux/in6.h b/libc/kernel/uapi/linux/in6.h
index 8dd3238..49efe3c 100644
--- a/libc/kernel/uapi/linux/in6.h
+++ b/libc/kernel/uapi/linux/in6.h
@@ -105,6 +105,7 @@
 #define IPV6_TLV_PADN 1
 #define IPV6_TLV_ROUTERALERT 5
 #define IPV6_TLV_CALIPSO 7
+#define IPV6_TLV_IOAM 49
 #define IPV6_TLV_JUMBO 194
 #define IPV6_TLV_HAO 201
 #if __UAPI_DEF_IPV6_OPTIONS
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index 622f772..17e8050 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -50,6 +50,7 @@
     __u32 splice_flags;
     __u32 rename_flags;
     __u32 unlink_flags;
+    __u32 hardlink_flags;
   };
   __u64 user_data;
   union {
@@ -57,7 +58,10 @@
     __u16 buf_group;
   } __attribute__((packed));
   __u16 personality;
-  __s32 splice_fd_in;
+  union {
+    __s32 splice_fd_in;
+    __u32 file_index;
+  };
   __u64 __pad2[2];
 };
 enum {
@@ -119,11 +123,19 @@
   IORING_OP_SHUTDOWN,
   IORING_OP_RENAMEAT,
   IORING_OP_UNLINKAT,
+  IORING_OP_MKDIRAT,
+  IORING_OP_SYMLINKAT,
+  IORING_OP_LINKAT,
   IORING_OP_LAST,
 };
 #define IORING_FSYNC_DATASYNC (1U << 0)
 #define IORING_TIMEOUT_ABS (1U << 0)
 #define IORING_TIMEOUT_UPDATE (1U << 1)
+#define IORING_TIMEOUT_BOOTTIME (1U << 2)
+#define IORING_TIMEOUT_REALTIME (1U << 3)
+#define IORING_LINK_TIMEOUT_UPDATE (1U << 4)
+#define IORING_TIMEOUT_CLOCK_MASK (IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
+#define IORING_TIMEOUT_UPDATE_MASK (IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
 #define SPLICE_F_FD_IN_FIXED (1U << 31)
 #define IORING_POLL_ADD_MULTI (1U << 0)
 #define IORING_POLL_UPDATE_EVENTS (1U << 1)
@@ -213,8 +225,13 @@
   IORING_REGISTER_BUFFERS_UPDATE = 16,
   IORING_REGISTER_IOWQ_AFF = 17,
   IORING_UNREGISTER_IOWQ_AFF = 18,
+  IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
   IORING_REGISTER_LAST
 };
+enum {
+  IO_WQ_BOUND,
+  IO_WQ_UNBOUND,
+};
 struct io_uring_files_update {
   __u32 offset;
   __u32 resv;
diff --git a/libc/kernel/uapi/linux/ioam6.h b/libc/kernel/uapi/linux/ioam6.h
new file mode 100644
index 0000000..e32c8e9
--- /dev/null
+++ b/libc/kernel/uapi/linux/ioam6.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_IOAM6_H
+#define _UAPI_LINUX_IOAM6_H
+#include <asm/byteorder.h>
+#include <linux/types.h>
+#define IOAM6_U16_UNAVAILABLE U16_MAX
+#define IOAM6_U32_UNAVAILABLE U32_MAX
+#define IOAM6_U64_UNAVAILABLE U64_MAX
+#define IOAM6_DEFAULT_ID (IOAM6_U32_UNAVAILABLE >> 8)
+#define IOAM6_DEFAULT_ID_WIDE (IOAM6_U64_UNAVAILABLE >> 8)
+#define IOAM6_DEFAULT_IF_ID IOAM6_U16_UNAVAILABLE
+#define IOAM6_DEFAULT_IF_ID_WIDE IOAM6_U32_UNAVAILABLE
+struct ioam6_hdr {
+  __u8 opt_type;
+  __u8 opt_len;
+  __u8 : 8;
+#define IOAM6_TYPE_PREALLOC 0
+  __u8 type;
+} __attribute__((packed));
+struct ioam6_trace_hdr {
+  __be16 namespace_id;
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  __u8 : 1, : 1, overflow : 1, nodelen : 5;
+  __u8 remlen : 7, : 1;
+  union {
+    __be32 type_be32;
+    struct {
+      __u32 bit7 : 1, bit6 : 1, bit5 : 1, bit4 : 1, bit3 : 1, bit2 : 1, bit1 : 1, bit0 : 1, bit15 : 1, bit14 : 1, bit13 : 1, bit12 : 1, bit11 : 1, bit10 : 1, bit9 : 1, bit8 : 1, bit23 : 1, bit22 : 1, bit21 : 1, bit20 : 1, bit19 : 1, bit18 : 1, bit17 : 1, bit16 : 1, : 8;
+    } type;
+  };
+#elif defined(__BIG_ENDIAN_BITFIELD)
+  __u8 nodelen : 5, overflow : 1, : 1, : 1;
+  __u8 : 1, remlen : 7;
+  union {
+    __be32 type_be32;
+    struct {
+      __u32 bit0 : 1, bit1 : 1, bit2 : 1, bit3 : 1, bit4 : 1, bit5 : 1, bit6 : 1, bit7 : 1, bit8 : 1, bit9 : 1, bit10 : 1, bit11 : 1, bit12 : 1, bit13 : 1, bit14 : 1, bit15 : 1, bit16 : 1, bit17 : 1, bit18 : 1, bit19 : 1, bit20 : 1, bit21 : 1, bit22 : 1, bit23 : 1, : 8;
+    } type;
+  };
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+#define IOAM6_TRACE_DATA_SIZE_MAX 244
+  __u8 data[0];
+} __attribute__((packed));
+#endif
diff --git a/libc/kernel/uapi/linux/ioam6_genl.h b/libc/kernel/uapi/linux/ioam6_genl.h
new file mode 100644
index 0000000..1d00c47
--- /dev/null
+++ b/libc/kernel/uapi/linux/ioam6_genl.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_IOAM6_GENL_H
+#define _UAPI_LINUX_IOAM6_GENL_H
+#define IOAM6_GENL_NAME "IOAM6"
+#define IOAM6_GENL_VERSION 0x1
+enum {
+  IOAM6_ATTR_UNSPEC,
+  IOAM6_ATTR_NS_ID,
+  IOAM6_ATTR_NS_DATA,
+  IOAM6_ATTR_NS_DATA_WIDE,
+#define IOAM6_MAX_SCHEMA_DATA_LEN (255 * 4)
+  IOAM6_ATTR_SC_ID,
+  IOAM6_ATTR_SC_DATA,
+  IOAM6_ATTR_SC_NONE,
+  IOAM6_ATTR_PAD,
+  __IOAM6_ATTR_MAX,
+};
+#define IOAM6_ATTR_MAX (__IOAM6_ATTR_MAX - 1)
+enum {
+  IOAM6_CMD_UNSPEC,
+  IOAM6_CMD_ADD_NAMESPACE,
+  IOAM6_CMD_DEL_NAMESPACE,
+  IOAM6_CMD_DUMP_NAMESPACES,
+  IOAM6_CMD_ADD_SCHEMA,
+  IOAM6_CMD_DEL_SCHEMA,
+  IOAM6_CMD_DUMP_SCHEMAS,
+  IOAM6_CMD_NS_SET_SCHEMA,
+  __IOAM6_CMD_MAX,
+};
+#define IOAM6_CMD_MAX (__IOAM6_CMD_MAX - 1)
+#endif
diff --git a/libc/kernel/uapi/linux/ioam6_iptunnel.h b/libc/kernel/uapi/linux/ioam6_iptunnel.h
new file mode 100644
index 0000000..31f1f74
--- /dev/null
+++ b/libc/kernel/uapi/linux/ioam6_iptunnel.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_IOAM6_IPTUNNEL_H
+#define _UAPI_LINUX_IOAM6_IPTUNNEL_H
+enum {
+  IOAM6_IPTUNNEL_UNSPEC,
+  IOAM6_IPTUNNEL_TRACE,
+  __IOAM6_IPTUNNEL_MAX,
+};
+#define IOAM6_IPTUNNEL_MAX (__IOAM6_IPTUNNEL_MAX - 1)
+#endif
diff --git a/libc/kernel/uapi/linux/ioprio.h b/libc/kernel/uapi/linux/ioprio.h
new file mode 100644
index 0000000..7a90d87
--- /dev/null
+++ b/libc/kernel/uapi/linux/ioprio.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_IOPRIO_H
+#define _UAPI_LINUX_IOPRIO_H
+#define IOPRIO_CLASS_SHIFT 13
+#define IOPRIO_CLASS_MASK 0x07
+#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
+#define IOPRIO_PRIO_CLASS(ioprio) (((ioprio) >> IOPRIO_CLASS_SHIFT) & IOPRIO_CLASS_MASK)
+#define IOPRIO_PRIO_DATA(ioprio) ((ioprio) & IOPRIO_PRIO_MASK)
+#define IOPRIO_PRIO_VALUE(class,data) ((((class) & IOPRIO_CLASS_MASK) << IOPRIO_CLASS_SHIFT) | ((data) & IOPRIO_PRIO_MASK))
+enum {
+  IOPRIO_CLASS_NONE,
+  IOPRIO_CLASS_RT,
+  IOPRIO_CLASS_BE,
+  IOPRIO_CLASS_IDLE,
+};
+#define IOPRIO_NR_LEVELS 8
+#define IOPRIO_BE_NR IOPRIO_NR_LEVELS
+enum {
+  IOPRIO_WHO_PROCESS = 1,
+  IOPRIO_WHO_PGRP,
+  IOPRIO_WHO_USER,
+};
+#define IOPRIO_NORM 4
+#define IOPRIO_BE_NORM IOPRIO_NORM
+#endif
diff --git a/libc/kernel/uapi/linux/ipv6.h b/libc/kernel/uapi/linux/ipv6.h
index 438cacc..14c818c 100644
--- a/libc/kernel/uapi/linux/ipv6.h
+++ b/libc/kernel/uapi/linux/ipv6.h
@@ -144,6 +144,9 @@
   DEVCONF_NDISC_TCLASS,
   DEVCONF_RPL_SEG_ENABLED,
   DEVCONF_RA_DEFRTR_METRIC,
+  DEVCONF_IOAM6_ENABLED,
+  DEVCONF_IOAM6_ID,
+  DEVCONF_IOAM6_ID_WIDE,
   DEVCONF_MAX
 };
 #endif
diff --git a/libc/kernel/uapi/linux/ipx.h b/libc/kernel/uapi/linux/ipx.h
deleted file mode 100644
index d8a5424..0000000
--- a/libc/kernel/uapi/linux/ipx.h
+++ /dev/null
@@ -1,90 +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 _IPX_H_
-#define _IPX_H_
-#include <linux/libc-compat.h>
-#include <linux/types.h>
-#include <linux/sockios.h>
-#include <linux/socket.h>
-#define IPX_NODE_LEN 6
-#define IPX_MTU 576
-#if __UAPI_DEF_SOCKADDR_IPX
-struct sockaddr_ipx {
-  __kernel_sa_family_t sipx_family;
-  __be16 sipx_port;
-  __be32 sipx_network;
-  unsigned char sipx_node[IPX_NODE_LEN];
-  __u8 sipx_type;
-  unsigned char sipx_zero;
-};
-#endif
-#define sipx_special sipx_port
-#define sipx_action sipx_zero
-#define IPX_DLTITF 0
-#define IPX_CRTITF 1
-#if __UAPI_DEF_IPX_ROUTE_DEFINITION
-struct ipx_route_definition {
-  __be32 ipx_network;
-  __be32 ipx_router_network;
-  unsigned char ipx_router_node[IPX_NODE_LEN];
-};
-#endif
-#if __UAPI_DEF_IPX_INTERFACE_DEFINITION
-struct ipx_interface_definition {
-  __be32 ipx_network;
-  unsigned char ipx_device[16];
-  unsigned char ipx_dlink_type;
-#define IPX_FRAME_NONE 0
-#define IPX_FRAME_SNAP 1
-#define IPX_FRAME_8022 2
-#define IPX_FRAME_ETHERII 3
-#define IPX_FRAME_8023 4
-#define IPX_FRAME_TR_8022 5
-  unsigned char ipx_special;
-#define IPX_SPECIAL_NONE 0
-#define IPX_PRIMARY 1
-#define IPX_INTERNAL 2
-  unsigned char ipx_node[IPX_NODE_LEN];
-};
-#endif
-#if __UAPI_DEF_IPX_CONFIG_DATA
-struct ipx_config_data {
-  unsigned char ipxcfg_auto_select_primary;
-  unsigned char ipxcfg_auto_create_interfaces;
-};
-#endif
-#if __UAPI_DEF_IPX_ROUTE_DEF
-struct ipx_route_def {
-  __be32 ipx_network;
-  __be32 ipx_router_network;
-#define IPX_ROUTE_NO_ROUTER 0
-  unsigned char ipx_router_node[IPX_NODE_LEN];
-  unsigned char ipx_device[16];
-  unsigned short ipx_flags;
-#define IPX_RT_SNAP 8
-#define IPX_RT_8022 4
-#define IPX_RT_BLUEBOOK 2
-#define IPX_RT_ROUTED 1
-};
-#endif
-#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
-#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1)
-#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2)
-#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3)
-#endif
diff --git a/libc/kernel/uapi/linux/kfd_ioctl.h b/libc/kernel/uapi/linux/kfd_ioctl.h
index eb355a9..c52ac64 100644
--- a/libc/kernel/uapi/linux/kfd_ioctl.h
+++ b/libc/kernel/uapi/linux/kfd_ioctl.h
@@ -21,7 +21,7 @@
 #include <drm/drm.h>
 #include <linux/ioctl.h>
 #define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 5
+#define KFD_IOCTL_MINOR_VERSION 6
 struct kfd_ioctl_get_version_args {
   __u32 major_version;
   __u32 minor_version;
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 81e752c..78e962c 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -1463,7 +1463,9 @@
 #define KVM_STATS_TYPE_CUMULATIVE (0x0 << KVM_STATS_TYPE_SHIFT)
 #define KVM_STATS_TYPE_INSTANT (0x1 << KVM_STATS_TYPE_SHIFT)
 #define KVM_STATS_TYPE_PEAK (0x2 << KVM_STATS_TYPE_SHIFT)
-#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_PEAK
+#define KVM_STATS_TYPE_LINEAR_HIST (0x3 << KVM_STATS_TYPE_SHIFT)
+#define KVM_STATS_TYPE_LOG_HIST (0x4 << KVM_STATS_TYPE_SHIFT)
+#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_LOG_HIST
 #define KVM_STATS_UNIT_SHIFT 4
 #define KVM_STATS_UNIT_MASK (0xF << KVM_STATS_UNIT_SHIFT)
 #define KVM_STATS_UNIT_NONE (0x0 << KVM_STATS_UNIT_SHIFT)
@@ -1481,7 +1483,7 @@
   __s16 exponent;
   __u16 size;
   __u32 offset;
-  __u32 unused;
+  __u32 bucket_size;
   char name[];
 };
 #define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
diff --git a/libc/kernel/uapi/linux/lightnvm.h b/libc/kernel/uapi/linux/lightnvm.h
deleted file mode 100644
index b3ac317..0000000
--- a/libc/kernel/uapi/linux/lightnvm.h
+++ /dev/null
@@ -1,167 +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_LIGHTNVM_H
-#define _UAPI_LINUX_LIGHTNVM_H
-#include <stdio.h>
-#include <sys/ioctl.h>
-#define DISK_NAME_LEN 32
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#define NVM_TTYPE_NAME_MAX 48
-#define NVM_TTYPE_MAX 63
-#define NVM_MMTYPE_LEN 8
-#define NVM_CTRL_FILE "/dev/lightnvm/control"
-struct nvm_ioctl_info_tgt {
-  __u32 version[3];
-  __u32 reserved;
-  char tgtname[NVM_TTYPE_NAME_MAX];
-};
-struct nvm_ioctl_info {
-  __u32 version[3];
-  __u16 tgtsize;
-  __u16 reserved16;
-  __u32 reserved[12];
-  struct nvm_ioctl_info_tgt tgts[NVM_TTYPE_MAX];
-};
-enum {
-  NVM_DEVICE_ACTIVE = 1 << 0,
-};
-struct nvm_ioctl_device_info {
-  char devname[DISK_NAME_LEN];
-  char bmname[NVM_TTYPE_NAME_MAX];
-  __u32 bmversion[3];
-  __u32 flags;
-  __u32 reserved[8];
-};
-struct nvm_ioctl_get_devices {
-  __u32 nr_devices;
-  __u32 reserved[31];
-  struct nvm_ioctl_device_info info[31];
-};
-struct nvm_ioctl_create_simple {
-  __u32 lun_begin;
-  __u32 lun_end;
-};
-struct nvm_ioctl_create_extended {
-  __u16 lun_begin;
-  __u16 lun_end;
-  __u16 op;
-  __u16 rsv;
-};
-enum {
-  NVM_CONFIG_TYPE_SIMPLE = 0,
-  NVM_CONFIG_TYPE_EXTENDED = 1,
-};
-struct nvm_ioctl_create_conf {
-  __u32 type;
-  union {
-    struct nvm_ioctl_create_simple s;
-    struct nvm_ioctl_create_extended e;
-  };
-};
-enum {
-  NVM_TARGET_FACTORY = 1 << 0,
-};
-struct nvm_ioctl_create {
-  char dev[DISK_NAME_LEN];
-  char tgttype[NVM_TTYPE_NAME_MAX];
-  char tgtname[DISK_NAME_LEN];
-  __u32 flags;
-  struct nvm_ioctl_create_conf conf;
-};
-struct nvm_ioctl_remove {
-  char tgtname[DISK_NAME_LEN];
-  __u32 flags;
-};
-struct nvm_ioctl_dev_init {
-  char dev[DISK_NAME_LEN];
-  char mmtype[NVM_MMTYPE_LEN];
-  __u32 flags;
-};
-enum {
-  NVM_FACTORY_ERASE_ONLY_USER = 1 << 0,
-  NVM_FACTORY_RESET_HOST_BLKS = 1 << 1,
-  NVM_FACTORY_RESET_GRWN_BBLKS = 1 << 2,
-  NVM_FACTORY_NR_BITS = 1 << 3,
-};
-struct nvm_ioctl_dev_factory {
-  char dev[DISK_NAME_LEN];
-  __u32 flags;
-};
-struct nvm_user_vio {
-  __u8 opcode;
-  __u8 flags;
-  __u16 control;
-  __u16 nppas;
-  __u16 rsvd;
-  __u64 metadata;
-  __u64 addr;
-  __u64 ppa_list;
-  __u32 metadata_len;
-  __u32 data_len;
-  __u64 status;
-  __u32 result;
-  __u32 rsvd3[3];
-};
-struct nvm_passthru_vio {
-  __u8 opcode;
-  __u8 flags;
-  __u8 rsvd[2];
-  __u32 nsid;
-  __u32 cdw2;
-  __u32 cdw3;
-  __u64 metadata;
-  __u64 addr;
-  __u32 metadata_len;
-  __u32 data_len;
-  __u64 ppa_list;
-  __u16 nppas;
-  __u16 control;
-  __u32 cdw13;
-  __u32 cdw14;
-  __u32 cdw15;
-  __u64 status;
-  __u32 result;
-  __u32 timeout_ms;
-};
-enum {
-  NVM_INFO_CMD = 0x20,
-  NVM_GET_DEVICES_CMD,
-  NVM_DEV_CREATE_CMD,
-  NVM_DEV_REMOVE_CMD,
-  NVM_DEV_INIT_CMD,
-  NVM_DEV_FACTORY_CMD,
-  NVM_DEV_VIO_ADMIN_CMD = 0x41,
-  NVM_DEV_VIO_CMD = 0x42,
-  NVM_DEV_VIO_USER_CMD = 0x43,
-};
-#define NVM_IOCTL 'L'
-#define NVM_INFO _IOWR(NVM_IOCTL, NVM_INFO_CMD, struct nvm_ioctl_info)
-#define NVM_GET_DEVICES _IOR(NVM_IOCTL, NVM_GET_DEVICES_CMD, struct nvm_ioctl_get_devices)
-#define NVM_DEV_CREATE _IOW(NVM_IOCTL, NVM_DEV_CREATE_CMD, struct nvm_ioctl_create)
-#define NVM_DEV_REMOVE _IOW(NVM_IOCTL, NVM_DEV_REMOVE_CMD, struct nvm_ioctl_remove)
-#define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, struct nvm_ioctl_dev_init)
-#define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, struct nvm_ioctl_dev_factory)
-#define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, struct nvm_passthru_vio)
-#define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD, struct nvm_passthru_vio)
-#define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD, struct nvm_user_vio)
-#define NVM_VERSION_MAJOR 1
-#define NVM_VERSION_MINOR 0
-#define NVM_VERSION_PATCHLEVEL 0
-#endif
diff --git a/libc/kernel/uapi/linux/lwtunnel.h b/libc/kernel/uapi/linux/lwtunnel.h
index f472150..e6fb536 100644
--- a/libc/kernel/uapi/linux/lwtunnel.h
+++ b/libc/kernel/uapi/linux/lwtunnel.h
@@ -29,6 +29,7 @@
   LWTUNNEL_ENCAP_BPF,
   LWTUNNEL_ENCAP_SEG6_LOCAL,
   LWTUNNEL_ENCAP_RPL,
+  LWTUNNEL_ENCAP_IOAM6,
   __LWTUNNEL_ENCAP_MAX,
 };
 #define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/mctp.h b/libc/kernel/uapi/linux/mctp.h
new file mode 100644
index 0000000..b6bee11
--- /dev/null
+++ b/libc/kernel/uapi/linux/mctp.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_MCTP_H
+#define __UAPI_MCTP_H
+#include <linux/types.h>
+#include <linux/socket.h>
+typedef __u8 mctp_eid_t;
+struct mctp_addr {
+  mctp_eid_t s_addr;
+};
+struct sockaddr_mctp {
+  __kernel_sa_family_t smctp_family;
+  __u16 __smctp_pad0;
+  unsigned int smctp_network;
+  struct mctp_addr smctp_addr;
+  __u8 smctp_type;
+  __u8 smctp_tag;
+  __u8 __smctp_pad1;
+};
+#define MCTP_NET_ANY 0x0
+#define MCTP_ADDR_NULL 0x00
+#define MCTP_ADDR_ANY 0xff
+#define MCTP_TAG_MASK 0x07
+#define MCTP_TAG_OWNER 0x08
+#endif
diff --git a/libc/kernel/uapi/linux/mempolicy.h b/libc/kernel/uapi/linux/mempolicy.h
index 4f8c02f..f92970f 100644
--- a/libc/kernel/uapi/linux/mempolicy.h
+++ b/libc/kernel/uapi/linux/mempolicy.h
@@ -25,6 +25,7 @@
   MPOL_BIND,
   MPOL_INTERLEAVE,
   MPOL_LOCAL,
+  MPOL_PREFERRED_MANY,
   MPOL_MAX,
 };
 #define MPOL_F_STATIC_NODES (1 << 15)
diff --git a/libc/kernel/uapi/linux/mount.h b/libc/kernel/uapi/linux/mount.h
index 13d0581..2099b48 100644
--- a/libc/kernel/uapi/linux/mount.h
+++ b/libc/kernel/uapi/linux/mount.h
@@ -62,7 +62,8 @@
 #define MOVE_MOUNT_T_SYMLINKS 0x00000010
 #define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020
 #define MOVE_MOUNT_T_EMPTY_PATH 0x00000040
-#define MOVE_MOUNT__MASK 0x00000077
+#define MOVE_MOUNT_SET_GROUP 0x00000100
+#define MOVE_MOUNT__MASK 0x00000177
 #define FSOPEN_CLOEXEC 0x00000001
 #define FSPICK_CLOEXEC 0x00000001
 #define FSPICK_SYMLINK_NOFOLLOW 0x00000002
diff --git a/libc/kernel/uapi/linux/mptcp.h b/libc/kernel/uapi/linux/mptcp.h
index cf156dd..c51f15e 100644
--- a/libc/kernel/uapi/linux/mptcp.h
+++ b/libc/kernel/uapi/linux/mptcp.h
@@ -72,6 +72,7 @@
 #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
 #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
 #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
+#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
 enum {
   MPTCP_PM_CMD_UNSPEC,
   MPTCP_PM_CMD_ADD_ADDR,
diff --git a/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h b/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
index 4501e53..200f1a0 100644
--- a/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -67,6 +67,7 @@
   CTA_LABELS_MASK,
   CTA_SYNPROXY,
   CTA_FILTER,
+  CTA_STATUS_MASK,
   __CTA_MAX
 };
 #define CTA_MAX (__CTA_MAX - 1)
@@ -249,6 +250,7 @@
   CTA_STATS_ERROR,
   CTA_STATS_SEARCH_RESTART,
   CTA_STATS_CLASH_RESOLVE,
+  CTA_STATS_CHAIN_TOOLONG,
   __CTA_STATS_MAX,
 };
 #define CTA_STATS_MAX (__CTA_STATS_MAX - 1)
diff --git a/libc/kernel/uapi/linux/nl80211-vnd-intel.h b/libc/kernel/uapi/linux/nl80211-vnd-intel.h
new file mode 100644
index 0000000..9ade75a
--- /dev/null
+++ b/libc/kernel/uapi/linux/nl80211-vnd-intel.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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 __VENDOR_CMD_INTEL_H__
+#define __VENDOR_CMD_INTEL_H__
+#define INTEL_OUI 0x001735
+enum iwl_mvm_vendor_cmd {
+  IWL_MVM_VENDOR_CMD_GET_CSME_CONN_INFO = 0x2d,
+  IWL_MVM_VENDOR_CMD_HOST_GET_OWNERSHIP = 0x30,
+  IWL_MVM_VENDOR_CMD_ROAMING_FORBIDDEN_EVENT = 0x32,
+};
+enum iwl_vendor_auth_akm_mode {
+  IWL_VENDOR_AUTH_OPEN,
+  IWL_VENDOR_AUTH_RSNA = 0x6,
+  IWL_VENDOR_AUTH_RSNA_PSK,
+  IWL_VENDOR_AUTH_SAE = 0x9,
+  IWL_VENDOR_AUTH_MAX,
+};
+enum iwl_mvm_vendor_attr {
+  __IWL_MVM_VENDOR_ATTR_INVALID = 0x00,
+  IWL_MVM_VENDOR_ATTR_VIF_ADDR = 0x02,
+  IWL_MVM_VENDOR_ATTR_ADDR = 0x0a,
+  IWL_MVM_VENDOR_ATTR_SSID = 0x3d,
+  IWL_MVM_VENDOR_ATTR_STA_CIPHER = 0x51,
+  IWL_MVM_VENDOR_ATTR_ROAMING_FORBIDDEN = 0x64,
+  IWL_MVM_VENDOR_ATTR_AUTH_MODE = 0x65,
+  IWL_MVM_VENDOR_ATTR_CHANNEL_NUM = 0x66,
+  IWL_MVM_VENDOR_ATTR_BAND = 0x69,
+  IWL_MVM_VENDOR_ATTR_COLLOC_CHANNEL = 0x70,
+  IWL_MVM_VENDOR_ATTR_COLLOC_ADDR = 0x71,
+  NUM_IWL_MVM_VENDOR_ATTR,
+  MAX_IWL_MVM_VENDOR_ATTR = NUM_IWL_MVM_VENDOR_ATTR - 1,
+};
+#endif
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index 68ee90c..e5c9f8a 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -178,6 +178,11 @@
   NL80211_CMD_UNPROT_BEACON,
   NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
   NL80211_CMD_SET_SAR_SPECS,
+  NL80211_CMD_OBSS_COLOR_COLLISION,
+  NL80211_CMD_COLOR_CHANGE_REQUEST,
+  NL80211_CMD_COLOR_CHANGE_STARTED,
+  NL80211_CMD_COLOR_CHANGE_ABORTED,
+  NL80211_CMD_COLOR_CHANGE_COMPLETED,
   __NL80211_CMD_AFTER_LAST,
   NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
 };
@@ -496,6 +501,10 @@
   NL80211_ATTR_RECONNECT_REQUESTED,
   NL80211_ATTR_SAR_SPEC,
   NL80211_ATTR_DISABLE_HE,
+  NL80211_ATTR_OBSS_COLOR_BITMAP,
+  NL80211_ATTR_COLOR_CHANGE_COUNT,
+  NL80211_ATTR_COLOR_CHANGE_COLOR,
+  NL80211_ATTR_COLOR_CHANGE_ELEMS,
   __NL80211_ATTR_AFTER_LAST,
   NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
   NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -1453,6 +1462,7 @@
   NL80211_EXT_FEATURE_SECURE_LTF,
   NL80211_EXT_FEATURE_SECURE_RTT,
   NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE,
+  NL80211_EXT_FEATURE_BSS_COLOR,
   NUM_NL80211_EXT_FEATURES,
   MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
 };
diff --git a/libc/kernel/uapi/linux/openvswitch.h b/libc/kernel/uapi/linux/openvswitch.h
index 7db5cd5..1f8ae17 100644
--- a/libc/kernel/uapi/linux/openvswitch.h
+++ b/libc/kernel/uapi/linux/openvswitch.h
@@ -43,6 +43,7 @@
   OVS_DP_ATTR_USER_FEATURES,
   OVS_DP_ATTR_PAD,
   OVS_DP_ATTR_MASKS_CACHE_SIZE,
+  OVS_DP_ATTR_PER_CPU_PIDS,
   __OVS_DP_ATTR_MAX
 };
 #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
@@ -72,6 +73,7 @@
 #define OVS_DP_F_UNALIGNED (1 << 0)
 #define OVS_DP_F_VPORT_PIDS (1 << 1)
 #define OVS_DP_F_TC_RECIRC_SHARING (1 << 2)
+#define OVS_DP_F_DISPATCH_UPCALL_PER_CPU (1 << 3)
 #define OVSP_LOCAL ((__u32) 0)
 #define OVS_PACKET_FAMILY "ovs_packet"
 #define OVS_PACKET_VERSION 0x1
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index d0541fc..6dc8a19 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -613,6 +613,7 @@
   __u32 dropping;
   __u32 ce_mark;
 };
+#define FQ_CODEL_QUANTUM_MAX (1 << 20)
 enum {
   TCA_FQ_CODEL_UNSPEC,
   TCA_FQ_CODEL_TARGET,
diff --git a/libc/kernel/uapi/linux/prctl.h b/libc/kernel/uapi/linux/prctl.h
index 907064d..7a4b2d7 100644
--- a/libc/kernel/uapi/linux/prctl.h
+++ b/libc/kernel/uapi/linux/prctl.h
@@ -138,6 +138,7 @@
 #define PR_SET_SPECULATION_CTRL 53
 #define PR_SPEC_STORE_BYPASS 0
 #define PR_SPEC_INDIRECT_BRANCH 1
+#define PR_SPEC_L1D_FLUSH 2
 #define PR_SPEC_NOT_AFFECTED 0
 #define PR_SPEC_PRCTL (1UL << 0)
 #define PR_SPEC_ENABLE (1UL << 1)
@@ -153,13 +154,13 @@
 #define PR_SET_TAGGED_ADDR_CTRL 55
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE (1UL << 0)
-#define PR_MTE_TCF_SHIFT 1
-#define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
-#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_TCF_NONE 0
+#define PR_MTE_TCF_SYNC (1UL << 1)
+#define PR_MTE_TCF_ASYNC (1UL << 2)
+#define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)
 #define PR_MTE_TAG_SHIFT 3
 #define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
+#define PR_MTE_TCF_SHIFT 1
 #define PR_SET_IO_FLUSHER 57
 #define PR_GET_IO_FLUSHER 58
 #define PR_SET_SYSCALL_USER_DISPATCH 59
diff --git a/libc/kernel/uapi/linux/socket.h b/libc/kernel/uapi/linux/socket.h
index 7ce5304..be16548 100644
--- a/libc/kernel/uapi/linux/socket.h
+++ b/libc/kernel/uapi/linux/socket.h
@@ -29,4 +29,7 @@
     void * __align;
   };
 };
+#define SOCK_SNDBUF_LOCK 1
+#define SOCK_RCVBUF_LOCK 2
+#define SOCK_BUF_LOCK_MASK (SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK)
 #endif
diff --git a/libc/kernel/uapi/linux/target_core_user.h b/libc/kernel/uapi/linux/target_core_user.h
index e0b9f22..dcba00e 100644
--- a/libc/kernel/uapi/linux/target_core_user.h
+++ b/libc/kernel/uapi/linux/target_core_user.h
@@ -26,6 +26,7 @@
 #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0)
 #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1)
 #define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2)
+#define TCMU_MAILBOX_FLAG_CAP_KEEP_BUF (1 << 3)
 struct tcmu_mailbox {
   __u16 version;
   __u16 flags;
@@ -45,6 +46,7 @@
   __u8 kflags;
 #define TCMU_UFLAG_UNKNOWN_OP 0x1
 #define TCMU_UFLAG_READ_LEN 0x2
+#define TCMU_UFLAG_KEEP_BUF 0x4
   __u8 uflags;
 } __packed;
 #define TCMU_OP_MASK 0x7
diff --git a/libc/kernel/uapi/linux/tc_act/tc_skbmod.h b/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
index 0a53b06..f0cd928 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_skbmod.h
@@ -23,6 +23,7 @@
 #define SKBMOD_F_SMAC 0x2
 #define SKBMOD_F_ETYPE 0x4
 #define SKBMOD_F_SWAPMAC 0x8
+#define SKBMOD_F_ECN 0x10
 struct tc_skbmod {
   tc_gen;
   __u64 flags;
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 28ee31d..0251059 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -325,6 +325,7 @@
 #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (V4L2_CID_CODEC_BASE + 233)
 #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE + 234)
 #define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE + 235)
+#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE + 236)
 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE + 270)
 enum v4l2_mpeg_video_mpeg2_level {
   V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0,
diff --git a/libc/kernel/uapi/linux/vduse.h b/libc/kernel/uapi/linux/vduse.h
new file mode 100644
index 0000000..2dc8c82
--- /dev/null
+++ b/libc/kernel/uapi/linux/vduse.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_VDUSE_H_
+#define _UAPI_VDUSE_H_
+#include <linux/types.h>
+#define VDUSE_BASE 0x81
+#define VDUSE_API_VERSION 0
+#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64)
+#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64)
+struct vduse_dev_config {
+#define VDUSE_NAME_MAX 256
+  char name[VDUSE_NAME_MAX];
+  __u32 vendor_id;
+  __u32 device_id;
+  __u64 features;
+  __u32 vq_num;
+  __u32 vq_align;
+  __u32 reserved[13];
+  __u32 config_size;
+  __u8 config[];
+};
+#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config)
+#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX])
+struct vduse_iotlb_entry {
+  __u64 offset;
+  __u64 start;
+  __u64 last;
+#define VDUSE_ACCESS_RO 0x1
+#define VDUSE_ACCESS_WO 0x2
+#define VDUSE_ACCESS_RW 0x3
+  __u8 perm;
+};
+#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry)
+#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64)
+struct vduse_config_data {
+  __u32 offset;
+  __u32 length;
+  __u8 buffer[];
+};
+#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data)
+#define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13)
+struct vduse_vq_config {
+  __u32 index;
+  __u16 max_size;
+  __u16 reserved[13];
+};
+#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config)
+struct vduse_vq_state_split {
+  __u16 avail_index;
+};
+struct vduse_vq_state_packed {
+  __u16 last_avail_counter;
+  __u16 last_avail_idx;
+  __u16 last_used_counter;
+  __u16 last_used_idx;
+};
+struct vduse_vq_info {
+  __u32 index;
+  __u32 num;
+  __u64 desc_addr;
+  __u64 driver_addr;
+  __u64 device_addr;
+  union {
+    struct vduse_vq_state_split split;
+    struct vduse_vq_state_packed packed;
+  };
+  __u8 ready;
+};
+#define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info)
+struct vduse_vq_eventfd {
+  __u32 index;
+#define VDUSE_EVENTFD_DEASSIGN - 1
+  int fd;
+};
+#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
+#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
+enum vduse_req_type {
+  VDUSE_GET_VQ_STATE,
+  VDUSE_SET_STATUS,
+  VDUSE_UPDATE_IOTLB,
+};
+struct vduse_vq_state {
+  __u32 index;
+  union {
+    struct vduse_vq_state_split split;
+    struct vduse_vq_state_packed packed;
+  };
+};
+struct vduse_dev_status {
+  __u8 status;
+};
+struct vduse_iova_range {
+  __u64 start;
+  __u64 last;
+};
+struct vduse_dev_request {
+  __u32 type;
+  __u32 request_id;
+  __u32 reserved[4];
+  union {
+    struct vduse_vq_state vq_state;
+    struct vduse_dev_status s;
+    struct vduse_iova_range iova;
+    __u32 padding[32];
+  };
+};
+struct vduse_dev_response {
+  __u32 request_id;
+#define VDUSE_REQ_RESULT_OK 0x00
+#define VDUSE_REQ_RESULT_FAILED 0x01
+  __u32 result;
+  __u32 reserved[4];
+  union {
+    struct vduse_vq_state vq_state;
+    __u32 padding[32];
+  };
+};
+#endif
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index a2528a6..71a3f77 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,8 +16,8 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#define LINUX_VERSION_CODE 331264
+#define LINUX_VERSION_CODE 331520
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
 #define LINUX_VERSION_MAJOR 5
-#define LINUX_VERSION_PATCHLEVEL 14
+#define LINUX_VERSION_PATCHLEVEL 15
 #define LINUX_VERSION_SUBLEVEL 0
diff --git a/libc/kernel/uapi/linux/virtio_gpio.h b/libc/kernel/uapi/linux/virtio_gpio.h
new file mode 100644
index 0000000..769bfcf
--- /dev/null
+++ b/libc/kernel/uapi/linux/virtio_gpio.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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 _LINUX_VIRTIO_GPIO_H
+#define _LINUX_VIRTIO_GPIO_H
+#include <linux/types.h>
+#define VIRTIO_GPIO_MSG_GET_NAMES 0x0001
+#define VIRTIO_GPIO_MSG_GET_DIRECTION 0x0002
+#define VIRTIO_GPIO_MSG_SET_DIRECTION 0x0003
+#define VIRTIO_GPIO_MSG_GET_VALUE 0x0004
+#define VIRTIO_GPIO_MSG_SET_VALUE 0x0005
+#define VIRTIO_GPIO_STATUS_OK 0x0
+#define VIRTIO_GPIO_STATUS_ERR 0x1
+#define VIRTIO_GPIO_DIRECTION_NONE 0x00
+#define VIRTIO_GPIO_DIRECTION_OUT 0x01
+#define VIRTIO_GPIO_DIRECTION_IN 0x02
+struct virtio_gpio_config {
+  __le16 ngpio;
+  __u8 padding[2];
+  __le32 gpio_names_size;
+} __packed;
+struct virtio_gpio_request {
+  __le16 type;
+  __le16 gpio;
+  __le32 value;
+};
+struct virtio_gpio_response {
+  __u8 status;
+  __u8 value;
+};
+struct virtio_gpio_response_get_names {
+  __u8 status;
+  __u8 value[];
+};
+#endif
diff --git a/libc/kernel/uapi/linux/virtio_i2c.h b/libc/kernel/uapi/linux/virtio_i2c.h
new file mode 100644
index 0000000..eaba517
--- /dev/null
+++ b/libc/kernel/uapi/linux/virtio_i2c.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_VIRTIO_I2C_H
+#define _UAPI_LINUX_VIRTIO_I2C_H
+#include <linux/const.h>
+#include <linux/types.h>
+#define VIRTIO_I2C_FLAGS_FAIL_NEXT _BITUL(0)
+struct virtio_i2c_out_hdr {
+  __le16 addr;
+  __le16 padding;
+  __le32 flags;
+};
+struct virtio_i2c_in_hdr {
+  __u8 status;
+};
+#define VIRTIO_I2C_MSG_OK 0
+#define VIRTIO_I2C_MSG_ERR 1
+#endif
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index cf2c864..2894700 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -43,8 +43,20 @@
 #define VIRTIO_ID_SOUND 25
 #define VIRTIO_ID_FS 26
 #define VIRTIO_ID_PMEM 27
+#define VIRTIO_ID_RPMB 28
 #define VIRTIO_ID_MAC80211_HWSIM 29
+#define VIRTIO_ID_VIDEO_ENCODER 30
+#define VIRTIO_ID_VIDEO_DECODER 31
+#define VIRTIO_ID_SCMI 32
+#define VIRTIO_ID_NITRO_SEC_MOD 33
+#define VIRTIO_ID_I2C_ADAPTER 34
+#define VIRTIO_ID_WATCHDOG 35
+#define VIRTIO_ID_CAN 36
+#define VIRTIO_ID_DMABUF 37
+#define VIRTIO_ID_PARAM_SERV 38
+#define VIRTIO_ID_AUDIO_POLICY 39
 #define VIRTIO_ID_BT 40
+#define VIRTIO_ID_GPIO 41
 #define VIRTIO_TRANS_ID_NET 1000
 #define VIRTIO_TRANS_ID_BLOCK 1001
 #define VIRTIO_TRANS_ID_BALLOON 1002
diff --git a/libc/kernel/uapi/linux/virtio_scmi.h b/libc/kernel/uapi/linux/virtio_scmi.h
new file mode 100644
index 0000000..7907ed4
--- /dev/null
+++ b/libc/kernel/uapi/linux/virtio_scmi.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   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_VIRTIO_SCMI_H
+#define _UAPI_LINUX_VIRTIO_SCMI_H
+#include <linux/virtio_types.h>
+#define VIRTIO_SCMI_F_P2A_CHANNELS 0
+#define VIRTIO_SCMI_F_SHARED_MEMORY 1
+#define VIRTIO_SCMI_VQ_TX 0
+#define VIRTIO_SCMI_VQ_RX 1
+#define VIRTIO_SCMI_VQ_MAX_CNT 2
+#endif
diff --git a/libc/kernel/uapi/linux/virtio_vsock.h b/libc/kernel/uapi/linux/virtio_vsock.h
index bff6164..73b5d49 100644
--- a/libc/kernel/uapi/linux/virtio_vsock.h
+++ b/libc/kernel/uapi/linux/virtio_vsock.h
@@ -62,6 +62,7 @@
   VIRTIO_VSOCK_SHUTDOWN_SEND = 2,
 };
 enum virtio_vsock_rw {
-  VIRTIO_VSOCK_SEQ_EOR = 1,
+  VIRTIO_VSOCK_SEQ_EOM = 1,
+  VIRTIO_VSOCK_SEQ_EOR = 2,
 };
 #endif
diff --git a/libc/kernel/uapi/linux/xfrm.h b/libc/kernel/uapi/linux/xfrm.h
index b0e930c..e40b7e3 100644
--- a/libc/kernel/uapi/linux/xfrm.h
+++ b/libc/kernel/uapi/linux/xfrm.h
@@ -182,6 +182,10 @@
 #define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
   XFRM_MSG_MAPPING,
 #define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
+  XFRM_MSG_SETDEFAULT,
+#define XFRM_MSG_SETDEFAULT XFRM_MSG_SETDEFAULT
+  XFRM_MSG_GETDEFAULT,
+#define XFRM_MSG_GETDEFAULT XFRM_MSG_GETDEFAULT
   __XFRM_MSG_MAX
 };
 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -430,6 +434,14 @@
 };
 #define XFRM_OFFLOAD_IPV6 1
 #define XFRM_OFFLOAD_INBOUND 2
+struct xfrm_userpolicy_default {
+#define XFRM_USERPOLICY_UNSPEC 0
+#define XFRM_USERPOLICY_BLOCK 1
+#define XFRM_USERPOLICY_ACCEPT 2
+  __u8 in;
+  __u8 fwd;
+  __u8 out;
+};
 #define XFRMGRP_ACQUIRE 1
 #define XFRMGRP_EXPIRE 2
 #define XFRMGRP_SA 4
diff --git a/libc/kernel/uapi/misc/habanalabs.h b/libc/kernel/uapi/misc/habanalabs.h
index ba905f8..83e8a19 100644
--- a/libc/kernel/uapi/misc/habanalabs.h
+++ b/libc/kernel/uapi/misc/habanalabs.h
@@ -235,7 +235,16 @@
   HL_DEVICE_STATUS_OPERATIONAL,
   HL_DEVICE_STATUS_IN_RESET,
   HL_DEVICE_STATUS_MALFUNCTION,
-  HL_DEVICE_STATUS_NEEDS_RESET
+  HL_DEVICE_STATUS_NEEDS_RESET,
+  HL_DEVICE_STATUS_IN_DEVICE_CREATION,
+  HL_DEVICE_STATUS_LAST = HL_DEVICE_STATUS_IN_DEVICE_CREATION
+};
+enum hl_server_type {
+  HL_SERVER_TYPE_UNKNOWN = 0,
+  HL_SERVER_GAUDI_HLS1 = 1,
+  HL_SERVER_GAUDI_HLS1H = 2,
+  HL_SERVER_GAUDI_TYPE1 = 3,
+  HL_SERVER_GAUDI_TYPE2 = 4
 };
 #define HL_INFO_HW_IP_INFO 0
 #define HL_INFO_HW_EVENTS 1
@@ -267,7 +276,7 @@
   __u32 module_id;
   __u32 reserved;
   __u16 first_available_interrupt_id;
-  __u16 reserved2;
+  __u16 server_type;
   __u32 cpld_version;
   __u32 psoc_pci_pll_nr;
   __u32 psoc_pci_pll_nf;
@@ -278,7 +287,7 @@
   __u8 pad[2];
   __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
   __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
-  __u64 reserved3;
+  __u64 reserved2;
   __u64 dram_page_size;
 };
 struct hl_info_dram_usage {
@@ -403,11 +412,13 @@
   union {
     __u64 cb_handle;
     __u64 signal_seq_arr;
+    __u64 encaps_signal_seq;
   };
   __u32 queue_index;
   union {
     __u32 cb_size;
     __u32 num_signal_seq_arr;
+    __u32 encaps_signal_offset;
   };
   __u32 cs_chunk_flags;
   __u32 collective_engine_id;
@@ -423,12 +434,22 @@
 #define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100
 #define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200
 #define HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT 0x400
+#define HL_CS_FLAGS_ENCAP_SIGNALS 0x800
+#define HL_CS_FLAGS_RESERVE_SIGNALS_ONLY 0x1000
+#define HL_CS_FLAGS_UNRESERVE_SIGNALS_ONLY 0x2000
 #define HL_CS_STATUS_SUCCESS 0
 #define HL_MAX_JOBS_PER_CS 512
 struct hl_cs_in {
   __u64 chunks_restore;
   __u64 chunks_execute;
-  __u64 seq;
+  union {
+    __u64 seq;
+    __u32 encaps_sig_handle_id;
+    struct {
+      __u32 encaps_signals_count;
+      __u32 encaps_signals_q_idx;
+    };
+  };
   __u32 num_chunks_restore;
   __u32 num_chunks_execute;
   __u32 timeout;
@@ -436,9 +457,15 @@
   __u32 ctx_id;
 };
 struct hl_cs_out {
-  __u64 seq;
+  union {
+    __u64 seq;
+    struct {
+      __u32 handle_id;
+      __u32 count;
+    };
+  };
   __u32 status;
-  __u32 pad;
+  __u32 sob_base_addr_offset;
 };
 union hl_cs_args {
   struct hl_cs_in in;
@@ -446,6 +473,8 @@
 };
 #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2
 #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000
+#define HL_WAIT_CS_FLAGS_MULTI_CS 0x4
+#define HL_WAIT_MULTI_CS_LIST_MAX_LEN 32
 struct hl_wait_cs_in {
   union {
     struct {
@@ -460,18 +489,21 @@
   };
   __u32 ctx_id;
   __u32 flags;
+  __u8 seq_arr_len;
+  __u8 pad[7];
 };
 #define HL_WAIT_CS_STATUS_COMPLETED 0
 #define HL_WAIT_CS_STATUS_BUSY 1
 #define HL_WAIT_CS_STATUS_TIMEDOUT 2
 #define HL_WAIT_CS_STATUS_ABORTED 3
-#define HL_WAIT_CS_STATUS_INTERRUPTED 4
 #define HL_WAIT_CS_STATUS_FLAG_GONE 0x1
 #define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2
 struct hl_wait_cs_out {
   __u32 status;
   __u32 flags;
   __s64 timestamp_nsec;
+  __u32 cs_completion_map;
+  __u32 pad;
 };
 union hl_wait_cs_args {
   struct hl_wait_cs_in in;
@@ -485,6 +517,7 @@
 #define HL_MEM_CONTIGUOUS 0x1
 #define HL_MEM_SHARED 0x2
 #define HL_MEM_USERPTR 0x4
+#define HL_MEM_FORCE_HINT 0x8
 struct hl_mem_in {
   union {
     struct {
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index 292c258..aadb20e 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -33,6 +33,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,
+  MLX5_QP_FLAG_DCI_STREAM = 1 << 11,
 };
 enum {
   MLX5_SRQ_FLAG_SIGNATURE = 1 << 0,
@@ -165,6 +166,10 @@
   __u32 supported_qpts;
   __u32 reserved;
 };
+struct mlx5_ib_dci_streams_caps {
+  __u8 max_log_num_concurent;
+  __u8 max_log_num_errored;
+};
 enum mlx5_ib_query_dev_resp_flags {
   MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_COMP = 1 << 0,
   MLX5_IB_QUERY_DEV_RESP_FLAGS_CQE_128B_PAD = 1 << 1,
@@ -190,7 +195,8 @@
   struct mlx5_ib_sw_parsing_caps sw_parsing_caps;
   struct mlx5_ib_striding_rq_caps striding_rq_caps;
   __u32 tunnel_offloads_caps;
-  __u32 reserved;
+  struct mlx5_ib_dci_streams_caps dci_streams_caps;
+  __u16 reserved;
 };
 enum mlx5_ib_create_cq_flags {
   MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,
@@ -230,6 +236,10 @@
   __u32 srqn;
   __u32 reserved;
 };
+struct mlx5_ib_create_qp_dci_streams {
+  __u8 log_num_concurent;
+  __u8 log_num_errored;
+};
 struct mlx5_ib_create_qp {
   __aligned_u64 buf_addr;
   __aligned_u64 db_addr;
@@ -244,7 +254,8 @@
     __aligned_u64 access_key;
   };
   __u32 ece_options;
-  __u32 reserved;
+  struct mlx5_ib_create_qp_dci_streams dci_streams;
+  __u16 reserved;
 };
 enum mlx5_rx_hash_function_flags {
   MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
diff --git a/libc/kernel/uapi/scsi/fc/fc_els.h b/libc/kernel/uapi/scsi/fc/fc_els.h
index f31e764..04ae5b8 100644
--- a/libc/kernel/uapi/scsi/fc/fc_els.h
+++ b/libc/kernel/uapi/scsi/fc/fc_els.h
@@ -42,6 +42,7 @@
   ELS_REC = 0x13,
   ELS_SRR = 0x14,
   ELS_FPIN = 0x16,
+  ELS_EDC = 0x17,
   ELS_RDP = 0x18,
   ELS_RDF = 0x19,
   ELS_PRLI = 0x20,
@@ -85,7 +86,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_RDP] = "RDP",[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", \
+#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_EDC] = "EDC",[ELS_RDP] = "RDP",[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;
@@ -128,13 +129,15 @@
 };
 enum fc_ls_tlv_dtag {
   ELS_DTAG_LS_REQ_INFO = 0x00000001,
+  ELS_DTAG_LNK_FAULT_CAP = 0x0001000D,
+  ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F,
   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" }, \
+#define FC_LS_TLV_DTAG_INIT { { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, { ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, { ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, { 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;
@@ -668,4 +671,48 @@
   struct fc_els_lsri_desc lsri;
   struct fc_tlv_desc desc[0];
 };
+struct fc_diag_lnkflt_desc {
+  __be32 desc_tag;
+  __be32 desc_len;
+  __be32 degrade_activate_threshold;
+  __be32 degrade_deactivate_threshold;
+  __be32 fec_degrade_interval;
+};
+enum fc_edc_cg_signal_cap_types {
+  EDC_CG_SIG_NOTSUPPORTED = 0x00,
+  EDC_CG_SIG_WARN_ONLY = 0x01,
+  EDC_CG_SIG_WARN_ALARM = 0x02,
+};
+#define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { { EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, { EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, { EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \
+}
+enum fc_diag_cg_sig_freq_types {
+  EDC_CG_SIGFREQ_CNT_MIN = 1,
+  EDC_CG_SIGFREQ_CNT_MAX = 999,
+  EDC_CG_SIGFREQ_SEC = 0x1,
+  EDC_CG_SIGFREQ_MSEC = 0x2,
+};
+struct fc_diag_cg_sig_freq {
+  __be16 count;
+  __be16 units;
+};
+struct fc_diag_cg_sig_desc {
+  __be32 desc_tag;
+  __be32 desc_len;
+  __be32 xmt_signal_capability;
+  struct fc_diag_cg_sig_freq xmt_signal_frequency;
+  __be32 rcv_signal_capability;
+  struct fc_diag_cg_sig_freq rcv_signal_frequency;
+};
+struct fc_els_edc {
+  __u8 edc_cmd;
+  __u8 edc_zero[3];
+  __be32 desc_len;
+  struct fc_tlv_desc desc[0];
+};
+struct fc_els_edc_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/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index ef3c311..441f1d4 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -234,6 +234,7 @@
 #define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000
 #define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000
 #define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000
+#define SNDRV_PCM_INFO_EXPLICIT_SYNC 0x10000000
 #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000
 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000
 #if __BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)
@@ -621,6 +622,7 @@
 };
 #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
 #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
 #define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
 #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
 #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
diff --git a/libc/kernel/uapi/sound/snd_sst_tokens.h b/libc/kernel/uapi/sound/snd_sst_tokens.h
index 85a99c7..bf012fa 100644
--- a/libc/kernel/uapi/sound/snd_sst_tokens.h
+++ b/libc/kernel/uapi/sound/snd_sst_tokens.h
@@ -97,6 +97,7 @@
   SKL_TKN_U32_ASTATE_COUNT,
   SKL_TKN_U32_ASTATE_KCPS,
   SKL_TKN_U32_ASTATE_CLK_SRC,
-  SKL_TKN_MAX = SKL_TKN_U32_ASTATE_CLK_SRC,
+  SKL_TKN_U32_FMT_CFG_IDX = 96,
+  SKL_TKN_MAX = SKL_TKN_U32_FMT_CFG_IDX,
 };
 #endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 8ede380..7397b68 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -631,7 +631,7 @@
     mbsinit;
     mbsnrtowcs; # introduced=21
     mbsrtowcs;
-    mbstowcs;
+    mbstowcs; # introduced=21
     mbtowc; # introduced=21
     memalign;
     memccpy;
@@ -1194,7 +1194,7 @@
     wcstold_l; # introduced=21
     wcstoll; # introduced=21
     wcstoll_l; # introduced=21
-    wcstombs;
+    wcstombs; # introduced=21
     wcstoul;
     wcstoull; # introduced=21
     wcstoull_l; # introduced=21
@@ -1565,6 +1565,17 @@
     process_madvise;
 } LIBC_R;
 
+LIBC_T { # introduced=Tiramisu
+  global:
+    backtrace;
+    backtrace_symbols;
+    backtrace_symbols_fd;
+    preadv2;
+    preadv64v2;
+    pwritev2;
+    pwritev64v2;
+} LIBC_S;
+
 LIBC_PRIVATE {
   global:
     __accept4; # arm x86
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 3b3a22e..f779b73 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -37,12 +37,6 @@
     },
     native_coverage: false,
 
-    target: {
-        android: {
-            static_libs: ["libc++demangle"],
-        },
-    },
-
     // -Wno-error=format-zero-length needed for gcc to compile.
     cflags: [
         "-Wall",
@@ -125,6 +119,7 @@
 // ==============================================================
 cc_test {
     name: "malloc_debug_unit_tests",
+    test_suites: ["device-tests"],
 
     srcs: [
         "tests/backtrace_fake.cpp",
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index 128991b..dbaebb3 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -87,7 +87,7 @@
 void UnwindLog(const std::vector<unwindstack::LocalFrameData>& frame_info) {
   for (size_t i = 0; i < frame_info.size(); i++) {
     const unwindstack::LocalFrameData* info = &frame_info[i];
-    unwindstack::MapInfo* map_info = info->map_info;
+    std::shared_ptr<unwindstack::MapInfo> map_info = info->map_info;
 
     std::string line = android::base::StringPrintf("          #%0zd  pc %" PAD_PTR "  ", i, info->rel_pc);
     if (map_info->offset() != 0) {
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index 1298df7..7b58f31 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -1528,19 +1528,18 @@
 TEST_F(MallocDebugTest, backtrace_full_dump_on_exit) {
   pid_t pid;
   if ((pid = fork()) == 0) {
+    std::shared_ptr<unwindstack::MapInfo> empty_map;
     Init("backtrace=4 backtrace_full backtrace_dump_on_exit");
+    BacktraceUnwindFake(std::vector<unwindstack::LocalFrameData>{
+        {empty_map, 0x1100, 0x100, "fake1", 10}, {empty_map, 0x1200, 0x200, "fake2", 20}});
+    std::shared_ptr<unwindstack::MapInfo> map_info =
+        unwindstack::MapInfo::Create(0x10000, 0x20000, 0, PROT_READ | PROT_EXEC, "/data/fake.so");
+    BacktraceUnwindFake(std::vector<unwindstack::LocalFrameData>{
+        {map_info, 0x1a000, 0xa000, "level1", 0}, {map_info, 0x1b000, 0xb000, "level2", 10}});
     BacktraceUnwindFake(
-      std::vector<unwindstack::LocalFrameData>{{nullptr, 0x1100, 0x100, "fake1", 10},
-                                               {nullptr, 0x1200, 0x200, "fake2", 20}});
-    unwindstack::MapInfo map_info{nullptr, nullptr, 0x10000, 0x20000, 0,
-                                  PROT_READ | PROT_EXEC, "/data/fake.so"};
-    BacktraceUnwindFake(
-      std::vector<unwindstack::LocalFrameData>{{&map_info, 0x1a000, 0xa000, "level1", 0},
-                                               {&map_info, 0x1b000, 0xb000, "level2", 10}});
-    BacktraceUnwindFake(
-      std::vector<unwindstack::LocalFrameData>{{nullptr, 0x1a000, 0xa000, "func1", 0},
-                                               {nullptr, 0x1b000, 0xb000, "func2", 10},
-                                               {nullptr, 0x1c000, 0xc000, "", 30}});
+        std::vector<unwindstack::LocalFrameData>{{empty_map, 0x1a000, 0xa000, "func1", 0},
+                                                 {empty_map, 0x1b000, 0xb000, "func2", 10},
+                                                 {empty_map, 0x1c000, 0xc000, "", 30}});
 
     std::vector<void*> pointers;
     pointers.push_back(debug_malloc(300));
diff --git a/libc/private/bionic_mbstate.h b/libc/private/bionic_mbstate.h
index 352115a..243b220 100644
--- a/libc/private/bionic_mbstate.h
+++ b/libc/private/bionic_mbstate.h
@@ -44,6 +44,10 @@
 #define __MB_IS_ERR(rv) (rv == __MB_ERR_ILLEGAL_SEQUENCE || \
                          rv == __MB_ERR_INCOMPLETE_SEQUENCE)
 
+static inline __wur bool mbstate_is_initial(const mbstate_t* ps) {
+  return *(reinterpret_cast<const uint32_t*>(ps->__seq)) == 0;
+}
+
 static inline __wur size_t mbstate_bytes_so_far(const mbstate_t* ps) {
   return
       (ps->__seq[2] != 0) ? 3 :
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index c429ff2..08df2eb 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -1219,7 +1219,7 @@
     if (dup2(fds[child], desired_child_fd) == -1) _exit(127);
     close(fds[child]);
     if (bidirectional) dup2(STDOUT_FILENO, STDIN_FILENO);
-    execl(__bionic_get_shell_path(), "sh", "-c", cmd, nullptr);
+    execl(__bionic_get_shell_path(), "sh", "-c", "--", cmd, nullptr);
     _exit(127);
   }
 
diff --git a/libc/system_properties/contexts_split.cpp b/libc/system_properties/contexts_split.cpp
index f71d70a..7ba835a 100644
--- a/libc/system_properties/contexts_split.cpp
+++ b/libc/system_properties/contexts_split.cpp
@@ -274,9 +274,6 @@
     // still need the system / platform properties to function.
     if (access("/vendor/etc/selinux/vendor_property_contexts", R_OK) != -1) {
       InitializePropertiesFromFile("/vendor/etc/selinux/vendor_property_contexts");
-    } else {
-      // Fallback to nonplat_* if vendor_* doesn't exist.
-      InitializePropertiesFromFile("/vendor/etc/selinux/nonplat_property_contexts");
     }
   } else {
     if (!InitializePropertiesFromFile("/plat_property_contexts")) {
@@ -284,9 +281,6 @@
     }
     if (access("/vendor_property_contexts", R_OK) != -1) {
       InitializePropertiesFromFile("/vendor_property_contexts");
-    } else {
-      // Fallback to nonplat_* if vendor_* doesn't exist.
-      InitializePropertiesFromFile("/nonplat_property_contexts");
     }
   }
 
diff --git a/libm/Android.bp b/libm/Android.bp
index 3fe8620..b6ad356 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -497,6 +497,7 @@
         "-Wno-missing-braces",
         "-Wno-parentheses",
         "-Wno-sign-compare",
+        "-Wno-static-in-inline",
         "-Wno-unknown-pragmas",
         "-Wno-unused-const-variable",
         "-Wno-unused-variable",
diff --git a/linker/Android.bp b/linker/Android.bp
index 5b06e3c..3ceafc7 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -66,9 +66,6 @@
 
     // We need to access Bionic private headers in the linker.
     include_dirs: ["bionic/libc"],
-
-    // b/182338959
-    bazel_module: { bp2build_available: false },
 }
 
 // ========================================================
@@ -394,9 +391,6 @@
         },
     },
 
-    lto: {
-        never: true,
-    },
     pgo: {
         sampling: true,
     },
@@ -409,7 +403,6 @@
 sh_binary {
     name: "ldd",
     src: "ldd.sh",
-    bazel_module: { bp2build_available: true },
 }
 
 // Used to generate binaries that can be backed by transparent hugepages.
@@ -493,6 +486,7 @@
 
 cc_test {
     name: "linker-unit-tests",
+    test_suites: ["device-tests"],
 
     cflags: [
         "-g",
diff --git a/tests/Android.bp b/tests/Android.bp
index 3637404..e7273c0 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -474,6 +474,9 @@
                 // musl doesn't have error.h
                 "error_test.cpp",
 
+                // musl doesn't have execinfo.h
+                "execinfo_test.cpp",
+
                 // musl doesn't define noreturn for C++
                 "stdnoreturn_test.cpp",
 
@@ -745,6 +748,7 @@
         "dl_test.cpp",
         "dlfcn_symlink_support.cpp",
         "dlfcn_test.cpp",
+        "execinfo_test.cpp",
         "link_test.cpp",
         "pthread_dlfcn_test.cpp",
     ],
@@ -787,13 +791,14 @@
     name: "libBionicCtsGtestMain",
     defaults: ["bionic_tests_defaults"],
     srcs: [
-        "gtest_globals_cts.cpp",
+        "gtest_globals.cpp",
         "gtest_main.cpp",
     ],
     shared: {
         enabled: false,
     },
     whole_static_libs: [
+        "libbase",
         "libgtest_isolated",
     ],
 }
@@ -870,13 +875,13 @@
                 "libLLVMSupport",
             ],
             ldflags: [
-                "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
+                "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
                 "-Wl,--enable-new-dtags",
             ],
         },
     },
 
-    required: [
+    data_bins: [
         "cfi_test_helper",
         "cfi_test_helper2",
         "elftls_dlopen_ie_error_helper",
@@ -895,6 +900,14 @@
         "ld_preload_test_helper",
         "ld_preload_test_helper_lib1",
         "ld_preload_test_helper_lib2",
+        "ns_hidden_child_helper",
+        "preinit_getauxval_test_helper",
+        "preinit_syscall_test_helper",
+        "thread_exit_cb_helper",
+        "tls_properties_helper",
+    ],
+
+    data_libs: [
         "libatest_simple_zip",
         "libcfi-test",
         "libcfi-test-bad",
@@ -906,9 +919,7 @@
         "libdlext_test_fd",
         "libdlext_test_norelro",
         "libdlext_test_recursive",
-        "libdlext_test_runpath_zip_zipaligned",
         "libdlext_test_zip",
-        "libdlext_test_zip_zipaligned",
         "libgnu-hash-table-library",
         "libns_hidden_child_app",
         "libns_hidden_child_global",
@@ -1028,11 +1039,6 @@
         "libtest_with_dependency_loop_b",
         "libtest_with_dependency_loop_c",
         "libtestshared",
-        "ns_hidden_child_helper",
-        "preinit_getauxval_test_helper",
-        "preinit_syscall_test_helper",
-        "thread_exit_cb_helper",
-        "tls_properties_helper",
     ],
 }
 
@@ -1041,6 +1047,11 @@
     defaults: [
         "bionic_unit_tests_defaults",
     ],
+    test_suites: ["device-tests"],
+    data: [
+        ":libdlext_test_runpath_zip_zipaligned",
+        ":libdlext_test_zip_zipaligned",
+    ],
 }
 
 cc_test {
@@ -1083,6 +1094,7 @@
     name: "bionic-unit-tests-static",
     gtest: false,
     defaults: ["bionic_tests_defaults"],
+    test_suites: ["device-tests"],
     host_supported: false,
 
     srcs: [
@@ -1116,6 +1128,11 @@
 
     static_executable: true,
     stl: "libc++_static",
+    // Clang cannot build ifunc with LTO.
+    // http://b/203737712
+    lto: {
+        never: true,
+    },
 }
 
 // -----------------------------------------------------------------------------
@@ -1133,6 +1150,7 @@
         "dlfcn_symlink_support.cpp",
         "dlfcn_test.cpp",
         "dl_test.cpp",
+        "execinfo_test.cpp",
         "gtest_globals.cpp",
         "gtest_main.cpp",
         "pthread_dlfcn_test.cpp",
diff --git a/tests/NOTICE b/tests/NOTICE
index a58cf46..c9b65d0 100644
--- a/tests/NOTICE
+++ b/tests/NOTICE
@@ -354,3 +354,31 @@
 
 -------------------------------------------------------------------
 
+Copyright (C) 2021 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.
+
+-------------------------------------------------------------------
+
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index 9a6ed9a..dd65a81 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -146,7 +146,7 @@
 // cfi_test_helper exports __cfi_check, which triggers CFI initialization at startup.
 TEST(cfi_test, early_init) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() + "/cfi_test_helper/cfi_test_helper";
+  std::string helper = GetTestlibRoot() + "/cfi_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -158,7 +158,7 @@
 // at startup.
 TEST(cfi_test, early_init2) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() + "/cfi_test_helper2/cfi_test_helper2";
+  std::string helper = GetTestlibRoot() + "/cfi_test_helper2";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 5768f1f..40cb83f 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -164,6 +164,9 @@
     const char large_string[] = "Hello!!!";
     static_assert(sizeof(large_string) > sizeof(small_buffer), "");
 
+#if __clang_major__ > 13
+    // expected-error@+3{{will always overflow}}
+#endif
     // expected-error@+1{{string bigger than buffer}}
     EXPECT_FORTIFY_DEATH(strcpy(small_buffer, large_string));
     // expected-error@+1{{string bigger than buffer}}
@@ -201,6 +204,9 @@
     static_assert(sizeof(small_string) > sizeof(split.tiny_buffer), "");
 
 #if _FORTIFY_SOURCE > 1
+#if __clang_major__ > 13
+    // expected-error@+4{{will always overflow}}
+#endif
     // expected-error@+2{{string bigger than buffer}}
 #endif
     EXPECT_FORTIFY_DEATH_STRUCT(strcpy(split.tiny_buffer, small_string));
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 47bf133..bf32bd5 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -125,8 +125,7 @@
 TEST(dl, exec_linker_load_file) {
 #if defined(__BIONIC__)
   const char* path_to_linker = PathToLinker();
-  std::string helper = GetTestlibRoot() +
-      "/exec_linker_helper/exec_linker_helper";
+  std::string helper = GetTestlibRoot() + "/exec_linker_helper";
   std::string expected_output =
       "ctor: argc=1 argv[0]=" + helper + "\n" +
       "main: argc=1 argv[0]=" + helper + "\n" +
@@ -134,7 +133,8 @@
       "helper_func called\n";
   ExecTestHelper eth;
   eth.SetArgs({ path_to_linker, helper.c_str(), nullptr });
-  eth.Run([&]() { execve(path_to_linker, eth.GetArgs(), eth.GetEnv()); }, 0, expected_output.c_str());
+  eth.Run([&]() { execve(path_to_linker, eth.GetArgs(), eth.GetEnv()); }, 0, nullptr);
+  ASSERT_EQ(expected_output, eth.GetOutput());
 #endif
 }
 
@@ -150,7 +150,8 @@
       "helper_func called\n";
   ExecTestHelper eth;
   eth.SetArgs({ path_to_linker, helper.c_str(), nullptr });
-  eth.Run([&]() { execve(path_to_linker, eth.GetArgs(), eth.GetEnv()); }, 0, expected_output.c_str());
+  eth.Run([&]() { execve(path_to_linker, eth.GetArgs(), eth.GetEnv()); }, 0, nullptr);
+  ASSERT_EQ(expected_output, eth.GetOutput());
 #endif
 }
 
@@ -167,8 +168,7 @@
 TEST(dl, preinit_system_calls) {
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
-  std::string helper = GetTestlibRoot() +
-      "/preinit_syscall_test_helper/preinit_syscall_test_helper";
+  std::string helper = GetTestlibRoot() + "/preinit_syscall_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -179,8 +179,7 @@
 TEST(dl, preinit_getauxval) {
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
-  std::string helper = GetTestlibRoot() +
-      "/preinit_getauxval_test_helper/preinit_getauxval_test_helper";
+  std::string helper = GetTestlibRoot() + "/preinit_getauxval_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -194,8 +193,7 @@
 
 TEST(dl, exec_without_ld_preload) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() +
-      "/ld_preload_test_helper/ld_preload_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_preload_test_helper";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -205,8 +203,7 @@
 
 TEST(dl, exec_with_ld_preload) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() +
-      "/ld_preload_test_helper/ld_preload_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_preload_test_helper";
   std::string env = std::string("LD_PRELOAD=") + GetTestlibRoot() + "/ld_preload_test_helper_lib2.so";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
@@ -232,12 +229,10 @@
 // The two libs are in ns2/ subdir.
 TEST(dl, exec_without_ld_config_file) {
 #if defined(__BIONIC__)
-  std::string error_message =
-      "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" "
-      "not found: needed by main executable\n";
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string error_message = "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() +
+                              "/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" "
+                              "not found: needed by main executable\n";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -252,13 +247,16 @@
   android_get_LD_LIBRARY_PATH(default_search_paths, sizeof(default_search_paths));
 
   std::ofstream fout(config_file, std::ios::out);
-  fout << "dir.test = " << GetTestlibRoot() << "/ld_config_test_helper/" << std::endl
+  fout << "dir.test = " << GetTestlibRoot() << "/" << std::endl
        << "[test]" << std::endl
        << "additional.namespaces = ns2" << std::endl
        << "namespace.default.search.paths = " << GetTestlibRoot() << std::endl
        << "namespace.default.links = ns2" << std::endl
-       << "namespace.default.link.ns2.shared_libs = libc.so:libm.so:libdl.so:ld_config_test_helper_lib1.so" << std::endl
-       << "namespace.ns2.search.paths = " << default_search_paths << ":" << GetTestlibRoot() << "/ns2" << std::endl;
+       << "namespace.default.link.ns2.shared_libs = "
+          "libc.so:libm.so:libdl.so:ld_config_test_helper_lib1.so"
+       << std::endl
+       << "namespace.ns2.search.paths = " << default_search_paths << ":" << GetTestlibRoot()
+       << "/ns2" << std::endl;
   fout.close();
 }
 #endif
@@ -288,8 +286,7 @@
   if (is_user_build()) {
     GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
@@ -325,8 +322,7 @@
   if (is_user_build()) {
     GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
@@ -363,11 +359,11 @@
     GTEST_SKIP() << "test requires user build";
   }
 
-  std::string error_message = std::string("CANNOT LINK EXECUTABLE ") +
-      "\"" + GetTestlibRoot() + "/ld_config_test_helper/ld_config_test_helper\": " +
+  std::string error_message =
+      std::string("CANNOT LINK EXECUTABLE ") + "\"" + GetTestlibRoot() +
+      "/ld_config_test_helper\": " +
       "library \"ld_config_test_helper_lib1.so\" not found: needed by main executable\n";
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 47214b8..ea28822 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -2076,7 +2076,7 @@
 TEST(dlext, ns_hidden_child) {
   ExecTestHelper eth;
 
-  std::string helper = GetTestlibRoot() + "/ns_hidden_child_helper/ns_hidden_child_helper";
+  std::string helper = GetTestlibRoot() + "/ns_hidden_child_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   std::string app_ns_dir = GetTestlibRoot() + "/ns_hidden_child_app";
   eth.SetArgs({ helper.c_str(), app_ns_dir.c_str(), nullptr });
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index aa975de..82ccf82 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -68,8 +68,7 @@
 }
 
 TEST(elftls_dl, dlopen_ie_error) {
-  std::string helper = GetTestlibRoot() +
-      "/elftls_dlopen_ie_error_helper/elftls_dlopen_ie_error_helper";
+  std::string helper = GetTestlibRoot() + "/elftls_dlopen_ie_error_helper";
   std::string src_path = GetTestlibRoot() + "/libtest_elftls_shared_var_ie.so";
   std::string dst_path = GetTestlibRoot() + "/libtest_elftls_shared_var.so";
 #if defined(__BIONIC__)
diff --git a/tests/execinfo_test.cpp b/tests/execinfo_test.cpp
new file mode 100644
index 0000000..b8e1325
--- /dev/null
+++ b/tests/execinfo_test.cpp
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2021 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 <gtest/gtest.h>
+
+#include <dlfcn.h>
+#include <execinfo.h>
+#include <string.h>
+
+#include <fstream>
+#include <regex>
+#include <string>
+#include <vector>
+
+#include <android-base/file.h>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+#include <android-base/test_utils.h>
+
+TEST(execinfo, backtrace_errors) {
+  void* frames[20];
+  ASSERT_EQ(0, backtrace(frames, 0));
+  ASSERT_EQ(0, backtrace(frames, -1));
+}
+
+static constexpr int kMaxFrames = 50;
+
+// Disable optimizations so that these functions show up properly in
+// the backtrace.
+#pragma clang optimize off
+extern "C" __attribute__((__noinline__)) void CallTwo(std::vector<void*>& frames) {
+  int num_frames = backtrace(frames.data(), static_cast<int>(frames.size()));
+  ASSERT_LT(0, num_frames);
+  frames.resize(static_cast<size_t>(num_frames));
+}
+
+extern "C" __attribute__((__noinline__)) void CallOne(std::vector<void*>& frames) {
+  CallTwo(frames);
+}
+#pragma clang optimize on
+
+static std::string DumpFrames(std::vector<void*>& frames) {
+  std::string frame_data;
+  for (auto frame : frames) {
+    frame_data += android::base::StringPrintf("[%p]", frame);
+    Dl_info info;
+    if (dladdr(frame, &info) != 0 && info.dli_sname != nullptr) {
+      frame_data += ' ';
+      frame_data += info.dli_sname;
+    }
+    frame_data += '\n';
+  }
+  return frame_data;
+}
+
+static size_t FindFunction(std::vector<void*>& frames, uintptr_t func_addr) {
+  for (size_t i = 0; i < frames.size(); i++) {
+    uintptr_t frame_addr = reinterpret_cast<uintptr_t>(frames[i]);
+    if (frame_addr >= func_addr && frame_addr <= func_addr + 0x100) {
+      return i + 1;
+    }
+  }
+  return 0;
+}
+
+static void VerifyCalls(std::vector<void*>& frames, size_t* one_idx = nullptr,
+                        size_t* two_idx = nullptr) {
+  // Try and find the CallOne and CallTwo function addresses.
+  size_t call_one_idx = FindFunction(frames, reinterpret_cast<uintptr_t>(&CallOne));
+  ASSERT_TRUE(call_one_idx != 0) << DumpFrames(frames);
+  size_t call_two_idx = FindFunction(frames, reinterpret_cast<uintptr_t>(&CallTwo));
+  ASSERT_TRUE(call_two_idx != 0) << DumpFrames(frames);
+
+  ASSERT_LT(call_two_idx, call_one_idx) << "CallTwo function found after CallOne\n"
+                                        << DumpFrames(frames);
+
+  if (one_idx != nullptr) *one_idx = call_one_idx;
+  if (two_idx != nullptr) *two_idx = call_two_idx;
+}
+
+TEST(execinfo, backtrace) {
+  std::vector<void*> frames(kMaxFrames);
+  ASSERT_NO_FATAL_FAILURE(CallOne(frames));
+
+  // Verfiy that there are at least two frames.
+  ASSERT_LT(3U, frames.size()) << DumpFrames(frames);
+
+  VerifyCalls(frames);
+}
+
+TEST(execinfo, backtrace_cutoff_frames) {
+  // Verify the max frames is handled properly
+  std::vector<void*> frames(1);
+  ASSERT_NO_FATAL_FAILURE(CallOne(frames));
+  ASSERT_EQ(1U, frames.size()) << DumpFrames(frames);
+}
+
+TEST(execinfo, backtrace_symbols_errors) {
+  void* frames[kMaxFrames];
+  // glibc incorrectly returns memory when a zero is passed in.
+  // Since we know this works properly on bionic, only verify
+  // this there.
+#if defined(__BIONIC__)
+  ASSERT_EQ(nullptr, backtrace_symbols(frames, 0));
+#endif
+  ASSERT_EQ(nullptr, backtrace_symbols(frames, -1));
+}
+
+static void VerifyLineFormat(std::string& line) {
+  // Verify that the format of the line is one of these:
+  //   elf_file(FuncName+0xFuncAddr) [0xAddress]
+  //   elf_file(+0xRelAddress) [0xAddress]
+  //   elf_file [0xAddress]
+  //   [0xAddress]
+#if defined(__GLIBC__)
+  // For some reason, glibc will print a space before [0xAddress] for
+  // backtrace symbols, and no space for backtrace_symbols_fd. Allow this
+  // only for glibc.
+  std::regex format1("[^\\(\\s]+\\([^\\+]+\\+0x[0-9a-fA-F]+\\) ?\\[0x[0-9a-fA-F]+\\]");
+  std::regex format2("[^\\(\\s]+\\(+\\+0x[0-9a-fA-F]+\\) ?\\[0x[0-9a-fA-F]+\\]");
+  std::regex format3("[^\\(\\s]+ ?\\[0x[0-9a-fA-F]+\\]");
+#else
+  std::regex format1("[^\\(\\s]+\\([^\\+]+\\+0x[0-9a-fA-F]+\\) \\[0x[0-9a-fA-F]+\\]");
+  std::regex format2("[^\\(\\s]+\\(+\\+0x[0-9a-fA-F]+\\) \\[0x[0-9a-fA-F]+\\]");
+  std::regex format3("[^\\(\\s]+ \\[0x[0-9a-fA-F]+\\]");
+#endif
+  std::regex format4("\\[0x[0-9a-fA-F]+\\]");
+
+  EXPECT_TRUE(std::regex_match(line, format1) || std::regex_match(line, format2) ||
+              std::regex_match(line, format3) || std::regex_match(line, format4))
+      << "Unknown format of line:\n"
+      << line;
+}
+
+static void VerifyLineFormat(char* raw_line, size_t length) {
+  std::string line(raw_line, length);
+  VerifyLineFormat(line);
+}
+
+TEST(execinfo, backtrace_symbols) {
+  std::vector<void*> frames(kMaxFrames);
+  ASSERT_NO_FATAL_FAILURE(CallOne(frames));
+  ASSERT_LT(3U, frames.size()) << DumpFrames(frames);
+
+  char** symbols = backtrace_symbols(frames.data(), static_cast<int>(frames.size()));
+  ASSERT_TRUE(symbols != nullptr);
+  for (size_t i = 0; i < frames.size(); i++) {
+    ASSERT_TRUE(frames[i] != nullptr);
+    VerifyLineFormat(symbols[i], strlen(symbols[i]));
+  }
+
+  size_t call_one_idx;
+  size_t call_two_idx;
+  ASSERT_NO_FATAL_FAILURE(VerifyCalls(frames, &call_one_idx, &call_two_idx));
+  // Now verify that those frames contain the function names we expect.
+  SCOPED_TRACE(DumpFrames(frames));
+  ASSERT_MATCH(symbols[call_one_idx - 1], "\\(CallOne+");
+  ASSERT_MATCH(symbols[call_two_idx - 1], "\\(CallTwo+");
+  free(symbols);
+}
+
+TEST(execinfo, backtrace_symbols_fd_errors) {
+  void* frames[kMaxFrames];
+  frames[0] = reinterpret_cast<void*>(&backtrace_symbols);
+
+  {
+    TemporaryFile tf;
+    backtrace_symbols_fd(frames, 0, tf.fd);
+    close(tf.fd);
+    std::string content;
+    ASSERT_TRUE(android::base::ReadFileToString(tf.path, &content));
+    // Verify that no data is written to the file.
+    ASSERT_TRUE(content.empty());
+  }
+
+  {
+    TemporaryFile tf;
+    backtrace_symbols_fd(frames, -1, tf.fd);
+    close(tf.fd);
+    std::string content;
+    ASSERT_TRUE(android::base::ReadFileToString(tf.path, &content));
+    // Verify that no data is written to the file.
+    ASSERT_TRUE(content.empty());
+  }
+
+  // Verify that there isn't a crash.
+  backtrace_symbols_fd(frames, 0, -1);
+}
+
+TEST(execinfo, backtrace_symbols_fd) {
+  std::vector<void*> frames(kMaxFrames);
+  ASSERT_NO_FATAL_FAILURE(CallOne(frames));
+  ASSERT_LT(3U, frames.size()) << DumpFrames(frames);
+
+  TemporaryFile tf;
+  backtrace_symbols_fd(frames.data(), static_cast<int>(frames.size()), tf.fd);
+  close(tf.fd);
+
+  size_t call_one_idx;
+  size_t call_two_idx;
+  ASSERT_NO_FATAL_FAILURE(VerifyCalls(frames, &call_one_idx, &call_two_idx));
+
+  std::ifstream frame_stream(tf.path);
+  ASSERT_TRUE(frame_stream.is_open());
+  size_t num_lines = 0;
+  std::string line;
+  while (std::getline(frame_stream, line)) {
+    ASSERT_FALSE(line.empty());
+    VerifyLineFormat(line);
+    num_lines++;
+
+    if (num_lines == call_one_idx) {
+      EXPECT_MATCH(line, "\\(CallOne+");
+    } else if (num_lines == call_two_idx) {
+      EXPECT_MATCH(line, "\\(CallTwo+");
+    }
+  }
+  ASSERT_EQ(num_lines, frames.size()) << "Number of lines in file does not match number of frames.";
+}
diff --git a/tests/gtest_globals.cpp b/tests/gtest_globals.cpp
index 5b5ede8..11b2dff 100644
--- a/tests/gtest_globals.cpp
+++ b/tests/gtest_globals.cpp
@@ -25,8 +25,8 @@
 
 std::string GetTestlibRoot() {
   // Typically the executable is /data/nativetest[64]/bionic-unit-tests/bionic-unit-tests, and the
-  // test libraries are in /data/nativetest[64]/bionic-loader-test-libs.
-  std::string path = android::base::GetExecutableDirectory() + "/..";
+  // test libraries are in /data/nativetest[64]/bionic-unit-tests/bionic-loader-test-libs.
+  std::string path = android::base::GetExecutableDirectory();
 
   std::string out_path;
   if (!android::base::Realpath(path.c_str(), &out_path)) {
diff --git a/tests/gtest_globals_cts.cpp b/tests/gtest_globals_cts.cpp
deleted file mode 100644
index 78bb3ca..0000000
--- a/tests/gtest_globals_cts.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2016 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_globals.h"
-
-std::string GetTestlibRoot() {
-  return "/data/local/tmp/lib/bionic-loader-test-libs";
-}
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index fabcd04..0046ef6 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -1181,14 +1181,6 @@
     defaults: ["bionic_testlib_defaults"],
     srcs: ["dl_df_1_global.cpp"],
     ldflags: ["-Wl,-z,global"],
-
-    target: {
-        host: {
-            // TODO (dimitry): host ld.gold does not yet support -z global
-            // remove this line once it is updated.
-            ldflags: ["-fuse-ld=bfd"],
-        },
-    },
 }
 
 // -----------------------------------------------------------------------------
@@ -1209,14 +1201,6 @@
     defaults: ["bionic_testlib_defaults"],
     srcs: ["dl_df_1_global_dummy.cpp"],
     ldflags: ["-Wl,-z,global"],
-
-    target: {
-        host: {
-            // TODO (dimitry): host ld.gold does not yet support -z global
-            // remove this line once it is updated.
-            ldflags: ["-fuse-ld=bfd"],
-        },
-    },
 }
 
 // -----------------------------------------------------------------------------
@@ -1667,3 +1651,71 @@
      memtag_heap: false,
    },
 }
+
+cc_genrule {
+    name: "libdlext_test_zip_zipaligned",
+     out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
+    tools: [
+        "soong_zip",
+        "bionic_tests_zipalign",
+    ],
+    srcs: [
+        ":libdlext_test_zip",
+        ":libatest_simple_zip",
+        ":exec_linker_helper",
+        ":exec_linker_helper_lib",
+    ],
+    cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
+        " cp $(in) $(genDir)/zipdir/libdir/ &&" +
+        " touch $(genDir)/zipdir/empty_file.txt &&" +
+        " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
+        " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
+
+    bazel_module: {
+        // Depends on soong_zip, which is not available yet.
+        bp2build_available: false
+    },
+}
+
+cc_genrule {
+    name: "libdlext_test_runpath_zip_zipaligned",
+    out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
+    tools: [
+        "soong_zip",
+        "bionic_tests_zipalign",
+    ],
+    srcs: [
+        ":libtest_dt_runpath_d_zip",
+        ":libtest_dt_runpath_a",
+        ":libtest_dt_runpath_b",
+        ":libtest_dt_runpath_c",
+        ":libtest_dt_runpath_x",
+        ":libtest_dt_runpath_y",
+    ],
+    cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
+        " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
+        "  PRIVATE_LIB_OR_LIB64=lib;" +
+        " else" +
+        "  PRIVATE_LIB_OR_LIB64=lib64;" +
+        " fi &&" +
+        " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
+        "  PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
+        " fi &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
+        " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
+        " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
+        " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
+        " touch $(genDir)/zipdir/empty_file.txt &&" +
+        " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
+        " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
+
+    bazel_module: {
+        // Depends on soong_zip, which is not available yet.
+        bp2build_available: false
+    },
+}
diff --git a/tests/libs/Android.build.dlext_testzip.mk b/tests/libs/Android.build.dlext_testzip.mk
deleted file mode 100644
index 66ed343..0000000
--- a/tests/libs/Android.build.dlext_testzip.mk
+++ /dev/null
@@ -1,102 +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.
-#
-
-# -----------------------------------------------------------------------------
-# Library used by dlext tests - zipped and aligned
-# -----------------------------------------------------------------------------
-
-BIONIC_TESTS_ZIPALIGN := $(HOST_OUT_EXECUTABLES)/bionic_tests_zipalign
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-LOCAL_MODULE := libdlext_test_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-LOCAL_MODULE_SUFFIX := .zip
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
-LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-my_shared_libs := \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,libdlext_test_zip,,,$(bionic_2nd_arch_prefix))/libdlext_test_zip.so \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,libatest_simple_zip,,,$(bionic_2nd_arch_prefix))/libatest_simple_zip.so \
-  $(call intermediates-dir-for,NATIVE_TESTS,exec_linker_helper,,,$(bionic_2nd_arch_prefix))/exec_linker_helper \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,exec_linker_helper_lib,,,$(bionic_2nd_arch_prefix))/exec_linker_helper_lib.so
-
-$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBS := $(my_shared_libs)
-$(LOCAL_BUILT_MODULE): $(my_shared_libs) $(BIONIC_TESTS_ZIPALIGN)
-	@echo "Aligning zip: $@"
-	$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir
-	$(hide) cp $(PRIVATE_SHARED_LIBS) $(dir $@)/zipdir/libdir
-	$(hide) touch $(dir $@)/zipdir/empty_file.txt
-	$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
-	$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-LOCAL_MODULE_SUFFIX := .zip
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip
-LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
-
-include $(BUILD_SYSTEM)/base_rules.mk
-lib_d := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_d_zip,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_d_zip.so
-lib_a := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_a,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_a.so
-lib_b := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_b,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_b.so
-lib_c := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_c,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_c.so
-lib_x := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_x,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_x.so
-lib_y := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_y,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_y.so
-
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_D := $(lib_d)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_A := $(lib_a)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_B := $(lib_b)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_C := $(lib_c)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_X := $(lib_x)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_Y := $(lib_y)
-ifeq ($(TARGET_IS_64_BIT),true)
-  ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib64)
-  else
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib,lib64)
-  endif
-else
-  ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib)
-  else
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := lib
-  endif
-endif
-$(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(lib_y) $(BIONIC_TESTS_ZIPALIGN)
-	@echo "Aligning zip: $@"
-	$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir && \
-    mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_a && mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_b_c_x && \
-    mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
-	$(hide) cp $(PRIVATE_LIB_D) $(dir $@)/zipdir/libdir
-	$(hide) cp $(PRIVATE_LIB_A) $(dir $@)/zipdir/libdir/dt_runpath_a
-	$(hide) cp $(PRIVATE_LIB_B) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_C) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_X) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_Y) $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
-	$(hide) touch $(dir $@)/zipdir/empty_file.txt
-	$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
-	$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk
deleted file mode 100644
index 08416ac..0000000
--- a/tests/libs/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# -----------------------------------------------------------------------------
-# Library used by dlext tests - zipped and aligned
-# -----------------------------------------------------------------------------
-include $(CLEAR_VARS)
-bionic_2nd_arch_prefix :=
-include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
-ifneq ($(TARGET_2ND_ARCH),)
-  bionic_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
-  include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
-endif
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 1386e30..5e8fb9f 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -1399,7 +1399,7 @@
   ASSERT_EQ(0, sem_post(&sem));
 
   int my_tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
-  ASSERT_EQ(PR_MTE_TCF_NONE, my_tagged_addr_ctrl & PR_MTE_TCF_MASK);
+  ASSERT_EQ(static_cast<unsigned long>(PR_MTE_TCF_NONE), my_tagged_addr_ctrl & PR_MTE_TCF_MASK);
 
   void* retval;
   ASSERT_EQ(0, pthread_join(thread, &retval));
@@ -1430,3 +1430,25 @@
   GTEST_SKIP() << "bionic extension";
 #endif
 }
+
+// Regression test for b/206701345 -- scudo bug, MTE only.
+// Fix: https://reviews.llvm.org/D105261
+// Fix: https://android-review.googlesource.com/c/platform/external/scudo/+/1763655
+TEST(malloc, realloc_mte_crash_b206701345) {
+  // We want to hit in-place realloc at the very end of an mmap-ed region.  Not
+  // all size classes allow such placement - mmap size has to be divisible by
+  // the block size. At the time of writing this could only be reproduced with
+  // 64 byte size class (i.e. 48 byte allocations), but that may change in the
+  // future. Try several different classes at the lower end.
+  std::vector<void*> ptrs(10000);
+  for (int i = 1; i < 32; ++i) {
+    size_t sz = 16 * i - 1;
+    for (void*& p : ptrs) {
+      p = realloc(malloc(sz), sz + 1);
+    }
+
+    for (void* p : ptrs) {
+      free(p);
+    }
+  }
+}
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index 6679480..6dbd741 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -496,6 +496,30 @@
   ASSERT_NE(0, system(nullptr));
 }
 
+// https://austingroupbugs.net/view.php?id=1440
+TEST(stdlib, system_minus) {
+  // Create a script with a name that starts with a '-'.
+  TemporaryDir td;
+  std::string script = std::string(td.path) + "/-minus";
+  ASSERT_TRUE(android::base::WriteStringToFile("#!" BIN_DIR "sh\nexit 66\n", script));
+
+  // Set $PATH so we can find it.
+  setenv("PATH", td.path, 1);
+  // Make it executable so we can run it.
+  ASSERT_EQ(0, chmod(script.c_str(), 0555));
+
+  int status = system("-minus");
+  EXPECT_TRUE(WIFEXITED(status));
+  EXPECT_EQ(66, WEXITSTATUS(status));
+
+  // While we're here and have all the setup, let's test popen(3) too...
+  FILE* fp = popen("-minus", "r");
+  ASSERT_TRUE(fp != nullptr);
+  status = pclose(fp);
+  EXPECT_TRUE(WIFEXITED(status));
+  EXPECT_EQ(66, WEXITSTATUS(status));
+}
+
 TEST(stdlib, atof) {
   ASSERT_DOUBLE_EQ(1.23, atof("1.23"));
 }
diff --git a/tests/sys_uio_test.cpp b/tests/sys_uio_test.cpp
index 8460041..aac08e7 100644
--- a/tests/sys_uio_test.cpp
+++ b/tests/sys_uio_test.cpp
@@ -16,7 +16,11 @@
 
 #include <gtest/gtest.h>
 
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
 #include <sys/uio.h>
+#include <unistd.h>
 
 #include <android-base/file.h>
 
@@ -68,6 +72,42 @@
   TestPreadVPwriteV(preadv64, pwritev64);
 }
 
+template <typename ReadFn, typename WriteFn>
+void TestPreadV2PwriteV2(ReadFn read_fn, WriteFn write_fn) {
+  TemporaryFile tf;
+
+  char buf[] = "world";
+  iovec ios[] = {{buf, 5}};
+
+  ASSERT_EQ(5, write_fn(tf.fd, ios, 1, 5, 0)) << strerror(errno);
+  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_CUR));
+
+  strcpy(buf, "hello");
+  ASSERT_EQ(5, write_fn(tf.fd, ios, 1, 0, 0)) << strerror(errno);
+  ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_CUR));
+
+  ASSERT_EQ(5, read_fn(tf.fd, ios, 1, 5, 0)) << strerror(errno);
+  ASSERT_STREQ("world", buf);
+  ASSERT_EQ(5, read_fn(tf.fd, ios, 1, 0, 0)) << strerror(errno);
+  ASSERT_STREQ("hello", buf);
+}
+
+TEST(sys_uio, preadv2_pwritev2) {
+#if defined(__BIONIC__)
+  TestPreadV2PwriteV2(preadv2, pwritev2);
+#else
+  GTEST_SKIP() << "preadv2/pwritev2 not available";
+#endif
+}
+
+TEST(sys_uio, preadv64v2_pwritev64v2) {
+#if defined(__BIONIC__)
+  TestPreadV2PwriteV2(preadv64v2, pwritev64v2);
+#else
+  GTEST_SKIP() << "preadv2/pwritev2 not available";
+#endif
+}
+
 TEST(sys_uio, process_vm_readv) {
   ASSERT_EQ(0, process_vm_readv(0, nullptr, 0, nullptr, 0, 0));
 
diff --git a/tests/uchar_test.cpp b/tests/uchar_test.cpp
index 48c500d..4dc6314 100644
--- a/tests/uchar_test.cpp
+++ b/tests/uchar_test.cpp
@@ -36,6 +36,7 @@
   // Any non-initial state is invalid when calling c32rtomb.
   memset(&ps, 0, sizeof(ps));
   EXPECT_EQ(static_cast<size_t>(-2), mbrtoc32(nullptr, "\xc2", 1, &ps));
+  errno = 0;
   EXPECT_EQ(static_cast<size_t>(-1), c32rtomb(out, 0x00a2, &ps));
   EXPECT_EQ(EILSEQ, errno);
 
@@ -87,11 +88,7 @@
   EXPECT_EQ('\xe2', bytes[0]);
   EXPECT_EQ('\x82', bytes[1]);
   EXPECT_EQ('\xac', bytes[2]);
-}
-
-TEST(uchar, c16rtomb_surrogate) {
-  char bytes[MB_LEN_MAX];
-
+  // 4-byte UTF-8 from a surrogate pair...
   memset(bytes, 0, sizeof(bytes));
   EXPECT_EQ(0U, c16rtomb(bytes, 0xdbea, nullptr));
   EXPECT_EQ(4U, c16rtomb(bytes, 0xdfcd, nullptr));
@@ -143,16 +140,16 @@
   // 3-byte UTF-8.
   ASSERT_EQ(3U, mbrtoc16(&out, "\xe2\x82\xac" "def", 6, nullptr));
   ASSERT_EQ(static_cast<char16_t>(0x20ac), out);
-}
-
-TEST(uchar, mbrtoc16_surrogate) {
-  char16_t out;
-
+  // 4-byte UTF-8 will be returned as a surrogate pair...
   ASSERT_EQ(static_cast<size_t>(-3),
             mbrtoc16(&out, "\xf4\x8a\xaf\x8d", 6, nullptr));
   ASSERT_EQ(static_cast<char16_t>(0xdbea), out);
   ASSERT_EQ(4U, mbrtoc16(&out, "\xf4\x8a\xaf\x8d" "ef", 6, nullptr));
   ASSERT_EQ(static_cast<char16_t>(0xdfcd), out);
+  // Illegal 5-byte UTF-8.
+  errno = 0;
+  ASSERT_EQ(static_cast<size_t>(-1), mbrtoc16(&out, "\xf8\xa1\xa2\xa3\xa4", 5, nullptr));
+  ASSERT_EQ(EILSEQ, errno);
 }
 
 TEST(uchar, mbrtoc16_reserved_range) {
@@ -194,6 +191,7 @@
 
   // Invalid 2-byte
   ASSERT_EQ(static_cast<size_t>(-2), mbrtoc16(&out, "\xc2", 1, ps));
+  errno = 0;
   ASSERT_EQ(static_cast<size_t>(-1), mbrtoc16(&out, "\x20" "cdef", 5, ps));
   ASSERT_EQ(EILSEQ, errno);
 }
@@ -247,6 +245,7 @@
   EXPECT_EQ('\xad', bytes[2]);
   EXPECT_EQ('\xa2', bytes[3]);
   // Invalid code point.
+  errno = 0;
   EXPECT_EQ(static_cast<size_t>(-1), c32rtomb(bytes, 0xffffffff, nullptr));
   EXPECT_EQ(EILSEQ, errno);
 }
@@ -307,10 +306,12 @@
   ASSERT_EQ(static_cast<char32_t>(0x24b62), out[0]);
 #if defined(__BIONIC__) // glibc allows this.
   // Illegal 5-byte UTF-8.
+  errno = 0;
   ASSERT_EQ(static_cast<size_t>(-1), mbrtoc32(out, "\xf8\xa1\xa2\xa3\xa4" "f", 6, nullptr));
   ASSERT_EQ(EILSEQ, errno);
 #endif
   // Illegal over-long sequence.
+  errno = 0;
   ASSERT_EQ(static_cast<size_t>(-1), mbrtoc32(out, "\xf0\x82\x82\xac" "ef", 6, nullptr));
   ASSERT_EQ(EILSEQ, errno);
 }
@@ -340,6 +341,7 @@
 
   // Invalid 2-byte
   ASSERT_EQ(static_cast<size_t>(-2), mbrtoc32(&out, "\xc2", 1, ps));
+  errno = 0;
   ASSERT_EQ(static_cast<size_t>(-1), mbrtoc32(&out, "\x20" "cdef", 5, ps));
   ASSERT_EQ(EILSEQ, errno);
 }
diff --git a/tests/utils.h b/tests/utils.h
index 592ac0e..284140a 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -229,7 +229,7 @@
   }
 
   void Run(const std::function<void()>& child_fn, int expected_exit_status,
-           const char* expected_output) {
+           const char* expected_output_regex) {
     int fds[2];
     ASSERT_NE(pipe(fds), -1);
 
@@ -258,8 +258,10 @@
 
     std::string error_msg("Test output:\n" + output_);
     AssertChildExited(pid, expected_exit_status, &error_msg);
-    if (expected_output != nullptr) {
-      ASSERT_EQ(expected_output, output_);
+    if (expected_output_regex != nullptr) {
+      if (!std::regex_search(output_, std::regex(expected_output_regex))) {
+        FAIL() << "regex " << expected_output_regex << " didn't match " << output_;
+      }
     }
   }