aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-04-30 21:56:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-30 21:56:05 +0000
commitf349d53a9ce073534dc9757eeb0f71fe3a3b4e2a (patch)
tree51c48b20067b61666a0ab868b7420aa9488bbe03
parentd2f5082997b7b9f694ddf1e51994a49123fa20fa (diff)
parentc7fc1625532ce428705f3362ad3c7b62c1935ef8 (diff)
downloadbionic-build-tools-release.tar.gz
Merge "Snap for 11784721 from fb48ddc96459f44531edb24c81fe6ddd2c16bdcb to build-tools-release" into build-tools-releasebuild-tools-release
-rw-r--r--android-changes-for-ndk-developers.md173
-rw-r--r--libc/Android.bp2
-rw-r--r--libc/NOTICE35
-rw-r--r--libc/arch-arm64/bionic/__bionic_clone.S4
-rw-r--r--libc/arch-arm64/bionic/vfork.S4
-rw-r--r--libc/arch-arm64/dynamic_function_dispatch.cpp39
-rw-r--r--libc/arch-arm64/oryon/memcpy-nt.S351
-rw-r--r--libc/arch-arm64/oryon/memset-nt.S218
-rw-r--r--libc/arch-arm64/string/__memcpy_chk.S4
-rw-r--r--libc/arch-arm64/string/__memset_chk.S4
-rw-r--r--libc/arch-riscv64/bionic/__bionic_clone.S8
-rw-r--r--libc/arch-riscv64/bionic/setjmp.S4
-rw-r--r--libc/arch-riscv64/bionic/syscall.S6
-rw-r--r--libc/arch-riscv64/bionic/vfork.S8
-rw-r--r--libc/arch-riscv64/dynamic_function_dispatch.cpp2
-rw-r--r--libc/arch-x86/bionic/setjmp.S4
-rw-r--r--libc/bionic/fortify.cpp8
-rw-r--r--libc/bionic/gwp_asan_wrappers.cpp14
-rw-r--r--libc/bionic/heap_tagging.cpp8
-rw-r--r--libc/bionic/jemalloc_wrapper.cpp8
-rw-r--r--libc/bionic/libc_init_common.cpp4
-rw-r--r--libc/bionic/libc_init_dynamic.cpp2
-rw-r--r--libc/bionic/malloc_common.cpp2
-rw-r--r--libc/bionic/malloc_common_dynamic.cpp2
-rw-r--r--libc/bionic/pthread_rwlock.cpp5
-rw-r--r--libc/bionic/sys_statvfs.cpp2
-rw-r--r--libc/bionic/system_property_set.cpp19
-rw-r--r--libc/dns/resolv/res_cache.c4
-rw-r--r--libc/include/android/api-level.h2
-rw-r--r--libc/include/android/legacy_stdlib_inlines.h6
-rw-r--r--libc/include/android/legacy_termios_inlines.h4
-rw-r--r--libc/include/android/legacy_threads_inlines.h2
-rw-r--r--libc/include/android/legacy_unistd_inlines.h2
-rw-r--r--libc/include/android/versioning.h16
-rw-r--r--libc/include/bits/glibc-syscalls.h15
-rw-r--r--libc/include/bits/page_size.h11
-rw-r--r--libc/include/bits/stdatomic.h12
-rw-r--r--libc/include/bits/struct_file.h2
-rw-r--r--libc/include/bits/swab.h2
-rw-r--r--libc/include/bits/termios_inlines.h4
-rw-r--r--libc/include/bits/termios_winsize_inlines.h2
-rw-r--r--libc/include/bits/threads_inlines.h2
-rw-r--r--libc/include/ctype.h2
-rw-r--r--libc/include/limits.h13
-rw-r--r--libc/include/malloc.h6
-rw-r--r--libc/include/pthread.h22
-rw-r--r--libc/include/sched.h4
-rw-r--r--libc/include/signal.h10
-rw-r--r--libc/include/stdio.h2
-rw-r--r--libc/include/stdlib.h2
-rw-r--r--libc/include/strings.h6
-rw-r--r--libc/include/sys/cdefs.h51
-rw-r--r--libc/include/sys/param.h7
-rw-r--r--libc/include/sys/shm.h3
-rw-r--r--libc/include/unistd.h5
-rwxr-xr-xlibc/kernel/tools/cpp.py4
-rw-r--r--libc/kernel/tools/defaults.py6
-rw-r--r--libc/kernel/uapi/asm-arm/asm/unistd-eabi.h5
-rw-r--r--libc/kernel/uapi/asm-arm/asm/unistd-oabi.h5
-rw-r--r--libc/kernel/uapi/asm-generic/unistd.h7
-rw-r--r--libc/kernel/uapi/asm-riscv/asm/hwprobe.h30
-rw-r--r--libc/kernel/uapi/asm-riscv/asm/kvm.h35
-rw-r--r--libc/kernel/uapi/asm-x86/asm/kvm.h2
-rw-r--r--libc/kernel/uapi/asm-x86/asm/signal.h1
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_32.h5
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_64.h5
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_x32.h5
-rw-r--r--libc/kernel/uapi/drm/drm.h6
-rw-r--r--libc/kernel/uapi/drm/drm_mode.h7
-rw-r--r--libc/kernel/uapi/drm/habanalabs_accel.h14
-rw-r--r--libc/kernel/uapi/drm/ivpu_accel.h7
-rw-r--r--libc/kernel/uapi/drm/msm_drm.h3
-rw-r--r--libc/kernel/uapi/drm/nouveau_drm.h2
-rw-r--r--libc/kernel/uapi/drm/pvr_drm.h271
-rw-r--r--libc/kernel/uapi/drm/v3d_drm.h74
-rw-r--r--libc/kernel/uapi/drm/virtgpu_drm.h2
-rw-r--r--libc/kernel/uapi/drm/xe_drm.h296
-rw-r--r--libc/kernel/uapi/linux/android/binder.h30
-rw-r--r--libc/kernel/uapi/linux/batadv_packet.h12
-rw-r--r--libc/kernel/uapi/linux/bpf.h38
-rw-r--r--libc/kernel/uapi/linux/bpfilter.h22
-rw-r--r--libc/kernel/uapi/linux/btrfs.h1
-rw-r--r--libc/kernel/uapi/linux/cxl_mem.h2
-rw-r--r--libc/kernel/uapi/linux/devlink.h1
-rw-r--r--libc/kernel/uapi/linux/dpll.h1
-rw-r--r--libc/kernel/uapi/linux/ethtool.h5
-rw-r--r--libc/kernel/uapi/linux/ethtool_netlink.h1
-rw-r--r--libc/kernel/uapi/linux/fs.h1
-rw-r--r--libc/kernel/uapi/linux/if_bridge.h1
-rw-r--r--libc/kernel/uapi/linux/if_link.h7
-rw-r--r--libc/kernel/uapi/linux/if_xdp.h17
-rw-r--r--libc/kernel/uapi/linux/iio/types.h2
-rw-r--r--libc/kernel/uapi/linux/io_uring.h9
-rw-r--r--libc/kernel/uapi/linux/iommufd.h23
-rw-r--r--libc/kernel/uapi/linux/kexec.h1
-rw-r--r--libc/kernel/uapi/linux/kvm.h105
-rw-r--r--libc/kernel/uapi/linux/lsm.h39
-rw-r--r--libc/kernel/uapi/linux/mount.h37
-rw-r--r--libc/kernel/uapi/linux/mptcp.h1
-rw-r--r--libc/kernel/uapi/linux/netdev.h61
-rw-r--r--libc/kernel/uapi/linux/netfilter/nf_tables.h1
-rw-r--r--libc/kernel/uapi/linux/nl80211.h21
-rw-r--r--libc/kernel/uapi/linux/nsm.h23
-rw-r--r--libc/kernel/uapi/linux/pcitest.h3
-rw-r--r--libc/kernel/uapi/linux/perf_event.h3
-rw-r--r--libc/kernel/uapi/linux/pkt_cls.h36
-rw-r--r--libc/kernel/uapi/linux/pkt_sched.h89
-rw-r--r--libc/kernel/uapi/linux/raid/md_u.h3
-rw-r--r--libc/kernel/uapi/linux/resource.h2
-rw-r--r--libc/kernel/uapi/linux/serial.h18
-rw-r--r--libc/kernel/uapi/linux/smc.h2
-rw-r--r--libc/kernel/uapi/linux/smc_diag.h2
-rw-r--r--libc/kernel/uapi/linux/stat.h1
-rw-r--r--libc/kernel/uapi/linux/sync_file.h5
-rw-r--r--libc/kernel/uapi/linux/tc_act/tc_ipt.h22
-rw-r--r--libc/kernel/uapi/linux/tc_act/tc_mirred.h1
-rw-r--r--libc/kernel/uapi/linux/thp7312.h14
-rw-r--r--libc/kernel/uapi/linux/time_types.h1
-rw-r--r--libc/kernel/uapi/linux/usb/f_accessory.h34
-rw-r--r--libc/kernel/uapi/linux/usb/functionfs.h3
-rw-r--r--libc/kernel/uapi/linux/userfaultfd.h16
-rw-r--r--libc/kernel/uapi/linux/v4l2-controls.h1
-rw-r--r--libc/kernel/uapi/linux/v4l2-subdev.h4
-rw-r--r--libc/kernel/uapi/linux/version.h4
-rw-r--r--libc/kernel/uapi/linux/vfio.h1
-rw-r--r--libc/kernel/uapi/linux/videodev2.h8
-rw-r--r--libc/kernel/uapi/linux/virtio_config.h3
-rw-r--r--libc/kernel/uapi/linux/virtio_pci.h45
-rw-r--r--libc/kernel/uapi/linux/virtio_pmem.h2
-rw-r--r--libc/kernel/uapi/rdma/bnxt_re-abi.h32
-rw-r--r--libc/kernel/uapi/rdma/efa-abi.h16
-rw-r--r--libc/kernel/uapi/rdma/hns-abi.h4
-rw-r--r--libc/kernel/uapi/rdma/mlx5-abi.h2
-rw-r--r--libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h1
-rw-r--r--libc/kernel/uapi/regulator/regulator.h47
-rw-r--r--libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h2
-rw-r--r--libc/kernel/uapi/sound/asound.h7
-rw-r--r--libc/kernel/uapi/sound/scarlett2.h30
-rw-r--r--libc/kernel/uapi/sound/sof/tokens.h3
-rw-r--r--libc/kernel/uapi/xen/gntalloc.h5
-rw-r--r--libc/malloc_debug/malloc_debug.cpp2
-rw-r--r--libc/platform/bionic/malloc.h4
-rw-r--r--libc/private/WriteProtected.h19
-rw-r--r--libc/system_properties/system_properties.cpp16
-rw-r--r--libc/upstream-openbsd/android/include/openbsd-compat.h17
-rw-r--r--libc/upstream-openbsd/lib/libc/crypt/arc4random.c12
-rw-r--r--libc/upstream-openbsd/lib/libc/crypt/chacha_private.h4
-rw-r--r--libc/upstream-openbsd/lib/libc/gen/ctype_.c12
-rw-r--r--libc/upstream-openbsd/lib/libc/net/htonl.c14
-rw-r--r--libc/upstream-openbsd/lib/libc/net/htons.c14
-rw-r--r--libc/upstream-openbsd/lib/libc/net/ntohl.c14
-rw-r--r--libc/upstream-openbsd/lib/libc/net/ntohs.c14
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/fvwrite.c21
-rw-r--r--linker/arch/arm64/tlsdesc_resolver.S6
-rw-r--r--linker/linker.cpp12
-rw-r--r--linker/linker.h1
-rw-r--r--linker/linker_main.cpp61
-rw-r--r--linker/linker_phdr.cpp15
-rw-r--r--linker/linker_phdr.h28
-rw-r--r--linker/linker_relocate.cpp8
-rw-r--r--linker/linker_soinfo.h2
-rw-r--r--tests/headers/posix/limits_h.c2
-rw-r--r--tests/limits_test.cpp1
-rw-r--r--tests/malloc_test.cpp8
-rw-r--r--tests/sys_hwprobe_test.cpp64
165 files changed, 2555 insertions, 701 deletions
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index ad8462af9..8d507d1db 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -11,12 +11,9 @@ See also the
for details about changes in stack unwinding (crash dumps) between
different releases.
-Required tools: the NDK has an _arch_-linux-android-readelf binary
-(e.g. arm-linux-androideabi-readelf or i686-linux-android-readelf)
-for each architecture (under toolchains/), but you can use readelf for
-any architecture, as we will be doing basic inspection only. On Linux
-you need to have the “binutils” package installed for readelf,
-and “pax-utils” for scanelf.
+Required tools: the NDK has an `llvm-readelf` binary that understands all the
+architecture-specific details of all Android's supported architectures. Recent
+versions of Android also have toybox readelf on the device.
## How we manage incompatible changes
@@ -38,42 +35,44 @@ as toasts. Experience has shown that many developers don’t habitually
check logcat for warnings until their app stops functioning, so the
toasts help bring some visibility to the issues before it's too late.
+
## Changes to library dependency resolution
Until it was [fixed](https://issuetracker.google.com/36950617) in
-JB-MR2, Android didn't include the application library directory
+API level 18, Android didn't include the application library directory
on the dynamic linker's search path. This meant that apps
had to call `dlopen` or `System.loadLibrary` on all transitive
dependencies before loading their main library. Worse, until it was
-[fixed](https://issuetracker.google.com/36935779) in JB-MR2, the
+[fixed](https://issuetracker.google.com/36935779) in API level 18, the
dynamic linker's caching code cached failures too, so it was necessary
to topologically sort your libraries and load them in reverse order.
-If you need to support Android devices running OS
-versions older than JB-MR2, you might want to consider
+If you need to support Android devices running OS versions older than
+API level 23, you might want to consider
[ReLinker](https://github.com/KeepSafe/ReLinker) which claims to solve
-these problems automatically.
+these and other problems automatically.
Alternatively, if you don't have too many dependencies, it can be easiest to
simply link all of your code into one big library and sidestep the details of
library and symbol lookup changes on all past (and future) Android versions.
+
## Changes to library search order
We have made various fixes to library search order when resolving symbols.
-With API 22, load order switched from depth-first to breadth-first to
+With API level 22, load order switched from depth-first to breadth-first to
fix dlsym(3).
-Before API 23, the default search order was to try the main executable,
+Before API level 23, the default search order was to try the main executable,
LD_PRELOAD libraries, the library itself, and its DT_NEEDED libraries
-in that order. For API 23 and later, for any given library, the dynamic
+in that order. For API level 23 and later, for any given library, the dynamic
linker divides other libraries into the global group and the local
group. The global group is shared by all libraries and contains the main
executable, LD_PRELOAD libraries, and any library with the DF_1_GLOBAL
flag set (by passing “-z global” to ld(1)). The local group is
the breadth-first transitive closure of the library and its DT_NEEDED
-libraries. The M dynamic linker searches the global group followed by
+libraries. The API level 23 dynamic linker searches the global group followed by
the local group. This allows ASAN, for example, to ensure that it can
intercept any symbol.
@@ -89,7 +88,7 @@ on its search path.
## RTLD_LOCAL (Available in API level >= 23)
The dlopen(3) RTLD_LOCAL flag used to be ignored but is implemented
-correctly in API 23 and later. Note that RTLD_LOCAL is the default,
+correctly in API level 23 and later. Note that RTLD_LOCAL is the default,
so even calls to dlopen(3) that didn’t explicitly use RTLD_LOCAL will
be affected (unless they explicitly used RTLD_GLOBAL). With RTLD_LOCAL,
symbols will not be made available to libraries loaded by later calls
@@ -99,7 +98,7 @@ to dlopen(3) (as opposed to being referenced by DT_NEEDED entries).
## GNU hashes (Availible in API level >= 23)
The GNU hash style available with `--hash-style=gnu` allows faster
-symbol lookup and is supported by Android's dynamic linker in API 23 and
+symbol lookup and is supported by Android's dynamic linker in API level 23 and
above. Use `--hash-style=both` if you want to build code that uses this
feature in new enough releases but still works on older releases.
If you're using the NDK, clang chooses the right option
@@ -157,34 +156,26 @@ page-aligned and stored uncompressed for this to work.
## Private API (Enforced for API level >= 24)
Native libraries must use only public API, and must not link against
-non-NDK platform libraries. Starting with API 24 this rule is enforced and
-applications are no longer able to load non-NDK platform libraries. The
-rule is enforced by the dynamic linker, so non-public libraries
+non-NDK platform libraries. On devices running API level 24 or later,
+this rule is enforced and applications are no longer able to load all
+non-NDK platform libraries. This was to prevent future issues similar
+to the disruption caused when Android switched from OpenSSL to BoringSSL
+at API level 23.
+
+The rule is enforced by the dynamic linker, so non-public libraries
are not accessible regardless of the way code tries to load them:
-System.loadLibrary, DT_NEEDED entries, and direct calls to dlopen(3)
+System.loadLibrary(), DT_NEEDED entries, and direct calls to dlopen(3)
will all work exactly the same.
-Users should have a consistent app experience across updates,
-and developers shouldn't have to make emergency app updates to
-handle platform changes. For that reason, we recommend against using
-private C/C++ symbols. Private symbols aren't tested as part of the
-Compatibility Test Suite (CTS) that all Android devices must pass. They
-may not exist, or they may behave differently. This makes apps that use
-them more likely to fail on specific devices, or on future releases ---
-as many developers found when Android 6.0 Marshmallow switched from
-OpenSSL to BoringSSL.
-
-In order to reduce the user impact of this transition, we've identified
-a set of libraries that see significant use from Google Play's
-most-installed apps, and that are feasible for us to support in the
+In order to reduce the user impact of this transition, we identified
+a set of libraries that saw significant use from Google Play's
+most-installed apps and were feasible for us to support in the
short term (including libandroid_runtime.so, libcutils.so, libcrypto.so,
-and libssl.so). In order to give you more time to transition, we will
-temporarily support these libraries; so if you see a warning that means
-your code will not work in a future release -- please fix it now!
-
-Between O and R, this compatibility mode could be disabled by setting a
-system property (`debug.ld.greylist_disabled`). This property is ignored
-in S and later.
+and libssl.so). In order to give app developers more time to transition,
+we allowed access to these libraries for apps with a target API level < 24.
+On devices running API level 26 to API level 30, this compatibility mode could be
+disabled by setting a system property (`debug.ld.greylist_disabled`).
+This property is ignored on devices running API level 31 and later.
```
$ readelf --dynamic libBroken.so | grep NEEDED
@@ -200,7 +191,7 @@ $ readelf --dynamic libBroken.so | grep NEEDED
0x00000001 (NEEDED) Shared library: [libc.so]
```
-*Potential problems*: starting from API 24 the dynamic linker will not
+*Potential problems*: starting from API level 24 the dynamic linker will not
load private libraries, preventing the application from loading.
*Resolution*: rewrite your native code to rely only on public API. As a
@@ -238,15 +229,16 @@ $ readelf --headers libBroken.so | grep 'section headers'
*Resolution*: remove the extra steps from your build that strip section
headers.
+
## Text Relocations (Enforced for API level >= 23)
-Starting with API 23, shared objects must not contain text
-relocations. That is, the code must be loaded as is and must not be
-modified. Such an approach reduces load time and improves security.
+Apps with a target API level >= 23 cannot load shared objects that contain text
+relocations. Such an approach reduces load time and improves security. This was
+only a change for 32-bit, because 64-bit never supported text relocations.
-The usual reason for text relocations is non-position independent
-hand-written assembler. This is not common. Use the scanelf tool as
-described in our documentation for further diagnostics:
+The usual reason for text relocations was non-position independent
+hand-written assembler. This is not common. You can use the scanelf tool
+from the pax-utils debian package for further diagnostics:
```
$ scanelf -qT libTextRel.so
@@ -256,10 +248,10 @@ $ scanelf -qT libTextRel.so
```
If you have no scanelf tool available, it is possible to do a basic
-check with readelf instead, look for either a TEXTREL entry or the
+check with readelf instead. Look for either a TEXTREL entry or the
TEXTREL flag. Either alone is sufficient. (The value corresponding to the
TEXTREL entry is irrelevant and typically 0 --- simply the presence of
-the TEXTREL entry declares that the .so contains text relocations). This
+the TEXTREL entry declares that the .so contains text relocations.) This
example has both indicators present:
```
@@ -276,9 +268,8 @@ because the Android dynamic linker trusts the entry/flag.
*Potential problems*: Relocations enforce code pages being writable, and
wastefully increase the number of dirty pages in memory. The dynamic
-linker has issued warnings about text relocations since Android K
-(API 19), but on API 23 and above it refuses to load code with text
-relocations.
+linker issued warnings about text relocations from API level 19, but on API
+level 23 and above refuses to load code with text relocations.
*Resolution*: rewrite assembler to be position independent to ensure
no text relocations are necessary. The
@@ -296,9 +287,9 @@ DT_NEEDED entry should be the same as the needed library's SONAME,
leaving the business of finding the library at runtime to the dynamic
linker.
-Before API 23, Android's dynamic linker ignored the full path, and
+Before API level 23, Android's dynamic linker ignored the full path, and
used only the basename (the part after the last ‘/') when looking
-up the required libraries. Since API 23 the runtime linker will honor
+up the required libraries. Since API level 23 the runtime linker will honor
the DT_NEEDED exactly and so it won't be able to load the library if
it is not present in that exact location on the device.
@@ -315,8 +306,8 @@ $ readelf --dynamic libSample.so | grep NEEDED
[C:\Users\build\Android\ci\jni\libBroken.so]
```
-*Potential problems*: before API 23 the DT_NEEDED entry's basename was
-used, but starting from API 23 the Android runtime will try to load the
+*Potential problems*: before API level 23 the DT_NEEDED entry's basename was
+used, but starting from API level 23 the Android runtime will try to load the
library using the path specified, and that path won't exist on the
device. There are broken third-party toolchains/build systems that use
a path on a build host instead of the SONAME.
@@ -350,16 +341,18 @@ default. Ensure you're using the current NDK and that you haven't
configured your build system to generate incorrect SONAME entries (using
the `-soname` linker option).
+
## `__register_atfork` (Available in API level >= 23)
To allow `atfork` and `pthread_atfork` handlers to be unregistered on
-`dlclose`, the implementation changed in API level 23. Unfortunately this
-requires a new libc function `__register_atfork`. Code using these functions
-that is built with a target API level >= 23 therefore will not load on earlier
-versions of Android, with an error referencing `__register_atfork`.
+`dlclose`, API level 23 added a new libc function `__register_atfork`.
+This means that code using `atfork` or `pthread_atfork` functions that is
+built with a `minSdkVersion` >= 23 will not load on earlier versions of
+Android, with an error referencing `__register_atfork`.
+
+*Resolution*: build your code with `minSdkVersion` that matches the minimum
+API level you actually support, or avoid using `atfork`/`pthread_atfork`.
-*Resolution*: build your code with an NDK target API level that matches your
-app's minimum API level, or avoid using `atfork`/`pthread_atfork`.
## DT_RUNPATH support (Available in API level >= 24)
@@ -389,6 +382,7 @@ $ readelf --program-headers -W libBadFlags.so | grep WE
into your app. The middleware vendor is aware of the problem and has a fix
available.
+
## Invalid ELF header/section headers (Enforced for API level >= 26)
In API level 26 and above the dynamic linker checks more values in
@@ -403,9 +397,10 @@ dlopen failed: "/data/data/com.example.bad/lib.so" has unsupported e_shentsize:
ELF files. Note that using them puts application under high risk of
being incompatible with future versions of Android.
-## Enable logging of dlopen/dlsym and library loading errors for apps (Available in Android O)
-Starting with Android O it is possible to enable logging of dynamic
+## Enable logging of dlopen/dlsym and library loading errors for apps (Available for API level >= 26)
+
+On devices running API level 26 or later you can enable logging of dynamic
linker activity for debuggable apps by setting a property corresponding
to the fully-qualified name of the specific app:
```
@@ -429,12 +424,13 @@ app-specific one. For example, to enable logging of all dlopen(3)
adb shell setprop debug.ld.all dlerror,dlopen
```
+
## dlclose interacts badly with thread local variables with non-trivial destructors
Android allows `dlclose` to unload a library even if there are still
thread-local variables with non-trivial destructors. This leads to
crashes when a thread exits and attempts to call the destructor, the
-code for which has been unloaded (as in [issue 360], fixed in P).
+code for which has been unloaded (as in [issue 360], fixed in API level 28).
[issue 360]: https://github.com/android-ndk/ndk/issues/360
@@ -442,18 +438,19 @@ Not calling `dlclose` or ensuring that your library has `RTLD_NODELETE`
set (so that calls to `dlclose` don't actually unload the library)
are possible workarounds.
-| | Pre-M | M+ | P+ |
+| | API level < 23 | >= 23 | >= 28 |
| ----------------- | -------------------------- | ------- | ----- |
| No workaround | Works for static STL | Broken | Works |
| `-Wl,-z,nodelete` | Works for static STL | Works | Works |
| No `dlclose` | Works | Works | Works |
-## Use of IFUNC in libc (True for all API levels on devices running Q)
-Starting with Android Q (API level 29), libc uses
-[IFUNC](https://sourceware.org/glibc/wiki/GNU_IFUNC) functionality in
-the dynamic linker to choose optimized assembler routines at run time
-rather than at build time. This lets us use the same `libc.so` on all
+## Use of IFUNC in libc (True for all API levels on devices running Android 10)
+
+On devices running API level 29, libc uses
+[IFUNC](https://sourceware.org/glibc/wiki/GNU_IFUNC)
+functionality in the dynamic linker to choose optimized assembler routines at
+run time rather than at build time. This lets us use the same `libc.so` on all
devices, and is similar to what other OSes already did. Because the zygote
uses the C library, this decision is made long before we know what API
level an app targets, so all code sees the new IFUNC-using C library.
@@ -462,6 +459,7 @@ detect hooking of C library functions might need to fix their code to cope
with IFUNC relocations. The affected functions are from `<string.h>`, but
may expand to include more functions (and more libraries) in future.
+
## Relative relocations (RELR)
Android added experimental support for RELR relative relocations
@@ -492,19 +490,22 @@ You can read more about relative relocations
and their long and complicated history at
https://maskray.me/blog/2021-10-31-relative-relocations-and-relr.
-## No more sentinels in .preinit_array/.init_array/.fini_array sections of executables (in All API levels)
-
-In Android <= U and NDK <= 26, Android used sentinels in these sections of
-executables to locate the start and end of arrays. However, when building with
-LTO, the function pointers in the arrays can be reordered, making sentinels no
-longer work. This prevents constructors for global C++ variables from being
-called in static executables when using LTO.
-To fix this, in Android >= V and NDK >= 27, we removed sentinels and switched
-to using symbols inserted by LLD (like `__init_array_start`,
-`__init_array_end`) to locate the arrays. This also avoids keeping a section
-when there are no corresponding functions.
+## No more sentinels in .preinit_array/.init_array/.fini_array sections of executables (in All API levels)
-For dynamic executables, we kept sentinel support in crtbegin_dynamic.o and
-libc.so. This ensures that executables built with newer crtbegin_dynamic.o
-(in NDK >= 27) work with older libc.so (in Android <= U), and vice versa.
+In Android <= API level 34 and NDK <= r26, Android used sentinels in the
+`.preinit_array`/`.init_array`/`.fini_array` sections of executables to locate
+the start and end of these arrays. When building with LTO, the function pointers
+in the arrays can be reordered, making sentinels no longer work. This prevents
+constructors for global C++ variables from being called in static executables
+when using LTO.
+
+To fix this, in Android >= API level 35 and NDK >= r27, we removed sentinels
+and switched to using symbols inserted by LLD (like `__init_array_start`,
+`__init_array_end`) to locate the arrays. This also avoids the need for an
+empty section when there are no corresponding functions.
+
+For dynamic executables, we kept sentinel support in `crtbegin_dynamic.o` and
+`libc.so`. This ensures that executables built with newer `crtbegin_dynamic.o`
+(in NDK >= r27) work with older `libc.so` (in Android <= API level 34), and
+vice versa.
diff --git a/libc/Android.bp b/libc/Android.bp
index 4020ede52..84fa498d3 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1075,6 +1075,8 @@ cc_library_static {
"arch-arm64/bionic/setjmp.S",
"arch-arm64/bionic/syscall.S",
"arch-arm64/bionic/vfork.S",
+ "arch-arm64/oryon/memcpy-nt.S",
+ "arch-arm64/oryon/memset-nt.S",
],
},
diff --git a/libc/NOTICE b/libc/NOTICE
index dfd93ff7a..1a84d3ca7 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -4024,6 +4024,33 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2012, Linaro Limited
+ All rights reserved.
+ Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2012-2014 ARM Ltd
All rights reserved.
@@ -5155,3 +5182,11 @@ THIS SOFTWARE.
-------------------------------------------------------------------
+memcpy - copy memory area
+
+Copyright (c) 2012-2022, Arm Limited.
+Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
+
+-------------------------------------------------------------------
+
diff --git a/libc/arch-arm64/bionic/__bionic_clone.S b/libc/arch-arm64/bionic/__bionic_clone.S
index e9932adaf..581b47afe 100644
--- a/libc/arch-arm64/bionic/__bionic_clone.S
+++ b/libc/arch-arm64/bionic/__bionic_clone.S
@@ -39,7 +39,7 @@ ENTRY_PRIVATE(__bionic_clone)
svc #0
# Are we the child?
- cbz x0, .L_bc_child
+ cbz x0, L(child)
# Set errno if something went wrong.
cmn x0, #(MAX_ERRNO + 1)
@@ -48,7 +48,7 @@ ENTRY_PRIVATE(__bionic_clone)
ret
-.L_bc_child:
+L(child):
# We're in the child now. Set the end of the frame record chain.
mov x29, #0
# Setting x30 to 0 will make the unwinder stop at __start_thread.
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index dd163496d..26ac2555a 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -72,7 +72,7 @@ ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
mov x8, __NR_clone
svc #0
- cbz x0, .L_exit
+ cbz x0, L(done)
// rc != 0: reset cached_pid_ and vforked_.
str w10, [x9, #20]
@@ -80,7 +80,7 @@ ENTRY_WEAK_FOR_NATIVE_BRIDGE(vfork)
cneg x0, x0, hi
b.hi __set_errno_internal
-.L_exit:
+L(done):
ret
END(vfork)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
index 450138c25..a42c36118 100644
--- a/libc/arch-arm64/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm64/dynamic_function_dispatch.cpp
@@ -30,6 +30,23 @@
#include <stddef.h>
#include <sys/auxv.h>
+static inline bool __bionic_is_oryon(unsigned long hwcap) {
+ if (!(hwcap & HWCAP_CPUID)) return false;
+
+ // Extract the implementor and variant bits from MIDR_EL1.
+ // https://www.kernel.org/doc/html/latest/arch/arm64/cpu-feature-registers.html#list-of-registers-with-visible-features
+ unsigned long midr;
+ __asm__ __volatile__("mrs %0, MIDR_EL1" : "=r"(midr));
+ uint16_t cpu = (midr >> 20) & 0xfff;
+
+ auto make_cpu = [](unsigned implementor, unsigned variant) {
+ return (implementor << 4) | variant;
+ };
+
+ // Check for implementor Qualcomm's variants 0x1..0x5 (Oryon).
+ return cpu >= make_cpu('Q', 0x1) && cpu <= make_cpu('Q', 0x5);
+}
+
extern "C" {
typedef void* memchr_func(const void*, int, size_t);
@@ -49,7 +66,9 @@ DEFINE_IFUNC_FOR(memcmp) {
typedef void* memcpy_func(void*, const void*, size_t);
DEFINE_IFUNC_FOR(memcpy) {
- if (arg->_hwcap & HWCAP_ASIMD) {
+ if (__bionic_is_oryon(arg->_hwcap)) {
+ RETURN_FUNC(memcpy_func, __memcpy_aarch64_nt);
+ } else if (arg->_hwcap & HWCAP_ASIMD) {
RETURN_FUNC(memcpy_func, __memcpy_aarch64_simd);
} else {
RETURN_FUNC(memcpy_func, __memcpy_aarch64);
@@ -58,11 +77,13 @@ DEFINE_IFUNC_FOR(memcpy) {
typedef void* memmove_func(void*, const void*, size_t);
DEFINE_IFUNC_FOR(memmove) {
- if (arg->_hwcap & HWCAP_ASIMD) {
- RETURN_FUNC(memmove_func, __memmove_aarch64_simd);
- } else {
- RETURN_FUNC(memmove_func, __memmove_aarch64);
- }
+ if (__bionic_is_oryon(arg->_hwcap)) {
+ RETURN_FUNC(memcpy_func, __memmove_aarch64_nt);
+ } else if (arg->_hwcap & HWCAP_ASIMD) {
+ RETURN_FUNC(memmove_func, __memmove_aarch64_simd);
+ } else {
+ RETURN_FUNC(memmove_func, __memmove_aarch64);
+ }
}
typedef int memrchr_func(const void*, int, size_t);
@@ -72,7 +93,11 @@ DEFINE_IFUNC_FOR(memrchr) {
typedef int memset_func(void*, int, size_t);
DEFINE_IFUNC_FOR(memset) {
- RETURN_FUNC(memset_func, __memset_aarch64);
+ if (__bionic_is_oryon(arg->_hwcap)) {
+ RETURN_FUNC(memset_func, __memset_aarch64_nt);
+ } else {
+ RETURN_FUNC(memset_func, __memset_aarch64);
+ }
}
typedef char* stpcpy_func(char*, const char*, size_t);
diff --git a/libc/arch-arm64/oryon/memcpy-nt.S b/libc/arch-arm64/oryon/memcpy-nt.S
new file mode 100644
index 000000000..46f154155
--- /dev/null
+++ b/libc/arch-arm64/oryon/memcpy-nt.S
@@ -0,0 +1,351 @@
+/*
+ * memcpy - copy memory area
+ *
+ * Copyright (c) 2012-2022, Arm Limited.
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
+ */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64, unaligned accesses.
+ *
+ */
+
+#include <private/bionic_asm.h>
+
+#define dstin x0
+#define src x1
+#define count x2
+#define dst x3
+#define srcend x4
+#define dstend x5
+#define A_l x6
+#define A_lw w6
+#define A_h x7
+#define B_l x8
+#define B_lw w8
+#define B_h x9
+#define C_l x10
+#define C_lw w10
+#define C_h x11
+#define D_l x12
+#define D_h x13
+#define E_l x14
+#define E_h x15
+#define F_l x16
+#define F_h x17
+#define G_l count
+#define G_h dst
+#define H_l src
+#define H_h srcend
+#define tmp1 x14
+#define tmp2 x16
+#define SMALL_BUFFER_SIZE 48
+
+/* This implementation handles overlaps and supports both memcpy and memmove
+ from a single entry point. It uses unaligned accesses and branchless
+ sequences to keep the code small, simple and improve performance.
+
+ Copies are split into 3 main cases: small copies of up to 32 bytes, medium
+ copies of up to 128 bytes, and large copies. The overhead of the overlap
+ check is negligible since it is only required for large copies.
+
+ Large copies use a software pipelined loop processing 64 bytes per iteration.
+ The destination pointer is 16-byte aligned to minimize unaligned accesses.
+ The loop tail is handled by always copying 64 bytes from the end.
+*/
+
+ALIAS_SYMBOL (__memmove_aarch64_nt, __memcpy_aarch64_nt)
+ENTRY (__memcpy_aarch64_nt)
+
+ add srcend, src, count
+ add dstend, dstin, count
+ cmp count, 128
+ b.hi L(copy_long)
+ cmp count, 32
+ b.hi L(copy32_128)
+
+ /* Small copies: 0..32 bytes. */
+ cmp count, 16
+ b.lo L(copy16)
+ ldp A_l, A_h, [src]
+ ldp D_l, D_h, [srcend, -16]
+ stp A_l, A_h, [dstin]
+ stp D_l, D_h, [dstend, -16]
+ ret
+
+ /* Copy 8-15 bytes. */
+L(copy16):
+ tbz count, 3, L(copy8)
+ ldr A_l, [src]
+ ldr A_h, [srcend, -8]
+ str A_l, [dstin]
+ str A_h, [dstend, -8]
+ ret
+
+ .p2align 3
+ /* Copy 4-7 bytes. */
+L(copy8):
+ tbz count, 2, L(copy4)
+ ldr A_lw, [src]
+ ldr B_lw, [srcend, -4]
+ str A_lw, [dstin]
+ str B_lw, [dstend, -4]
+ ret
+
+ /* Copy 0..3 bytes using a branchless sequence. */
+L(copy4):
+ cbz count, L(copy0)
+ lsr tmp1, count, 1
+ ldrb A_lw, [src]
+ ldrb C_lw, [srcend, -1]
+ ldrb B_lw, [src, tmp1]
+ strb A_lw, [dstin]
+ strb B_lw, [dstin, tmp1]
+ strb C_lw, [dstend, -1]
+L(copy0):
+ ret
+
+ .p2align 4
+ /* Medium copies: 33..128 bytes. */
+L(copy32_128):
+ ldp A_l, A_h, [src]
+ ldp B_l, B_h, [src, 16]
+ ldp C_l, C_h, [srcend, -32]
+ ldp D_l, D_h, [srcend, -16]
+ cmp count, 64
+ b.hi L(copy128)
+ stp A_l, A_h, [dstin]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstend, -32]
+ stp D_l, D_h, [dstend, -16]
+ ret
+
+ .p2align 4
+ /* Copy 65..128 bytes. */
+L(copy128):
+ ldp E_l, E_h, [src, 32]
+ ldp F_l, F_h, [src, 48]
+ cmp count, 96
+ b.ls L(copy96)
+ ldp G_l, G_h, [srcend, -64]
+ ldp H_l, H_h, [srcend, -48]
+ stp G_l, G_h, [dstend, -64]
+ stp H_l, H_h, [dstend, -48]
+L(copy96):
+ stp A_l, A_h, [dstin]
+ stp B_l, B_h, [dstin, 16]
+ stp E_l, E_h, [dstin, 32]
+ stp F_l, F_h, [dstin, 48]
+ stp C_l, C_h, [dstend, -32]
+ stp D_l, D_h, [dstend, -16]
+ ret
+
+ .p2align 4
+ /* Copy more than 128 bytes. */
+L(copy_long):
+ mov tmp2, #SMALL_BUFFER_SIZE
+ cmp count, tmp2, LSL#10
+ bgt L(copy_long_nt)
+ /* Use backwards copy if there is an overlap. */
+ sub tmp1, dstin, src
+ cbz tmp1, L(copy0)
+ cmp tmp1, count
+ b.lo L(copy_long_backwards)
+
+ /* Copy 16 bytes and then align dst to 16-byte alignment. */
+
+ ldp D_l, D_h, [src]
+ and tmp1, dstin, 15
+ bic dst, dstin, 15
+ sub src, src, tmp1
+ add count, count, tmp1 /* Count is now 16 too large. */
+ ldp A_l, A_h, [src, 16]
+ stp D_l, D_h, [dstin]
+ ldp B_l, B_h, [src, 32]
+ ldp C_l, C_h, [src, 48]
+ ldp D_l, D_h, [src, 64]!
+ subs count, count, 128 + 16 /* Test and readjust count. */
+ b.ls L(copy64_from_end)
+
+L(loop64):
+ stp A_l, A_h, [dst, 16]
+ ldp A_l, A_h, [src, 16]
+ stp B_l, B_h, [dst, 32]
+ ldp B_l, B_h, [src, 32]
+ stp C_l, C_h, [dst, 48]
+ ldp C_l, C_h, [src, 48]
+ stp D_l, D_h, [dst, 64]!
+ ldp D_l, D_h, [src, 64]!
+ subs count, count, 64
+ b.hi L(loop64)
+
+ /* Write the last iteration and copy 64 bytes from the end. */
+L(copy64_from_end):
+ ldp E_l, E_h, [srcend, -64]
+ stp A_l, A_h, [dst, 16]
+ ldp A_l, A_h, [srcend, -48]
+ stp B_l, B_h, [dst, 32]
+ ldp B_l, B_h, [srcend, -32]
+ stp C_l, C_h, [dst, 48]
+ ldp C_l, C_h, [srcend, -16]
+ stp D_l, D_h, [dst, 64]
+ stp E_l, E_h, [dstend, -64]
+ stp A_l, A_h, [dstend, -48]
+ stp B_l, B_h, [dstend, -32]
+ stp C_l, C_h, [dstend, -16]
+ ret
+
+ .p2align 4
+
+ /* Large backwards copy for overlapping copies.
+ Copy 16 bytes and then align dst to 16-byte alignment. */
+L(copy_long_backwards):
+ ldp D_l, D_h, [srcend, -16]
+ and tmp1, dstend, 15
+ sub srcend, srcend, tmp1
+ sub count, count, tmp1
+ ldp A_l, A_h, [srcend, -16]
+ stp D_l, D_h, [dstend, -16]
+ ldp B_l, B_h, [srcend, -32]
+ ldp C_l, C_h, [srcend, -48]
+ ldp D_l, D_h, [srcend, -64]!
+ sub dstend, dstend, tmp1
+ subs count, count, 128
+ b.ls L(copy64_from_start)
+
+L(loop64_backwards):
+ stp A_l, A_h, [dstend, -16]
+ ldp A_l, A_h, [srcend, -16]
+ stp B_l, B_h, [dstend, -32]
+ ldp B_l, B_h, [srcend, -32]
+ stp C_l, C_h, [dstend, -48]
+ ldp C_l, C_h, [srcend, -48]
+ stp D_l, D_h, [dstend, -64]!
+ ldp D_l, D_h, [srcend, -64]!
+ subs count, count, 64
+ b.hi L(loop64_backwards)
+
+ /* Write the last iteration and copy 64 bytes from the start. */
+L(copy64_from_start):
+ ldp G_l, G_h, [src, 48]
+ stp A_l, A_h, [dstend, -16]
+ ldp A_l, A_h, [src, 32]
+ stp B_l, B_h, [dstend, -32]
+ ldp B_l, B_h, [src, 16]
+ stp C_l, C_h, [dstend, -48]
+ ldp C_l, C_h, [src]
+ stp D_l, D_h, [dstend, -64]
+ stp G_l, G_h, [dstin, 48]
+ stp A_l, A_h, [dstin, 32]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstin]
+ ret
+
+ .p2align 4
+ /* Copy more than 48 KB using ldnp+stnp (non-temporal) instructions. */
+L(copy_long_nt):
+ /* Use backwards copy if there is an overlap. */
+ sub tmp1, dstin, src
+ cbz tmp1, L(copy0)
+ cmp tmp1, count
+ b.lo L(copy_long_backwards_nt)
+
+ /* Copy 16 bytes and then align dst to 16-byte alignment. */
+
+ ldnp D_l, D_h, [src]
+ and tmp1, dstin, 15
+ bic dst, dstin, 15
+ sub src, src, tmp1
+ add count, count, tmp1 /* Count is now 16 too large. */
+ ldnp A_l, A_h, [src, 16]
+ stnp D_l, D_h, [dstin]
+ ldnp B_l, B_h, [src, 32]
+ ldnp C_l, C_h, [src, 48]
+ ldnp D_l, D_h, [src, 64]
+ add src, src, #64
+ subs count, count, 128 + 16 /* Test and readjust count. */
+ b.ls L(copy64_from_end_nt)
+
+L(loop64_nt):
+ stnp A_l, A_h, [dst, 16]
+ ldnp A_l, A_h, [src, 16]
+ stnp B_l, B_h, [dst, 32]
+ ldnp B_l, B_h, [src, 32]
+ stnp C_l, C_h, [dst, 48]
+ ldnp C_l, C_h, [src, 48]
+ stnp D_l, D_h, [dst, 64]
+ add dst, dst, #64
+ ldnp D_l, D_h, [src, 64]
+ add src, src, #64
+ subs count, count, 64
+ b.hi L(loop64_nt)
+
+ /* Write the last iteration and copy 64 bytes from the end. */
+L(copy64_from_end_nt):
+ ldnp E_l, E_h, [srcend, -64]
+ stnp A_l, A_h, [dst, 16]
+ ldnp A_l, A_h, [srcend, -48]
+ stnp B_l, B_h, [dst, 32]
+ ldnp B_l, B_h, [srcend, -32]
+ stnp C_l, C_h, [dst, 48]
+ ldnp C_l, C_h, [srcend, -16]
+ stnp D_l, D_h, [dst, 64]
+ stnp E_l, E_h, [dstend, -64]
+ stnp A_l, A_h, [dstend, -48]
+ stnp B_l, B_h, [dstend, -32]
+ stnp C_l, C_h, [dstend, -16]
+ ret
+
+ .p2align 4
+
+ /* Large backwards copy for overlapping copies.
+ Copy 16 bytes and then align dst to 16-byte alignment. */
+L(copy_long_backwards_nt):
+ ldnp D_l, D_h, [srcend, -16]
+ and tmp1, dstend, 15
+ sub srcend, srcend, tmp1
+ sub count, count, tmp1
+ ldnp A_l, A_h, [srcend, -16]
+ stnp D_l, D_h, [dstend, -16]
+ ldnp B_l, B_h, [srcend, -32]
+ ldnp C_l, C_h, [srcend, -48]
+ ldnp D_l, D_h, [srcend, -64]
+ add srcend, srcend, #-64
+ sub dstend, dstend, tmp1
+ subs count, count, 128
+ b.ls L(copy64_from_start_nt)
+
+L(loop64_backwards_nt):
+ stnp A_l, A_h, [dstend, -16]
+ ldnp A_l, A_h, [srcend, -16]
+ stnp B_l, B_h, [dstend, -32]
+ ldnp B_l, B_h, [srcend, -32]
+ stnp C_l, C_h, [dstend, -48]
+ ldnp C_l, C_h, [srcend, -48]
+ stnp D_l, D_h, [dstend, -64]
+ add dstend, dstend, #-64
+ ldnp D_l, D_h, [srcend, -64]
+ add srcend, srcend, #-64
+ subs count, count, 64
+ b.hi L(loop64_backwards_nt)
+
+ /* Write the last iteration and copy 64 bytes from the start. */
+L(copy64_from_start_nt):
+ ldnp G_l, G_h, [src, 48]
+ stnp A_l, A_h, [dstend, -16]
+ ldnp A_l, A_h, [src, 32]
+ stnp B_l, B_h, [dstend, -32]
+ ldnp B_l, B_h, [src, 16]
+ stnp C_l, C_h, [dstend, -48]
+ ldnp C_l, C_h, [src]
+ stnp D_l, D_h, [dstend, -64]
+ stnp G_l, G_h, [dstin, 48]
+ stnp A_l, A_h, [dstin, 32]
+ stnp B_l, B_h, [dstin, 16]
+ stnp C_l, C_h, [dstin]
+ ret
+
+END (__memcpy_aarch64_nt)
+
diff --git a/libc/arch-arm64/oryon/memset-nt.S b/libc/arch-arm64/oryon/memset-nt.S
new file mode 100644
index 000000000..b91e7daa0
--- /dev/null
+++ b/libc/arch-arm64/oryon/memset-nt.S
@@ -0,0 +1,218 @@
+/* Copyright (c) 2012, Linaro Limited
+ All rights reserved.
+ Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Unaligned accesses
+ *
+ */
+#include <private/bionic_asm.h>
+
+#define dstin x0
+#define val w1
+#define count x2
+#define tmp1 x3
+#define tmp1w w3
+#define tmp2 x4
+#define tmp2w w4
+#define zva_len_x x5
+#define zva_len w5
+#define zva_bits_x x6
+#define A_l x7
+#define A_lw w7
+#define dst x8
+#define tmp3w w9
+#define tmp4 x10
+#define SMALL_BUFFER_SIZE 96
+
+ENTRY(__memset_aarch64_nt)
+ mov dst, dstin /* Preserve return value. */
+ ands A_lw, val, #255
+ b.eq .Lzero_mem /* Use DC ZVA instruction if the val = 0 */
+ orr A_lw, A_lw, A_lw, lsl #8
+ orr A_lw, A_lw, A_lw, lsl #16
+ orr A_l, A_l, A_l, lsl #32
+.Ltail_maybe_long:
+ cmp count, #64
+ b.ge .Lnot_short
+.Ltail_maybe_tiny:
+ cmp count, #15
+ b.le .Ltail15tiny
+.Ltail63:
+ ands tmp1, count, #0x30
+ b.eq .Ltail15
+ add dst, dst, tmp1
+ cmp tmp1w, #0x20
+ b.eq 1f
+ b.lt 2f
+ stp A_l, A_l, [dst, #-48]
+1:
+ stp A_l, A_l, [dst, #-32]
+2:
+ stp A_l, A_l, [dst, #-16]
+.Ltail15:
+ and count, count, #15
+ add dst, dst, count
+ stp A_l, A_l, [dst, #-16] /* Repeat some/all of last store. */
+ ret
+.Ltail15tiny:
+ /* Set up to 15 bytes. Does not assume earlier memory
+ being set. */
+ tbz count, #3, 1f
+ str A_l, [dst], #8
+1:
+ tbz count, #2, 1f
+ str A_lw, [dst], #4
+1:
+ tbz count, #1, 1f
+ strh A_lw, [dst], #2
+1:
+ tbz count, #0, 1f
+ strb A_lw, [dst]
+1:
+ ret
+ /* Critical loop. Start at a new cache line boundary. Assuming
+ * 64 bytes per line, this ensures the entire loop is in one line. */
+ .p2align 6
+.Lnot_short:
+ mov tmp4, #SMALL_BUFFER_SIZE
+ cmp count, tmp4, LSL#10
+ /* Use non-temporal instruction if count > SMALL_BUFFER_SIZE */
+ bgt L(not_short_nt)
+ neg tmp2, dst
+ ands tmp2, tmp2, #15
+ b.eq 2f
+ /* Bring DST to 128-bit (16-byte) alignment. We know that there's
+ * more than that to set, so we simply store 16 bytes and advance by
+ * the amount required to reach alignment. */
+ sub count, count, tmp2
+ stp A_l, A_l, [dst]
+ add dst, dst, tmp2
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le .Ltail63
+2:
+ sub dst, dst, #16 /* Pre-bias. */
+ sub count, count, #64
+1:
+ stp A_l, A_l, [dst, #16]
+ stp A_l, A_l, [dst, #32]
+ stp A_l, A_l, [dst, #48]
+ stp A_l, A_l, [dst, #64]!
+ subs count, count, #64
+ b.ge 1b
+ tst count, #0x3f
+ add dst, dst, #16
+ b.ne .Ltail63
+ ret
+.Lnot_short_nt:
+ neg tmp2, dst
+ ands tmp2, tmp2, #15
+ b.eq 2f
+ /* Bring DST to 128-bit (16-byte) alignment. We know that there's
+ * more than that to set, so we simply store 16 bytes and advance by
+ * the amount required to reach alignment. */
+ sub count, count, tmp2
+ stnp A_l, A_l, [dst]
+ add dst, dst, tmp2
+ /* There may be less than 63 bytes to go now. */
+ cmp count, #63
+ b.le .Ltail63
+2:
+ sub dst, dst, #16 /* Pre-bias. */
+ sub count, count, #64
+1:
+ stnp A_l, A_l, [dst, #16]
+ stnp A_l, A_l, [dst, #32]
+ stnp A_l, A_l, [dst, #48]
+ stnp A_l, A_l, [dst, #64]
+ add dst, dst, #64
+ subs count, count, #64
+ b.ge 1b
+ tst count, #0x3f
+ add dst, dst, #16
+ b.ne .Ltail63
+ ret
+.Lzero_mem:
+ mov A_l, #0
+ cmp count, #63
+ b.le .Ltail_maybe_tiny
+ neg tmp2, dst
+ ands tmp2, tmp2, #15
+ b.eq 1f
+ sub count, count, tmp2
+ stp A_l, A_l, [dst]
+ add dst, dst, tmp2
+ cmp count, #63
+ b.le .Ltail63
+1:
+ /* For zeroing small amounts of memory, it's not worth setting up
+ * the line-clear code. */
+ cmp count, #128
+ b.lt .Lnot_short
+ mrs tmp1, dczid_el0
+ tbnz tmp1, #4, .Lnot_short
+ mov tmp3w, #4
+ and zva_len, tmp1w, #15 /* Safety: other bits reserved. */
+ lsl zva_len, tmp3w, zva_len
+.Lzero_by_line:
+ /* Compute how far we need to go to become suitably aligned. We're
+ * already at quad-word alignment. */
+ cmp count, zva_len_x
+ b.lt .Lnot_short /* Not enough to reach alignment. */
+ sub zva_bits_x, zva_len_x, #1
+ neg tmp2, dst
+ ands tmp2, tmp2, zva_bits_x
+ b.eq 1f /* Already aligned. */
+ /* Not aligned, check that there's enough to copy after alignment. */
+ sub tmp1, count, tmp2
+ cmp tmp1, #64
+ ccmp tmp1, zva_len_x, #8, ge /* NZCV=0b1000 */
+ b.lt .Lnot_short
+ /* We know that there's at least 64 bytes to zero and that it's safe
+ * to overrun by 64 bytes. */
+ mov count, tmp1
+2:
+ stp A_l, A_l, [dst]
+ stp A_l, A_l, [dst, #16]
+ stp A_l, A_l, [dst, #32]
+ subs tmp2, tmp2, #64
+ stp A_l, A_l, [dst, #48]
+ add dst, dst, #64
+ b.ge 2b
+ /* We've overrun a bit, so adjust dst downwards. */
+ add dst, dst, tmp2
+1:
+ sub count, count, zva_len_x
+3:
+ dc zva, dst
+ add dst, dst, zva_len_x
+ subs count, count, zva_len_x
+ b.ge 3b
+ ands count, count, zva_bits_x
+ b.ne .Ltail_maybe_long
+ ret
+END(__memset_aarch64_nt)
diff --git a/libc/arch-arm64/string/__memcpy_chk.S b/libc/arch-arm64/string/__memcpy_chk.S
index a8e9e83d0..c9fc2f785 100644
--- a/libc/arch-arm64/string/__memcpy_chk.S
+++ b/libc/arch-arm64/string/__memcpy_chk.S
@@ -31,10 +31,10 @@
ENTRY(__memcpy_chk)
cmp x2, x3
// Direct b.ls memcpy may not have enough range
- b.hi .L_memcpy_chk_fail
+ b.hi L(__memcpy_chk_fail_trampoline)
b memcpy
-.L_memcpy_chk_fail:
+L(__memcpy_chk_fail_trampoline):
// Preserve for accurate backtrace.
stp x29, x30, [sp, -16]!
.cfi_def_cfa_offset 16
diff --git a/libc/arch-arm64/string/__memset_chk.S b/libc/arch-arm64/string/__memset_chk.S
index e1e29d06c..7a105ce54 100644
--- a/libc/arch-arm64/string/__memset_chk.S
+++ b/libc/arch-arm64/string/__memset_chk.S
@@ -31,10 +31,10 @@
ENTRY(__memset_chk)
cmp x2, x3
// Direct b.ls memcpy may not have enough range
- b.hi .L_memset_chk_fail
+ b.hi L(__memset_chk_fail_trampoline)
b memset
-.L_memset_chk_fail:
+L(__memset_chk_fail_trampoline):
// Preserve for accurate backtrace.
stp x29, x30, [sp, -16]!
.cfi_def_cfa_offset 16
diff --git a/libc/arch-riscv64/bionic/__bionic_clone.S b/libc/arch-riscv64/bionic/__bionic_clone.S
index 28278577b..be386b148 100644
--- a/libc/arch-riscv64/bionic/__bionic_clone.S
+++ b/libc/arch-riscv64/bionic/__bionic_clone.S
@@ -41,19 +41,19 @@ ENTRY_PRIVATE(__bionic_clone)
ecall
# Are we the child?
- beqz a0, .L_bc_child
+ beqz a0, L(child)
# Did the clone(2) fail?
- bltz a0, .L_bc_failure
+ bltz a0, L(failure)
# Nope, we're the parent, and our work here is done.
ret
-.L_bc_failure:
+L(failure):
# Set errno if something went wrong.
neg a0, a0
tail __set_errno_internal
-.L_bc_child:
+L(child):
# We're in the child now. Set the end of the frame record chain.
li fp, 0
# Setting ra to 0 will make the unwinder stop at __start_thread.
diff --git a/libc/arch-riscv64/bionic/setjmp.S b/libc/arch-riscv64/bionic/setjmp.S
index 81b1e358d..5de10992c 100644
--- a/libc/arch-riscv64/bionic/setjmp.S
+++ b/libc/arch-riscv64/bionic/setjmp.S
@@ -205,7 +205,7 @@ ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
// Check the checksum before doing anything.
m_calculate_checksum t0, a0, t1
ld t1, _JB_CHECKSUM(a0)
- bne t0, t1, 3f
+ bne t0, t1, L(checksum_failure)
// Do we need to restore the signal mask?
ld a2, _JB_SIGFLAG(a0)
@@ -290,7 +290,7 @@ ENTRY_WEAK_FOR_NATIVE_BRIDGE(siglongjmp)
mv a0, a1
ret
-3:
+L(checksum_failure):
call __bionic_setjmp_checksum_mismatch
END(siglongjmp)
diff --git a/libc/arch-riscv64/bionic/syscall.S b/libc/arch-riscv64/bionic/syscall.S
index 1a6e60a9d..ca735c7f9 100644
--- a/libc/arch-riscv64/bionic/syscall.S
+++ b/libc/arch-riscv64/bionic/syscall.S
@@ -44,10 +44,10 @@ ENTRY(syscall)
// Did it fail?
li a7, -MAX_ERRNO
- bgtu a0, a7, 1f
-
+ bgtu a0, a7, L(failure)
ret
-1:
+
+L(failure):
neg a0, a0
tail __set_errno_internal
END(syscall)
diff --git a/libc/arch-riscv64/bionic/vfork.S b/libc/arch-riscv64/bionic/vfork.S
index 29ab405bc..06ebc3e37 100644
--- a/libc/arch-riscv64/bionic/vfork.S
+++ b/libc/arch-riscv64/bionic/vfork.S
@@ -51,16 +51,16 @@ ENTRY(vfork)
ecall
// if (rc == 0) we're the child, and finished...
- beqz a0, .L_success
+ beqz a0, L(success)
// else if (rc != 0): reset cached_pid_ and vforked_...
sw t2, 20(t0)
// ...and work out whether we succeeded or failed.
- bltz a0, .L_failure
-.L_success:
+ bltz a0, L(failure)
+L(success):
ret
-.L_failure:
+L(failure):
neg a0, a0
tail __set_errno_internal
END(vfork)
diff --git a/libc/arch-riscv64/dynamic_function_dispatch.cpp b/libc/arch-riscv64/dynamic_function_dispatch.cpp
index 265ce3ee6..bb2ba5101 100644
--- a/libc/arch-riscv64/dynamic_function_dispatch.cpp
+++ b/libc/arch-riscv64/dynamic_function_dispatch.cpp
@@ -35,7 +35,7 @@
extern "C" {
-static __always_inline int ifunc_faccessat(int dir_fd, const char* path, int mode) {
+static inline __always_inline int ifunc_faccessat(int dir_fd, const char* path, int mode) {
register long a0 __asm__("a0") = dir_fd;
register long a1 __asm__("a1") = reinterpret_cast<long>(path);
register long a2 __asm__("a2") = mode;
diff --git a/libc/arch-x86/bionic/setjmp.S b/libc/arch-x86/bionic/setjmp.S
index d22683a57..b9e6bdf92 100644
--- a/libc/arch-x86/bionic/setjmp.S
+++ b/libc/arch-x86/bionic/setjmp.S
@@ -65,19 +65,16 @@
.endm
ENTRY_WEAK_FOR_NATIVE_BRIDGE(setjmp)
- movl 4(%esp),%ecx
mov $1,%eax
jmp .L_sigsetjmp
END(setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(_setjmp)
- movl 4(%esp),%ecx
movl $0,%eax
jmp .L_sigsetjmp
END(_setjmp)
ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
- movl 4(%esp),%ecx
movl 8(%esp),%eax
.L_sigsetjmp:
@@ -88,6 +85,7 @@ ENTRY_WEAK_FOR_NATIVE_BRIDGE(sigsetjmp)
PIC_EPILOGUE
// Record the setjmp cookie and whether or not we're saving the signal mask.
+ movl 4(%esp),%ecx
movl %eax,(_JB_SIGFLAG * 4)(%ecx)
// Do we need to save the signal mask?
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 7dee5e305..80f7c20ac 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -99,8 +99,8 @@ char* __fgets_chk(char* dst, int supplied_size, FILE* stream, size_t dst_len_fro
}
size_t __fread_chk(void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) {
- size_t total;
- if (__predict_false(__size_mul_overflow(size, count, &total))) {
+ unsigned long total;
+ if (__predict_false(__builtin_umull_overflow(size, count, &total))) {
// overflow: trigger the error path in fread
return fread(buf, size, count, stream);
}
@@ -109,8 +109,8 @@ size_t __fread_chk(void* buf, size_t size, size_t count, FILE* stream, size_t bu
}
size_t __fwrite_chk(const void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) {
- size_t total;
- if (__predict_false(__size_mul_overflow(size, count, &total))) {
+ unsigned long total;
+ if (__predict_false(__builtin_umull_overflow(size, count, &total))) {
// overflow: trigger the error path in fwrite
return fwrite(buf, size, count, stream);
}
diff --git a/libc/bionic/gwp_asan_wrappers.cpp b/libc/bionic/gwp_asan_wrappers.cpp
index 251633d78..11f7cedd2 100644
--- a/libc/bionic/gwp_asan_wrappers.cpp
+++ b/libc/bionic/gwp_asan_wrappers.cpp
@@ -258,14 +258,14 @@ void SetDefaultGwpAsanOptions(Options* options, unsigned* process_sample_rate,
options->Backtrace = android_unsafe_frame_pointer_chase;
options->SampleRate = kDefaultSampleRate;
options->MaxSimultaneousAllocations = kDefaultMaxAllocs;
+ options->Recoverable = true;
+ GwpAsanRecoverable = true;
- *process_sample_rate = 1;
- if (mallopt_options.desire == Action::TURN_ON_WITH_SAMPLING) {
+ if (mallopt_options.desire == Action::TURN_ON_WITH_SAMPLING ||
+ mallopt_options.desire == Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING) {
*process_sample_rate = kDefaultProcessSampling;
- } else if (mallopt_options.desire == Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING) {
- *process_sample_rate = kDefaultProcessSampling;
- options->Recoverable = true;
- GwpAsanRecoverable = true;
+ } else {
+ *process_sample_rate = 1;
}
}
@@ -403,7 +403,7 @@ bool GetGwpAsanOptions(Options* options, unsigned* process_sample_rate,
/* default */ kDefaultMaxAllocs / frequency_multiplier;
}
- bool recoverable = false;
+ bool recoverable = true;
if (GetGwpAsanBoolOption(&recoverable, mallopt_options, kRecoverableSystemSysprop,
kRecoverableAppSysprop, kRecoverableTargetedSyspropPrefix,
kRecoverableEnvVar, "recoverable")) {
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp
index c4347e8a3..4d1981c30 100644
--- a/libc/bionic/heap_tagging.cpp
+++ b/libc/bionic/heap_tagging.cpp
@@ -65,7 +65,7 @@ void SetDefaultHeapTaggingLevel() {
};
});
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
switch (heap_tagging_level) {
case M_HEAP_TAGGING_LEVEL_TBI:
case M_HEAP_TAGGING_LEVEL_NONE:
@@ -123,7 +123,7 @@ bool SetHeapTaggingLevel(HeapTaggingLevel tag_level) {
return false;
}
}
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
scudo_malloc_disable_memory_tagging();
#endif
break;
@@ -151,12 +151,12 @@ bool SetHeapTaggingLevel(HeapTaggingLevel tag_level) {
if (!set_tcf_on_all_threads(PR_MTE_TCF_ASYNC | PR_MTE_TCF_SYNC)) {
set_tcf_on_all_threads(PR_MTE_TCF_ASYNC);
}
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
scudo_malloc_set_track_allocation_stacks(0);
#endif
} else if (tag_level == M_HEAP_TAGGING_LEVEL_SYNC) {
set_tcf_on_all_threads(PR_MTE_TCF_SYNC);
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
scudo_malloc_set_track_allocation_stacks(1);
#endif
}
diff --git a/libc/bionic/jemalloc_wrapper.cpp b/libc/bionic/jemalloc_wrapper.cpp
index a2bb1dbb4..1bbdb296c 100644
--- a/libc/bionic/jemalloc_wrapper.cpp
+++ b/libc/bionic/jemalloc_wrapper.cpp
@@ -77,9 +77,13 @@ void* je_aligned_alloc_wrapper(size_t alignment, size_t size) {
int je_mallopt(int param, int value) {
// The only parameter we currently understand is M_DECAY_TIME.
if (param == M_DECAY_TIME) {
- // Only support setting the value to 1 or 0.
+ // Only support setting the value to -1 or 0 or 1.
ssize_t decay_time_ms;
- if (value) {
+ if (value < 0) {
+ // Given that SSIZE_MAX may not be supported in jemalloc, set this to a
+ // sufficiently large number that essentially disables the decay timer.
+ decay_time_ms = 10000000;
+ } else if (value) {
decay_time_ms = 1000;
} else {
decay_time_ms = 0;
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 944098f42..c82c52e9d 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -96,7 +96,7 @@ void __libc_init_scudo() {
SetDefaultHeapTaggingLevel();
// TODO(b/158870657) make this unconditional when all devices support SCUDO.
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
#if defined(SCUDO_PATTERN_FILL_CONTENTS)
scudo_malloc_set_pattern_fill_contents(1);
#elif defined(SCUDO_ZERO_CONTENTS)
@@ -182,7 +182,7 @@ void __libc_init_fork_handler() {
extern "C" void scudo_malloc_set_add_large_allocation_slack(int add_slack);
__BIONIC_WEAK_FOR_NATIVE_BRIDGE void __libc_set_target_sdk_version(int target __unused) {
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
scudo_malloc_set_add_large_allocation_slack(target < __ANDROID_API_S__);
#endif
}
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 1180a513e..2dde2f10f 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -61,7 +61,7 @@ extern "C" {
};
void memtag_stack_dlopen_callback() {
- async_safe_format_log(ANDROID_LOG_INFO, "libc", "remapping stacks as PROT_MTE");
+ async_safe_format_log(ANDROID_LOG_DEBUG, "libc", "remapping stacks as PROT_MTE");
__pthread_internal_remap_stack_with_mte();
}
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
index 9932e3e53..596a1fc82 100644
--- a/libc/bionic/malloc_common.cpp
+++ b/libc/bionic/malloc_common.cpp
@@ -123,7 +123,7 @@ extern "C" int mallopt(int param, int value) {
// Track the M_DECAY_TIME mallopt calls.
if (param == M_DECAY_TIME && retval == 1) {
__libc_globals.mutate([value](libc_globals* globals) {
- if (value == 0) {
+ if (value <= 0) {
atomic_store(&globals->decay_time_enabled, false);
} else {
atomic_store(&globals->decay_time_enabled, true);
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 88581784a..6db625128 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -381,7 +381,7 @@ static void MallocInitImpl(libc_globals* globals) {
MaybeInitGwpAsanFromLibc(globals);
-#if defined(USE_SCUDO)
+#if defined(USE_SCUDO) && !__has_feature(hwaddress_sanitizer)
__libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr();
__libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr();
__libc_shared_globals()->scudo_ring_buffer = __scudo_get_ring_buffer_addr();
diff --git a/libc/bionic/pthread_rwlock.cpp b/libc/bionic/pthread_rwlock.cpp
index ebf6697a0..6f3c6feb8 100644
--- a/libc/bionic/pthread_rwlock.cpp
+++ b/libc/bionic/pthread_rwlock.cpp
@@ -69,11 +69,12 @@
#define RWLOCKATTR_KIND_MASK 2
#define RWLOCKATTR_RESERVED_MASK (~3)
-static inline __always_inline __always_inline bool __rwlockattr_getpshared(const pthread_rwlockattr_t* attr) {
+static inline __always_inline bool __rwlockattr_getpshared(const pthread_rwlockattr_t* attr) {
return (*attr & RWLOCKATTR_PSHARED_MASK) >> RWLOCKATTR_PSHARED_SHIFT;
}
-static inline __always_inline __always_inline void __rwlockattr_setpshared(pthread_rwlockattr_t* attr, int pshared) {
+static inline __always_inline void __rwlockattr_setpshared(pthread_rwlockattr_t* attr,
+ int pshared) {
*attr = (*attr & ~RWLOCKATTR_PSHARED_MASK) | (pshared << RWLOCKATTR_PSHARED_SHIFT);
}
diff --git a/libc/bionic/sys_statvfs.cpp b/libc/bionic/sys_statvfs.cpp
index b3a0aca0c..3a05c3fa6 100644
--- a/libc/bionic/sys_statvfs.cpp
+++ b/libc/bionic/sys_statvfs.cpp
@@ -17,7 +17,7 @@
#include <sys/statfs.h>
#include <sys/statvfs.h>
-static __inline void __bionic_statfs_to_statvfs(const struct statfs* src, struct statvfs* dst) {
+static inline void __bionic_statfs_to_statvfs(const struct statfs* src, struct statvfs* dst) {
dst->f_bsize = src->f_bsize;
dst->f_frsize = src->f_frsize;
dst->f_blocks = src->f_blocks;
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index 6e49bced6..73cf15190 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -257,6 +257,21 @@ static void detect_protocol_version() {
}
}
+static const char* __prop_error_to_string(int error) {
+ switch (error) {
+ case PROP_ERROR_READ_CMD: return "PROP_ERROR_READ_CMD";
+ case PROP_ERROR_READ_DATA: return "PROP_ERROR_READ_DATA";
+ case PROP_ERROR_READ_ONLY_PROPERTY: return "PROP_ERROR_READ_ONLY_PROPERTY";
+ case PROP_ERROR_INVALID_NAME: return "PROP_ERROR_INVALID_NAME";
+ case PROP_ERROR_INVALID_VALUE: return "PROP_ERROR_INVALID_VALUE";
+ case PROP_ERROR_PERMISSION_DENIED: return "PROP_ERROR_PERMISSION_DENIED";
+ case PROP_ERROR_INVALID_CMD: return "PROP_ERROR_INVALID_CMD";
+ case PROP_ERROR_HANDLE_CONTROL_MESSAGE: return "PROP_ERROR_HANDLE_CONTROL_MESSAGE";
+ case PROP_ERROR_SET_FAILED: return "PROP_ERROR_SET_FAILED";
+ }
+ return "<unknown>";
+}
+
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int __system_property_set(const char* key, const char* value) {
if (key == nullptr) return -1;
@@ -310,8 +325,8 @@ int __system_property_set(const char* key, const char* value) {
if (result != PROP_SUCCESS) {
async_safe_format_log(ANDROID_LOG_WARN, "libc",
- "Unable to set property \"%s\" to \"%s\": error code: 0x%x", key, value,
- result);
+ "Unable to set property \"%s\" to \"%s\": %s (0x%x)", key, value,
+ __prop_error_to_string(result), result);
return -1;
}
diff --git a/libc/dns/resolv/res_cache.c b/libc/dns/resolv/res_cache.c
index f4c590f60..d6416e5c5 100644
--- a/libc/dns/resolv/res_cache.c
+++ b/libc/dns/resolv/res_cache.c
@@ -1166,14 +1166,14 @@ entry_free( Entry* e )
}
}
-static __inline__ void
+static inline void
entry_mru_remove( Entry* e )
{
e->mru_prev->mru_next = e->mru_next;
e->mru_next->mru_prev = e->mru_prev;
}
-static __inline__ void
+static inline void
entry_mru_add( Entry* e, Entry* list )
{
Entry* first = list->mru_next;
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 77ec6530b..113897c97 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -191,7 +191,7 @@ int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
#if __ANDROID_API__ < 29
/* android_get_device_api_level is a static inline before API level 29. */
-#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
+#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static inline
#include <bits/get_device_api_level_inlines.h>
#undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE
diff --git a/libc/include/android/legacy_stdlib_inlines.h b/libc/include/android/legacy_stdlib_inlines.h
index f0985fe61..0ca1022e8 100644
--- a/libc/include/android/legacy_stdlib_inlines.h
+++ b/libc/include/android/legacy_stdlib_inlines.h
@@ -38,15 +38,15 @@
__BEGIN_DECLS
-static __inline double strtod_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
+static inline double strtod_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
return strtod(__s, __end_ptr);
}
-static __inline float strtof_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
+static inline float strtof_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, locale_t _Nonnull __l) {
return strtof(__s, __end_ptr);
}
-static __inline long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) {
+static inline long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, int __base, locale_t _Nonnull __l) {
return strtol(__s, __end_ptr, __base);
}
diff --git a/libc/include/android/legacy_termios_inlines.h b/libc/include/android/legacy_termios_inlines.h
index a816b4048..e557525ab 100644
--- a/libc/include/android/legacy_termios_inlines.h
+++ b/libc/include/android/legacy_termios_inlines.h
@@ -39,14 +39,14 @@
#include <sys/ioctl.h>
#include <sys/types.h>
-#define __BIONIC_TERMIOS_INLINE static __inline
+#define __BIONIC_TERMIOS_INLINE static inline
#include <bits/termios_inlines.h>
#endif
#if __ANDROID_API__ < 35
-#define __BIONIC_TERMIOS_WINSIZE_INLINE static __inline
+#define __BIONIC_TERMIOS_WINSIZE_INLINE static inline
#include <bits/termios_winsize_inlines.h>
#endif
diff --git a/libc/include/android/legacy_threads_inlines.h b/libc/include/android/legacy_threads_inlines.h
index c614cd01a..06e743813 100644
--- a/libc/include/android/legacy_threads_inlines.h
+++ b/libc/include/android/legacy_threads_inlines.h
@@ -32,7 +32,7 @@
#if __ANDROID_API__ < 30
-#define __BIONIC_THREADS_INLINE static __inline
+#define __BIONIC_THREADS_INLINE static inline
#include <bits/threads_inlines.h>
#endif
diff --git a/libc/include/android/legacy_unistd_inlines.h b/libc/include/android/legacy_unistd_inlines.h
index 4a5206b88..ac9f3b354 100644
--- a/libc/include/android/legacy_unistd_inlines.h
+++ b/libc/include/android/legacy_unistd_inlines.h
@@ -32,7 +32,7 @@
#if __ANDROID_API__ < 28
-#define __BIONIC_SWAB_INLINE static __inline
+#define __BIONIC_SWAB_INLINE static inline
#include <bits/swab.h>
#endif
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index c5adc02cf..cd61f3393 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -20,15 +20,15 @@
// we should only annotate headers when we are running versioner.
#if defined(__BIONIC_VERSIONER)
-#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
-#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __attribute__((annotate("introduced_in=" #api_level))) __VERSIONER_NO_GUARD
-#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
-#define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
-#define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
-#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
+#define __INTRODUCED_IN(api_level) __attribute__((__annotate__("introduced_in=" #api_level)))
+#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __attribute__((__annotate__("introduced_in=" #api_level))) __VERSIONER_NO_GUARD
+#define __DEPRECATED_IN(api_level) __attribute__((__annotate__("deprecated_in=" #api_level)))
+#define __REMOVED_IN(api_level) __attribute__((__annotate__("obsoleted_in=" #api_level)))
+#define __INTRODUCED_IN_32(api_level) __attribute__((__annotate__("introduced_in_32=" #api_level)))
+#define __INTRODUCED_IN_64(api_level) __attribute__((__annotate__("introduced_in_64=" #api_level)))
-#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
-#define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
+#define __VERSIONER_NO_GUARD __attribute__((__annotate__("versioner_no_guard")))
+#define __VERSIONER_FORTIFY_INLINE __attribute__((__annotate__("versioner_fortify_inline")))
#else
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index 83fb25716..eceb33416 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -552,6 +552,9 @@
#if defined(__NR_listen)
#define SYS_listen __NR_listen
#endif
+#if defined(__NR_listmount)
+ #define SYS_listmount __NR_listmount
+#endif
#if defined(__NR_listxattr)
#define SYS_listxattr __NR_listxattr
#endif
@@ -576,6 +579,15 @@
#if defined(__NR_lsetxattr)
#define SYS_lsetxattr __NR_lsetxattr
#endif
+#if defined(__NR_lsm_get_self_attr)
+ #define SYS_lsm_get_self_attr __NR_lsm_get_self_attr
+#endif
+#if defined(__NR_lsm_list_modules)
+ #define SYS_lsm_list_modules __NR_lsm_list_modules
+#endif
+#if defined(__NR_lsm_set_self_attr)
+ #define SYS_lsm_set_self_attr __NR_lsm_set_self_attr
+#endif
#if defined(__NR_lstat)
#define SYS_lstat __NR_lstat
#endif
@@ -1218,6 +1230,9 @@
#if defined(__NR_statfs64)
#define SYS_statfs64 __NR_statfs64
#endif
+#if defined(__NR_statmount)
+ #define SYS_statmount __NR_statmount
+#endif
#if defined(__NR_statx)
#define SYS_statx __NR_statx
#endif
diff --git a/libc/include/bits/page_size.h b/libc/include/bits/page_size.h
index df0cb7fcc..594ffe5e8 100644
--- a/libc/include/bits/page_size.h
+++ b/libc/include/bits/page_size.h
@@ -32,7 +32,16 @@
__BEGIN_DECLS
-#if !defined(__BIONIC_NO_PAGE_SIZE_MACRO) || defined(__BIONIC_DEPRECATED_PAGE_SIZE_MACRO)
+// PAGE_SIZE is going away in Android. Prefer getpagesize() instead.
+//
+// For more info, see https://developer.android.com/16kb-page-size.
+//
+// To restore the original behavior, use __BIONIC_DEPRECATED_PAGE_SIZE_MACRO.
+
+#if (defined(__NDK_MAJOR__) && __NDK_MAJOR__ <= 27 && !defined(__BIONIC_NO_PAGE_SIZE_MACRO)) \
+ || defined(__BIONIC_DEPRECATED_PAGE_SIZE_MACRO) \
+ || defined(__arm__) \
+ || defined(__i386__)
#define PAGE_SIZE 4096
#define PAGE_MASK (~(PAGE_SIZE - 1))
#endif
diff --git a/libc/include/bits/stdatomic.h b/libc/include/bits/stdatomic.h
index fe3d68d09..8df86e2ad 100644
--- a/libc/include/bits/stdatomic.h
+++ b/libc/include/bits/stdatomic.h
@@ -138,11 +138,11 @@ typedef enum {
* 7.17.4 Fences.
*/
-static __inline void atomic_thread_fence(memory_order __order __attribute__((unused))) {
+static inline void atomic_thread_fence(memory_order __order __attribute__((__unused__))) {
__c11_atomic_thread_fence(__order);
}
-static __inline void atomic_signal_fence(memory_order __order __attribute__((unused))) {
+static inline void atomic_signal_fence(memory_order __order __attribute__((__unused__))) {
__c11_atomic_signal_fence(__order);
}
@@ -269,18 +269,18 @@ typedef struct {
#define ATOMIC_FLAG_INIT { ATOMIC_VAR_INIT(false) }
-static __inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) {
+static inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) {
return (atomic_exchange_explicit(&__object->__flag, 1, __order));
}
-static __inline void atomic_flag_clear_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) {
+static inline void atomic_flag_clear_explicit(volatile atomic_flag * _Nonnull __object, memory_order __order) {
atomic_store_explicit(&__object->__flag, 0, __order);
}
-static __inline bool atomic_flag_test_and_set(volatile atomic_flag * _Nonnull __object) {
+static inline bool atomic_flag_test_and_set(volatile atomic_flag * _Nonnull __object) {
return (atomic_flag_test_and_set_explicit(__object, memory_order_seq_cst));
}
-static __inline void atomic_flag_clear(volatile atomic_flag * _Nonnull __object) {
+static inline void atomic_flag_clear(volatile atomic_flag * _Nonnull __object) {
atomic_flag_clear_explicit(__object, memory_order_seq_cst);
}
diff --git a/libc/include/bits/struct_file.h b/libc/include/bits/struct_file.h
index abbd32028..8cb8d282b 100644
--- a/libc/include/bits/struct_file.h
+++ b/libc/include/bits/struct_file.h
@@ -39,6 +39,6 @@ struct __sFILE {
#else
char __private[84];
#endif
-} __attribute__((aligned(sizeof(void*))));
+} __attribute__((__aligned__(sizeof(void*))));
__END_DECLS
diff --git a/libc/include/bits/swab.h b/libc/include/bits/swab.h
index 9591c2ede..ebb7c7406 100644
--- a/libc/include/bits/swab.h
+++ b/libc/include/bits/swab.h
@@ -33,7 +33,7 @@
#include <sys/types.h>
#if !defined(__BIONIC_SWAB_INLINE)
-#define __BIONIC_SWAB_INLINE static __inline
+#define __BIONIC_SWAB_INLINE static inline
#endif
__BEGIN_DECLS
diff --git a/libc/include/bits/termios_inlines.h b/libc/include/bits/termios_inlines.h
index a884b595f..702f43346 100644
--- a/libc/include/bits/termios_inlines.h
+++ b/libc/include/bits/termios_inlines.h
@@ -37,7 +37,7 @@
#include <linux/termios.h>
#if !defined(__BIONIC_TERMIOS_INLINE)
-#define __BIONIC_TERMIOS_INLINE static __inline
+#define __BIONIC_TERMIOS_INLINE static inline
#endif
__BEGIN_DECLS
@@ -45,7 +45,7 @@ __BEGIN_DECLS
// Supporting separate input and output speeds would require an ABI
// change for `struct termios`.
-static __inline speed_t cfgetspeed(const struct termios* _Nonnull s) {
+static inline speed_t cfgetspeed(const struct termios* _Nonnull s) {
return __BIONIC_CAST(static_cast, speed_t, s->c_cflag & CBAUD);
}
diff --git a/libc/include/bits/termios_winsize_inlines.h b/libc/include/bits/termios_winsize_inlines.h
index ae246e401..0d188e75e 100644
--- a/libc/include/bits/termios_winsize_inlines.h
+++ b/libc/include/bits/termios_winsize_inlines.h
@@ -36,7 +36,7 @@
#include <linux/termios.h>
#if !defined(__BIONIC_TERMIOS_WINSIZE_INLINE)
-#define __BIONIC_TERMIOS_WINSIZE_INLINE static __inline
+#define __BIONIC_TERMIOS_WINSIZE_INLINE static inline
#endif
__BEGIN_DECLS
diff --git a/libc/include/bits/threads_inlines.h b/libc/include/bits/threads_inlines.h
index 5878e0acc..074e1ca98 100644
--- a/libc/include/bits/threads_inlines.h
+++ b/libc/include/bits/threads_inlines.h
@@ -38,7 +38,7 @@
__BEGIN_DECLS
-static __inline int __bionic_thrd_error(int __pthread_code) {
+static inline int __bionic_thrd_error(int __pthread_code) {
switch (__pthread_code) {
case 0: return 0;
case ENOMEM: return thrd_nomem;
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index c15ee5618..5cad412d6 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -42,7 +42,7 @@
* also provide actual symbols for any caller that needs them.
*/
#if !defined(__BIONIC_CTYPE_INLINE)
-#define __BIONIC_CTYPE_INLINE static __inline
+#define __BIONIC_CTYPE_INLINE static inline
#endif
/** Internal implementation detail. Do not use. */
diff --git a/libc/include/limits.h b/libc/include/limits.h
index 48e7ea9f7..e1f566c83 100644
--- a/libc/include/limits.h
+++ b/libc/include/limits.h
@@ -136,6 +136,9 @@
#define IOV_MAX 1024
#define SEM_VALUE_MAX 0x3fffffff
+/** Do not use: prefer getline() or asprintf() rather than hard-coding an arbitrary size. */
+#define LINE_MAX _POSIX2_LINE_MAX
+
/* POSIX says these belong in <unistd.h> but BSD has some in <limits.h>. */
#include <bits/posix_limits.h>
@@ -145,9 +148,15 @@
/* >= _POSIX_THREAD_DESTRUCTOR_ITERATIONS */
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
-/* >= _POSIX_THREAD_KEYS_MAX */
+
+/**
+ * The number of calls to pthread_key_create() without intervening calls to
+ * pthread_key_delete() that are guaranteed to succeed. See pthread_key_create()
+ * for more details and ways to avoid hitting this limit.
+ */
#define PTHREAD_KEYS_MAX 128
-/* bionic has no specific limit */
+
+/** bionic has no specific limit on the number of threads. */
#undef PTHREAD_THREADS_MAX
#endif /* !_LIMITS_H_ */
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index d22b85ce5..ef1e27d5f 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -186,7 +186,11 @@ struct mallinfo2 mallinfo2(void) __RENAME(mallinfo);
int malloc_info(int __must_be_zero, FILE* _Nonnull __fp) __INTRODUCED_IN(23);
/**
- * mallopt() option to set the decay time. Valid values are 0 and 1.
+ * mallopt() option to set the decay time. Valid values are -1, 0 and 1.
+ * -1 : Disable the releasing of unused pages. This value is available since
+ * API level 35.
+ * 0 : Release the unused pages immediately.
+ * 1 : Release the unused pages at a device-specific interval.
*
* Available since API level 27.
*/
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 871c62ce8..ef41e2d71 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -174,7 +174,29 @@ pid_t pthread_gettid_np(pthread_t __pthread);
int pthread_join(pthread_t __pthread, void* _Nullable * _Nullable __return_value_ptr);
+/**
+ * [pthread_key_create(3)](https://man7.org/linux/man-pages/man3/pthread_key_create.3p.html)
+ * creates a key for thread-specific data.
+ *
+ * There is a limit of `PTHREAD_KEYS_MAX` keys per process, but most callers
+ * should just use the C or C++ `thread_local` storage specifier anyway. When
+ * targeting new enough OS versions, the compiler will automatically use
+ * ELF TLS; when targeting old OS versions the emutls implementation will
+ * multiplex pthread keys behind the scenes, using one per library rather than
+ * one per thread-local variable. If you are implementing the runtime for a
+ * different language, you should consider similar implementation choices and
+ * avoid a direct one-to-one mapping from thread locals to pthread keys.
+ *
+ * Returns 0 on success and returns an error number on failure.
+ */
int pthread_key_create(pthread_key_t* _Nonnull __key_ptr, void (* _Nullable __key_destructor)(void* _Nullable));
+
+/**
+ * [pthread_key_delete(3)](https://man7.org/linux/man-pages/man3/pthread_key_delete.3p.html)
+ * deletes a key for thread-specific data.
+ *
+ * Returns 0 on success and returns an error number on failure.
+ */
int pthread_key_delete(pthread_key_t __key);
int pthread_mutexattr_destroy(pthread_mutexattr_t* _Nonnull __attr);
diff --git a/libc/include/sched.h b/libc/include/sched.h
index b1f18421b..9f043b600 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -99,7 +99,7 @@ struct sched_param {
};
/**
- * [sched_setscheduler(2)](http://man7.org/linux/man-pages/man2/sched_getcpu.2.html)
+ * [sched_setscheduler(2)](https://man7.org/linux/man-pages/man2/sched_setscheduler.2.html)
* sets the scheduling policy and associated parameters for the given thread.
*
* Returns 0 on success and returns -1 and sets `errno` on failure.
@@ -107,7 +107,7 @@ struct sched_param {
int sched_setscheduler(pid_t __pid, int __policy, const struct sched_param* _Nonnull __param);
/**
- * [sched_getscheduler(2)](http://man7.org/linux/man-pages/man2/sched_getcpu.2.html)
+ * [sched_getscheduler(2)](https://man7.org/linux/man-pages/man2/sched_getscheduler.2)
* gets the scheduling policy for the given thread.
*
* Returns a non-negative thread policy on success and returns -1 and sets
diff --git a/libc/include/signal.h b/libc/include/signal.h
index cf83db8e9..9d47bcc79 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -86,17 +86,17 @@ int sigwait(const sigset_t* _Nonnull __set, int* _Nonnull __signal);
int sigwait64(const sigset64_t* _Nonnull __set, int* _Nonnull __signal) __INTRODUCED_IN(28);
int sighold(int __signal)
- __attribute__((deprecated("use sigprocmask() or pthread_sigmask() instead")))
+ __attribute__((__deprecated__("use sigprocmask() or pthread_sigmask() instead")))
__INTRODUCED_IN(26);
int sigignore(int __signal)
- __attribute__((deprecated("use sigaction() instead"))) __INTRODUCED_IN(26);
+ __attribute__((__deprecated__("use sigaction() instead"))) __INTRODUCED_IN(26);
int sigpause(int __signal)
- __attribute__((deprecated("use sigsuspend() instead"))) __INTRODUCED_IN(26);
+ __attribute__((__deprecated__("use sigsuspend() instead"))) __INTRODUCED_IN(26);
int sigrelse(int __signal)
- __attribute__((deprecated("use sigprocmask() or pthread_sigmask() instead")))
+ __attribute__((__deprecated__("use sigprocmask() or pthread_sigmask() instead")))
__INTRODUCED_IN(26);
sighandler_t _Nonnull sigset(int __signal, sighandler_t _Nullable __handler)
- __attribute__((deprecated("use sigaction() instead"))) __INTRODUCED_IN(26);
+ __attribute__((__deprecated__("use sigaction() instead"))) __INTRODUCED_IN(26);
int raise(int __signal);
int kill(pid_t __pid, int __signal);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 312b356ae..32264d6d9 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -141,7 +141,7 @@ int vdprintf(int __fd, const char* _Nonnull __fmt, va_list __args) __printflike(
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \
(defined(__cplusplus) && __cplusplus <= 201103L)
-char* _Nullable gets(char* _Nonnull __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
+char* _Nullable gets(char* _Nonnull __buf) __attribute__((__deprecated__("gets is unsafe, use fgets instead")));
#endif
int sprintf(char* __BIONIC_COMPLICATED_NULLNESS __s, const char* _Nonnull __fmt, ...)
__printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf");
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 2830a493d..506ab43ba 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -57,7 +57,7 @@ int unsetenv(const char* _Nonnull __name);
int clearenv(void);
char* _Nullable mkdtemp(char* _Nonnull __template);
-char* _Nullable mktemp(char* _Nonnull __template) __attribute__((deprecated("mktemp is unsafe, use mkstemp or tmpfile instead")));
+char* _Nullable mktemp(char* _Nonnull __template) __attribute__((__deprecated__("mktemp is unsafe, use mkstemp or tmpfile instead")));
int mkostemp64(char* _Nonnull __template, int __flags) __INTRODUCED_IN(23);
int mkostemp(char* _Nonnull __template, int __flags) __INTRODUCED_IN(23);
diff --git a/libc/include/strings.h b/libc/include/strings.h
index 2f4f7641a..6ec3bdf58 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -50,7 +50,7 @@
#include <bits/strcasecmp.h>
#if !defined(__BIONIC_STRINGS_INLINE)
-#define __BIONIC_STRINGS_INLINE static __inline
+#define __BIONIC_STRINGS_INLINE static inline
#endif
#undef ffs
@@ -61,13 +61,13 @@ __BEGIN_DECLS
/** Deprecated. Use memmove() instead. */
#define bcopy(b1, b2, len) __bionic_bcopy((b1), (b2), (len))
-static __inline__ __always_inline void __bionic_bcopy(const void* _Nonnull b1, void* _Nonnull b2, size_t len) {
+static inline __always_inline void __bionic_bcopy(const void* _Nonnull b1, void* _Nonnull b2, size_t len) {
__builtin_memmove(b2, b1, len);
}
/** Deprecated. Use memset() instead. */
#define bzero(b, len) __bionic_bzero((b), (len))
-static __inline__ __always_inline void __bionic_bzero(void* _Nonnull b, size_t len) {
+static inline __always_inline void __bionic_bzero(void* _Nonnull b, size_t len) {
__builtin_memset(b, 0, len);
}
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index a8fb6240a..3218d1554 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -139,12 +139,12 @@
#define __wur __attribute__((__warn_unused_result__))
-#define __errorattr(msg) __attribute__((unavailable(msg)))
-#define __warnattr(msg) __attribute__((deprecated(msg)))
-#define __warnattr_real(msg) __attribute__((deprecated(msg)))
-#define __enable_if(cond, msg) __attribute__((enable_if(cond, msg)))
-#define __clang_error_if(cond, msg) __attribute__((diagnose_if(cond, msg, "error")))
-#define __clang_warning_if(cond, msg) __attribute__((diagnose_if(cond, msg, "warning")))
+#define __errorattr(msg) __attribute__((__unavailable__(msg)))
+#define __warnattr(msg) __attribute__((__deprecated__(msg)))
+#define __warnattr_real(msg) __attribute__((__deprecated__(msg)))
+#define __enable_if(cond, msg) __attribute__((__enable_if__(cond, msg)))
+#define __clang_error_if(cond, msg) __attribute__((__diagnose_if__(cond, msg, "error")))
+#define __clang_warning_if(cond, msg) __attribute__((__diagnose_if__(cond, msg, "warning")))
#if defined(ANDROID_STRICT)
/*
@@ -248,7 +248,7 @@
#if defined(__BIONIC_FORTIFY)
# define __bos0(s) __bosn((s), 0)
-# define __pass_object_size_n(n) __attribute__((pass_object_size(n)))
+# define __pass_object_size_n(n) __attribute__((__pass_object_size__(n)))
/*
* FORTIFY'ed functions all have either enable_if or pass_object_size, which
* makes taking their address impossible. Saying (&read)(foo, bar, baz); will
@@ -260,7 +260,7 @@
* them available externally. FORTIFY'ed functions try to be as close to possible as 'invisible';
* having stack protectors detracts from that (b/182948263).
*/
-# define __BIONIC_FORTIFY_INLINE static __inline__ __attribute__((no_stack_protector)) \
+# define __BIONIC_FORTIFY_INLINE static inline __attribute__((__no_stack_protector__)) \
__always_inline __VERSIONER_FORTIFY_INLINE
/*
* We should use __BIONIC_FORTIFY_VARIADIC instead of __BIONIC_FORTIFY_INLINE
@@ -268,9 +268,9 @@
* The __always_inline attribute is useless, misleading, and could trigger
* clang compiler bug to incorrectly inline variadic functions.
*/
-# define __BIONIC_FORTIFY_VARIADIC static __inline__
+# define __BIONIC_FORTIFY_VARIADIC static inline
/* Error functions don't have bodies, so they can just be static. */
-# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __attribute__((unused))
+# define __BIONIC_ERROR_FUNCTION_VISIBILITY static __attribute__((__unused__))
#else
/* Further increase sharing for some inline functions */
# define __pass_object_size_n(n)
@@ -300,47 +300,32 @@
# define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
#endif
-#define __overloadable __attribute__((overloadable))
+#define __overloadable __attribute__((__overloadable__))
-#define __diagnose_as_builtin(...) __attribute__((diagnose_as_builtin(__VA_ARGS__)))
+#define __diagnose_as_builtin(...) __attribute__((__diagnose_as_builtin__(__VA_ARGS__)))
/* Used to tag non-static symbols that are private and never exposed by the shared library. */
-#define __LIBC_HIDDEN__ __attribute__((visibility("hidden")))
+#define __LIBC_HIDDEN__ __attribute__((__visibility__("hidden")))
/*
* Used to tag symbols that should be hidden for 64-bit,
* but visible to preserve binary compatibility for LP32.
*/
#ifdef __LP64__
-#define __LIBC32_LEGACY_PUBLIC__ __attribute__((visibility("hidden")))
+#define __LIBC32_LEGACY_PUBLIC__ __attribute__((__visibility__("hidden")))
#else
-#define __LIBC32_LEGACY_PUBLIC__ __attribute__((visibility("default")))
+#define __LIBC32_LEGACY_PUBLIC__ __attribute__((__visibility__("default")))
#endif
/* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
#define __RENAME(x) __asm__(#x)
-#if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
-#if defined(__LP64__)
-#define __size_mul_overflow(a, b, result) __builtin_umull_overflow(a, b, result)
-#else
-#define __size_mul_overflow(a, b, result) __builtin_umul_overflow(a, b, result)
-#endif
-#else
-extern __inline__ __always_inline __attribute__((gnu_inline))
-int __size_mul_overflow(__SIZE_TYPE__ a, __SIZE_TYPE__ b, __SIZE_TYPE__ *result) {
- *result = a * b;
- static const __SIZE_TYPE__ mul_no_overflow = 1UL << (sizeof(__SIZE_TYPE__) * 4);
- return (a >= mul_no_overflow || b >= mul_no_overflow) && a > 0 && (__SIZE_TYPE__)-1 / a < b;
-}
-#endif
-
/*
* Used when we need to check for overflow when multiplying x and y. This
- * should only be used where __size_mul_overflow can not work, because it makes
- * assumptions that __size_mul_overflow doesn't (x and y are positive, ...),
+ * should only be used where __builtin_umull_overflow can not work, because it makes
+ * assumptions that __builtin_umull_overflow doesn't (x and y are positive, ...),
* *and* doesn't make use of compiler intrinsics, so it's probably slower than
- * __size_mul_overflow.
+ * __builtin_umull_overflow.
*/
#define __unsafe_check_mul_overflow(x, y) ((__SIZE_TYPE__)-1 / (x) < (y))
diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h
index 79ae06737..1c991aefc 100644
--- a/libc/include/sys/param.h
+++ b/libc/include/sys/param.h
@@ -41,8 +41,11 @@
/** The unit of `st_blocks` in `struct stat`. */
#define DEV_BSIZE 512
-/** A historical name for PATH_MAX. */
-#define MAXPATHLEN PATH_MAX
+/** A historical name for PATH_MAX. Use PATH_MAX in new code. */
+#define MAXPATHLEN PATH_MAX
+
+/** A historical name for NGROUPS_MAX. Use NGROUPS_MAX in new code. */
+#define NGROUPS NGROUPS_MAX
#define MAXSYMLINKS 8
diff --git a/libc/include/sys/shm.h b/libc/include/sys/shm.h
index fb6f20cf4..8ab3d9ab9 100644
--- a/libc/include/sys/shm.h
+++ b/libc/include/sys/shm.h
@@ -36,11 +36,12 @@
#include <sys/cdefs.h>
#include <sys/ipc.h>
#include <sys/types.h>
+#include <unistd.h>
#include <linux/shm.h>
#define shmid_ds shmid64_ds
-#define SHMLBA 4096
+#define SHMLBA getpagesize()
__BEGIN_DECLS
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index c69db615c..273221432 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -350,8 +350,11 @@ long syscall(long __number, ...);
int daemon(int __no_chdir, int __no_close);
#if defined(__arm__)
+/**
+ * New code should use __builtin___clear_cache() instead, which works on
+ * all architectures.
+ */
int cacheflush(long __addr, long __nbytes, long __cache);
- /* __attribute__((deprecated("use __builtin___clear_cache instead"))); */
#endif
pid_t tcgetpgrp(int __fd);
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 08b786ac5..0fd6e46f9 100755
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -2345,11 +2345,11 @@ struct something_s {
def test_function_keep_attribute_structs(self):
text = """\
-static __inline__ struct some_struct1 * function(struct some_struct2 * e) {
+static inline struct some_struct1 * function(struct some_struct2 * e) {
}
"""
expected = """\
-static __inline__ struct some_struct1 * function(struct some_struct2 * e) {
+static inline struct some_struct1 * function(struct some_struct2 * e) {
}
"""
self.assertEqual(self.parse(text, set(["function"])), expected)
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 1d7b4276a..06afb25d6 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -32,8 +32,10 @@ kernel_known_macros = {
# addition to removing the structure, add a #include to the file.
kernel_structs_to_remove = {
# Remove these structures since they are still the same as
- # timeval, itimerval.
- "__kernel_old_timeval": None,
+ # timeval, itimerval. Also, add an include of linux/time.h
+ # since __kernel_old_timeval is being changed to timeval, and
+ # is only present in linux/time.h.
+ "__kernel_old_timeval": "linux/time.h",
"__kernel_old_itimerval": None,
# Replace all of the below structures with #include <bits/STRUCT.h>
"__kernel_sockaddr_storage": "bits/sockaddr_storage.h",
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h b/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
index 482b9cb8e..103213165 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-eabi.h
@@ -415,4 +415,9 @@
#define __NR_futex_wake (__NR_SYSCALL_BASE + 454)
#define __NR_futex_wait (__NR_SYSCALL_BASE + 455)
#define __NR_futex_requeue (__NR_SYSCALL_BASE + 456)
+#define __NR_statmount (__NR_SYSCALL_BASE + 457)
+#define __NR_listmount (__NR_SYSCALL_BASE + 458)
+#define __NR_lsm_get_self_attr (__NR_SYSCALL_BASE + 459)
+#define __NR_lsm_set_self_attr (__NR_SYSCALL_BASE + 460)
+#define __NR_lsm_list_modules (__NR_SYSCALL_BASE + 461)
#endif
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h b/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
index 5126831c3..1f576046d 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-oabi.h
@@ -427,4 +427,9 @@
#define __NR_futex_wake (__NR_SYSCALL_BASE + 454)
#define __NR_futex_wait (__NR_SYSCALL_BASE + 455)
#define __NR_futex_requeue (__NR_SYSCALL_BASE + 456)
+#define __NR_statmount (__NR_SYSCALL_BASE + 457)
+#define __NR_listmount (__NR_SYSCALL_BASE + 458)
+#define __NR_lsm_get_self_attr (__NR_SYSCALL_BASE + 459)
+#define __NR_lsm_set_self_attr (__NR_SYSCALL_BASE + 460)
+#define __NR_lsm_list_modules (__NR_SYSCALL_BASE + 461)
#endif
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 717a098af..c88275184 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -407,8 +407,13 @@
#define __NR_futex_wake 454
#define __NR_futex_wait 455
#define __NR_futex_requeue 456
+#define __NR_statmount 457
+#define __NR_listmount 458
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_set_self_attr 460
+#define __NR_lsm_list_modules 461
#undef __NR_syscalls
-#define __NR_syscalls 457
+#define __NR_syscalls 462
#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-riscv/asm/hwprobe.h b/libc/kernel/uapi/asm-riscv/asm/hwprobe.h
index a18b020d7..6f8d8f585 100644
--- a/libc/kernel/uapi/asm-riscv/asm/hwprobe.h
+++ b/libc/kernel/uapi/asm-riscv/asm/hwprobe.h
@@ -24,6 +24,35 @@ struct riscv_hwprobe {
#define RISCV_HWPROBE_EXT_ZBB (1 << 4)
#define RISCV_HWPROBE_EXT_ZBS (1 << 5)
#define RISCV_HWPROBE_EXT_ZICBOZ (1 << 6)
+#define RISCV_HWPROBE_EXT_ZBC (1 << 7)
+#define RISCV_HWPROBE_EXT_ZBKB (1 << 8)
+#define RISCV_HWPROBE_EXT_ZBKC (1 << 9)
+#define RISCV_HWPROBE_EXT_ZBKX (1 << 10)
+#define RISCV_HWPROBE_EXT_ZKND (1 << 11)
+#define RISCV_HWPROBE_EXT_ZKNE (1 << 12)
+#define RISCV_HWPROBE_EXT_ZKNH (1 << 13)
+#define RISCV_HWPROBE_EXT_ZKSED (1 << 14)
+#define RISCV_HWPROBE_EXT_ZKSH (1 << 15)
+#define RISCV_HWPROBE_EXT_ZKT (1 << 16)
+#define RISCV_HWPROBE_EXT_ZVBB (1 << 17)
+#define RISCV_HWPROBE_EXT_ZVBC (1 << 18)
+#define RISCV_HWPROBE_EXT_ZVKB (1 << 19)
+#define RISCV_HWPROBE_EXT_ZVKG (1 << 20)
+#define RISCV_HWPROBE_EXT_ZVKNED (1 << 21)
+#define RISCV_HWPROBE_EXT_ZVKNHA (1 << 22)
+#define RISCV_HWPROBE_EXT_ZVKNHB (1 << 23)
+#define RISCV_HWPROBE_EXT_ZVKSED (1 << 24)
+#define RISCV_HWPROBE_EXT_ZVKSH (1 << 25)
+#define RISCV_HWPROBE_EXT_ZVKT (1 << 26)
+#define RISCV_HWPROBE_EXT_ZFH (1 << 27)
+#define RISCV_HWPROBE_EXT_ZFHMIN (1 << 28)
+#define RISCV_HWPROBE_EXT_ZIHINTNTL (1 << 29)
+#define RISCV_HWPROBE_EXT_ZVFH (1 << 30)
+#define RISCV_HWPROBE_EXT_ZVFHMIN (1 << 31)
+#define RISCV_HWPROBE_EXT_ZFA (1ULL << 32)
+#define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33)
+#define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34)
+#define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35)
#define RISCV_HWPROBE_KEY_CPUPERF_0 5
#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0)
#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0)
@@ -32,4 +61,5 @@ struct riscv_hwprobe {
#define RISCV_HWPROBE_MISALIGNED_UNSUPPORTED (4 << 0)
#define RISCV_HWPROBE_MISALIGNED_MASK (7 << 0)
#define RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE 6
+#define RISCV_HWPROBE_WHICH_CPUS (1 << 0)
#endif
diff --git a/libc/kernel/uapi/asm-riscv/asm/kvm.h b/libc/kernel/uapi/asm-riscv/asm/kvm.h
index 470d58143..054e1a121 100644
--- a/libc/kernel/uapi/asm-riscv/asm/kvm.h
+++ b/libc/kernel/uapi/asm-riscv/asm/kvm.h
@@ -99,6 +99,33 @@ enum KVM_RISCV_ISA_EXT_ID {
KVM_RISCV_ISA_EXT_ZIHPM,
KVM_RISCV_ISA_EXT_SMSTATEEN,
KVM_RISCV_ISA_EXT_ZICOND,
+ KVM_RISCV_ISA_EXT_ZBC,
+ KVM_RISCV_ISA_EXT_ZBKB,
+ KVM_RISCV_ISA_EXT_ZBKC,
+ KVM_RISCV_ISA_EXT_ZBKX,
+ KVM_RISCV_ISA_EXT_ZKND,
+ KVM_RISCV_ISA_EXT_ZKNE,
+ KVM_RISCV_ISA_EXT_ZKNH,
+ KVM_RISCV_ISA_EXT_ZKR,
+ KVM_RISCV_ISA_EXT_ZKSED,
+ KVM_RISCV_ISA_EXT_ZKSH,
+ KVM_RISCV_ISA_EXT_ZKT,
+ KVM_RISCV_ISA_EXT_ZVBB,
+ KVM_RISCV_ISA_EXT_ZVBC,
+ KVM_RISCV_ISA_EXT_ZVKB,
+ KVM_RISCV_ISA_EXT_ZVKG,
+ KVM_RISCV_ISA_EXT_ZVKNED,
+ KVM_RISCV_ISA_EXT_ZVKNHA,
+ KVM_RISCV_ISA_EXT_ZVKNHB,
+ KVM_RISCV_ISA_EXT_ZVKSED,
+ KVM_RISCV_ISA_EXT_ZVKSH,
+ KVM_RISCV_ISA_EXT_ZVKT,
+ KVM_RISCV_ISA_EXT_ZFH,
+ KVM_RISCV_ISA_EXT_ZFHMIN,
+ KVM_RISCV_ISA_EXT_ZIHINTNTL,
+ KVM_RISCV_ISA_EXT_ZVFH,
+ KVM_RISCV_ISA_EXT_ZVFHMIN,
+ KVM_RISCV_ISA_EXT_ZFA,
KVM_RISCV_ISA_EXT_MAX,
};
enum KVM_RISCV_SBI_EXT_ID {
@@ -112,8 +139,13 @@ enum KVM_RISCV_SBI_EXT_ID {
KVM_RISCV_SBI_EXT_EXPERIMENTAL,
KVM_RISCV_SBI_EXT_VENDOR,
KVM_RISCV_SBI_EXT_DBCN,
+ KVM_RISCV_SBI_EXT_STA,
KVM_RISCV_SBI_EXT_MAX,
};
+struct kvm_riscv_sbi_sta {
+ unsigned long shmem_lo;
+ unsigned long shmem_hi;
+};
#define KVM_RISCV_TIMER_STATE_OFF 0
#define KVM_RISCV_TIMER_STATE_ON 1
#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
@@ -155,6 +187,9 @@ enum KVM_RISCV_SBI_EXT_ID {
#define KVM_REG_RISCV_VECTOR (0x09 << KVM_REG_RISCV_TYPE_SHIFT)
#define KVM_REG_RISCV_VECTOR_CSR_REG(name) (offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
#define KVM_REG_RISCV_VECTOR_REG(n) ((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
+#define KVM_REG_RISCV_SBI_STATE (0x0a << KVM_REG_RISCV_TYPE_SHIFT)
+#define KVM_REG_RISCV_SBI_STA (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
+#define KVM_REG_RISCV_SBI_STA_REG(name) (offsetof(struct kvm_riscv_sbi_sta, name) / sizeof(unsigned long))
#define KVM_DEV_RISCV_APLIC_ALIGN 0x1000
#define KVM_DEV_RISCV_APLIC_SIZE 0x4000
#define KVM_DEV_RISCV_APLIC_MAX_HARTS 0x4000
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index 334fb25b2..1dd057a5b 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -409,4 +409,6 @@ struct kvm_pmu_event_filter {
#define KVM_VCPU_TSC_CTRL 0
#define KVM_VCPU_TSC_OFFSET 0
#define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0)
+#define KVM_X86_DEFAULT_VM 0
+#define KVM_X86_SW_PROTECTED_VM 1
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/signal.h b/libc/kernel/uapi/asm-x86/asm/signal.h
index 96ac8fbed..6cffef3c4 100644
--- a/libc/kernel/uapi/asm-x86/asm/signal.h
+++ b/libc/kernel/uapi/asm-x86/asm/signal.h
@@ -8,7 +8,6 @@
#define _UAPI_ASM_X86_SIGNAL_H
#ifndef __ASSEMBLY__
#include <linux/types.h>
-#include <linux/time.h>
#include <linux/compiler.h>
struct siginfo;
#define _KERNEL_NSIG 32
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index e82b988bd..72076fdb3 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -452,4 +452,9 @@
#define __NR_futex_wake 454
#define __NR_futex_wait 455
#define __NR_futex_requeue 456
+#define __NR_statmount 457
+#define __NR_listmount 458
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_set_self_attr 460
+#define __NR_lsm_list_modules 461
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index 10d6e96f0..8c4f76e03 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -374,4 +374,9 @@
#define __NR_futex_wake 454
#define __NR_futex_wait 455
#define __NR_futex_requeue 456
+#define __NR_statmount 457
+#define __NR_listmount 458
+#define __NR_lsm_get_self_attr 459
+#define __NR_lsm_set_self_attr 460
+#define __NR_lsm_list_modules 461
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index 7fbbe119d..984cfcadf 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -326,6 +326,11 @@
#define __NR_futex_wake (__X32_SYSCALL_BIT + 454)
#define __NR_futex_wait (__X32_SYSCALL_BIT + 455)
#define __NR_futex_requeue (__X32_SYSCALL_BIT + 456)
+#define __NR_statmount (__X32_SYSCALL_BIT + 457)
+#define __NR_listmount (__X32_SYSCALL_BIT + 458)
+#define __NR_lsm_get_self_attr (__X32_SYSCALL_BIT + 459)
+#define __NR_lsm_set_self_attr (__X32_SYSCALL_BIT + 460)
+#define __NR_lsm_list_modules (__X32_SYSCALL_BIT + 461)
#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.h b/libc/kernel/uapi/drm/drm.h
index 0fe5c2684..c8fab3c5d 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -353,6 +353,7 @@ struct drm_gem_open {
#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12
#define DRM_CAP_SYNCOBJ 0x13
#define DRM_CAP_SYNCOBJ_TIMELINE 0x14
+#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15
struct drm_get_cap {
__u64 capability;
__u64 value;
@@ -362,6 +363,7 @@ struct drm_get_cap {
#define DRM_CLIENT_CAP_ATOMIC 3
#define DRM_CLIENT_CAP_ASPECT_RATIO 4
#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5
+#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6
struct drm_set_client_cap {
__u64 capability;
__u64 value;
@@ -401,6 +403,7 @@ struct drm_syncobj_transfer {
#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)
+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3)
struct drm_syncobj_wait {
__u64 handles;
__s64 timeout_nsec;
@@ -408,6 +411,7 @@ struct drm_syncobj_wait {
__u32 flags;
__u32 first_signaled;
__u32 pad;
+ __u64 deadline_nsec;
};
struct drm_syncobj_timeline_wait {
__u64 handles;
@@ -417,6 +421,7 @@ struct drm_syncobj_timeline_wait {
__u32 flags;
__u32 first_signaled;
__u32 pad;
+ __u64 deadline_nsec;
};
struct drm_syncobj_eventfd {
__u32 handle;
@@ -570,6 +575,7 @@ extern "C" {
#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
#define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
+#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)
#define DRM_COMMAND_BASE 0x40
#define DRM_COMMAND_END 0xA0
struct drm_event {
diff --git a/libc/kernel/uapi/drm/drm_mode.h b/libc/kernel/uapi/drm/drm_mode.h
index f7b65b2b8..9e6296c98 100644
--- a/libc/kernel/uapi/drm/drm_mode.h
+++ b/libc/kernel/uapi/drm/drm_mode.h
@@ -357,6 +357,9 @@ struct drm_mode_crtc_lut {
struct drm_color_ctm {
__u64 matrix[9];
};
+struct drm_color_ctm_3x4 {
+ __u64 matrix[12];
+};
struct drm_color_lut {
__u16 red;
__u16 green;
@@ -483,6 +486,10 @@ struct drm_mode_rect {
__s32 x2;
__s32 y2;
};
+struct drm_mode_closefb {
+ __u32 fb_id;
+ __u32 pad;
+};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/habanalabs_accel.h b/libc/kernel/uapi/drm/habanalabs_accel.h
index 158e937ed..47afb82b9 100644
--- a/libc/kernel/uapi/drm/habanalabs_accel.h
+++ b/libc/kernel/uapi/drm/habanalabs_accel.h
@@ -656,6 +656,7 @@ enum hl_server_type {
#define HL_INFO_HW_ERR_EVENT 36
#define HL_INFO_FW_ERR_EVENT 37
#define HL_INFO_USER_ENGINE_ERR_EVENT 38
+#define HL_INFO_DEV_SIGNED 40
#define HL_INFO_VERSION_MAX_LEN 128
#define HL_INFO_CARD_NAME_MAX_LEN 16
#define HL_ENGINES_DATA_MAX_SIZE SZ_1M
@@ -849,6 +850,7 @@ struct hl_info_dev_memalloc_page_sizes {
#define SEC_SIGNATURE_BUF_SZ 255
#define SEC_PUB_DATA_BUF_SZ 510
#define SEC_CERTIFICATE_BUF_SZ 2046
+#define SEC_DEV_INFO_BUF_SZ 5120
struct hl_info_sec_attest {
__u32 nonce;
__u16 pcr_quote_len;
@@ -864,6 +866,18 @@ struct hl_info_sec_attest {
__u8 certificate[SEC_CERTIFICATE_BUF_SZ];
__u8 pad0[2];
};
+struct hl_info_signed {
+ __u32 nonce;
+ __u16 pub_data_len;
+ __u16 certificate_len;
+ __u8 info_sig_len;
+ __u8 public_data[SEC_PUB_DATA_BUF_SZ];
+ __u8 certificate[SEC_CERTIFICATE_BUF_SZ];
+ __u8 info_sig[SEC_SIGNATURE_BUF_SZ];
+ __u16 dev_info_len;
+ __u8 dev_info[SEC_DEV_INFO_BUF_SZ];
+ __u8 pad[2];
+};
struct hl_page_fault_info {
__s64 timestamp;
__u64 addr;
diff --git a/libc/kernel/uapi/drm/ivpu_accel.h b/libc/kernel/uapi/drm/ivpu_accel.h
index ca2014f38..fcbf6f7fb 100644
--- a/libc/kernel/uapi/drm/ivpu_accel.h
+++ b/libc/kernel/uapi/drm/ivpu_accel.h
@@ -43,6 +43,11 @@ extern "C" {
#define DRM_IVPU_CONTEXT_PRIORITY_NORMAL 1
#define DRM_IVPU_CONTEXT_PRIORITY_FOCUS 2
#define DRM_IVPU_CONTEXT_PRIORITY_REALTIME 3
+#define DRM_IVPU_JOB_PRIORITY_DEFAULT 0
+#define DRM_IVPU_JOB_PRIORITY_IDLE 1
+#define DRM_IVPU_JOB_PRIORITY_NORMAL 2
+#define DRM_IVPU_JOB_PRIORITY_FOCUS 3
+#define DRM_IVPU_JOB_PRIORITY_REALTIME 4
#define DRM_IVPU_CAP_METRIC_STREAMER 1
#define DRM_IVPU_CAP_DMA_MEMORY_RANGE 2
struct drm_ivpu_param {
@@ -80,8 +85,10 @@ struct drm_ivpu_submit {
__u32 engine;
__u32 flags;
__u32 commands_offset;
+ __u32 priority;
};
#define DRM_IVPU_JOB_STATUS_SUCCESS 0
+#define DRM_IVPU_JOB_STATUS_ABORTED 256
struct drm_ivpu_bo_wait {
__u32 handle;
__u32 flags;
diff --git a/libc/kernel/uapi/drm/msm_drm.h b/libc/kernel/uapi/drm/msm_drm.h
index d180f7082..4d837440b 100644
--- a/libc/kernel/uapi/drm/msm_drm.h
+++ b/libc/kernel/uapi/drm/msm_drm.h
@@ -36,6 +36,7 @@ struct drm_msm_timespec {
#define MSM_PARAM_CMDLINE 0x0d
#define MSM_PARAM_VA_START 0x0e
#define MSM_PARAM_VA_SIZE 0x0f
+#define MSM_PARAM_HIGHEST_BANK_BIT 0x10
#define MSM_PARAM_NR_RINGS MSM_PARAM_PRIORITIES
struct drm_msm_param {
__u32 pipe;
@@ -63,6 +64,8 @@ struct drm_msm_gem_new {
#define MSM_INFO_GET_NAME 0x03
#define MSM_INFO_SET_IOVA 0x04
#define MSM_INFO_GET_FLAGS 0x05
+#define MSM_INFO_SET_METADATA 0x06
+#define MSM_INFO_GET_METADATA 0x07
struct drm_msm_gem_info {
__u32 handle;
__u32 info;
diff --git a/libc/kernel/uapi/drm/nouveau_drm.h b/libc/kernel/uapi/drm/nouveau_drm.h
index 221ff2132..f7d870e73 100644
--- a/libc/kernel/uapi/drm/nouveau_drm.h
+++ b/libc/kernel/uapi/drm/nouveau_drm.h
@@ -23,6 +23,8 @@ extern "C" {
#define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
#define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
#define NOUVEAU_GETPARAM_EXEC_PUSH_MAX 17
+#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
+#define NOUVEAU_GETPARAM_VRAM_USED 19
struct drm_nouveau_getparam {
__u64 param;
__u64 value;
diff --git a/libc/kernel/uapi/drm/pvr_drm.h b/libc/kernel/uapi/drm/pvr_drm.h
new file mode 100644
index 000000000..c68c719f7
--- /dev/null
+++ b/libc/kernel/uapi/drm/pvr_drm.h
@@ -0,0 +1,271 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef PVR_DRM_UAPI_H
+#define PVR_DRM_UAPI_H
+#include "drm.h"
+#include <linux/const.h>
+#include <linux/types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct drm_pvr_obj_array {
+ __u32 stride;
+ __u32 count;
+ __u64 array;
+};
+#define DRM_PVR_OBJ_ARRAY(cnt,ptr) {.stride = sizeof((ptr)[0]),.count = (cnt),.array = (__u64) (uintptr_t) (ptr) }
+#define PVR_IOCTL(_ioctl,_mode,_data) _mode(DRM_COMMAND_BASE + (_ioctl), struct drm_pvr_ioctl_ ##_data ##_args)
+#define DRM_IOCTL_PVR_DEV_QUERY PVR_IOCTL(0x00, DRM_IOWR, dev_query)
+#define DRM_IOCTL_PVR_CREATE_BO PVR_IOCTL(0x01, DRM_IOWR, create_bo)
+#define DRM_IOCTL_PVR_GET_BO_MMAP_OFFSET PVR_IOCTL(0x02, DRM_IOWR, get_bo_mmap_offset)
+#define DRM_IOCTL_PVR_CREATE_VM_CONTEXT PVR_IOCTL(0x03, DRM_IOWR, create_vm_context)
+#define DRM_IOCTL_PVR_DESTROY_VM_CONTEXT PVR_IOCTL(0x04, DRM_IOW, destroy_vm_context)
+#define DRM_IOCTL_PVR_VM_MAP PVR_IOCTL(0x05, DRM_IOW, vm_map)
+#define DRM_IOCTL_PVR_VM_UNMAP PVR_IOCTL(0x06, DRM_IOW, vm_unmap)
+#define DRM_IOCTL_PVR_CREATE_CONTEXT PVR_IOCTL(0x07, DRM_IOWR, create_context)
+#define DRM_IOCTL_PVR_DESTROY_CONTEXT PVR_IOCTL(0x08, DRM_IOW, destroy_context)
+#define DRM_IOCTL_PVR_CREATE_FREE_LIST PVR_IOCTL(0x09, DRM_IOWR, create_free_list)
+#define DRM_IOCTL_PVR_DESTROY_FREE_LIST PVR_IOCTL(0x0a, DRM_IOW, destroy_free_list)
+#define DRM_IOCTL_PVR_CREATE_HWRT_DATASET PVR_IOCTL(0x0b, DRM_IOWR, create_hwrt_dataset)
+#define DRM_IOCTL_PVR_DESTROY_HWRT_DATASET PVR_IOCTL(0x0c, DRM_IOW, destroy_hwrt_dataset)
+#define DRM_IOCTL_PVR_SUBMIT_JOBS PVR_IOCTL(0x0d, DRM_IOW, submit_jobs)
+struct drm_pvr_dev_query_gpu_info {
+ __u64 gpu_id;
+ __u32 num_phantoms;
+ __u32 _padding_c;
+};
+struct drm_pvr_dev_query_runtime_info {
+ __u64 free_list_min_pages;
+ __u64 free_list_max_pages;
+ __u32 common_store_alloc_region_size;
+ __u32 common_store_partition_space_size;
+ __u32 max_coeffs;
+ __u32 cdm_max_local_mem_size_regs;
+};
+struct drm_pvr_dev_query_quirks {
+ __u64 quirks;
+ __u16 count;
+ __u16 musthave_count;
+ __u32 _padding_c;
+};
+struct drm_pvr_dev_query_enhancements {
+ __u64 enhancements;
+ __u16 count;
+ __u16 _padding_a;
+ __u32 _padding_c;
+};
+enum drm_pvr_heap_id {
+ DRM_PVR_HEAP_GENERAL = 0,
+ DRM_PVR_HEAP_PDS_CODE_DATA,
+ DRM_PVR_HEAP_USC_CODE,
+ DRM_PVR_HEAP_RGNHDR,
+ DRM_PVR_HEAP_VIS_TEST,
+ DRM_PVR_HEAP_TRANSFER_FRAG,
+ DRM_PVR_HEAP_COUNT
+};
+struct drm_pvr_heap {
+ __u64 base;
+ __u64 size;
+ __u32 flags;
+ __u32 page_size_log2;
+};
+struct drm_pvr_dev_query_heap_info {
+ struct drm_pvr_obj_array heaps;
+};
+enum drm_pvr_static_data_area_usage {
+ DRM_PVR_STATIC_DATA_AREA_EOT = 0,
+ DRM_PVR_STATIC_DATA_AREA_FENCE,
+ DRM_PVR_STATIC_DATA_AREA_VDM_SYNC,
+ DRM_PVR_STATIC_DATA_AREA_YUV_CSC,
+};
+struct drm_pvr_static_data_area {
+ __u16 area_usage;
+ __u16 location_heap_id;
+ __u32 size;
+ __u64 offset;
+};
+struct drm_pvr_dev_query_static_data_areas {
+ struct drm_pvr_obj_array static_data_areas;
+};
+enum drm_pvr_dev_query {
+ DRM_PVR_DEV_QUERY_GPU_INFO_GET = 0,
+ DRM_PVR_DEV_QUERY_RUNTIME_INFO_GET,
+ DRM_PVR_DEV_QUERY_QUIRKS_GET,
+ DRM_PVR_DEV_QUERY_ENHANCEMENTS_GET,
+ DRM_PVR_DEV_QUERY_HEAP_INFO_GET,
+ DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET,
+};
+struct drm_pvr_ioctl_dev_query_args {
+ __u32 type;
+ __u32 size;
+ __u64 pointer;
+};
+#define DRM_PVR_BO_BYPASS_DEVICE_CACHE _BITULL(0)
+#define DRM_PVR_BO_PM_FW_PROTECT _BITULL(1)
+#define DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS _BITULL(2)
+#define DRM_PVR_BO_FLAGS_MASK (DRM_PVR_BO_BYPASS_DEVICE_CACHE | DRM_PVR_BO_PM_FW_PROTECT | DRM_PVR_BO_ALLOW_CPU_USERSPACE_ACCESS)
+struct drm_pvr_ioctl_create_bo_args {
+ __u64 size;
+ __u32 handle;
+ __u32 _padding_c;
+ __u64 flags;
+};
+struct drm_pvr_ioctl_get_bo_mmap_offset_args {
+ __u32 handle;
+ __u32 _padding_4;
+ __u64 offset;
+};
+struct drm_pvr_ioctl_create_vm_context_args {
+ __u32 handle;
+ __u32 _padding_4;
+};
+struct drm_pvr_ioctl_destroy_vm_context_args {
+ __u32 handle;
+ __u32 _padding_4;
+};
+struct drm_pvr_ioctl_vm_map_args {
+ __u32 vm_context_handle;
+ __u32 flags;
+ __u64 device_addr;
+ __u32 handle;
+ __u32 _padding_14;
+ __u64 offset;
+ __u64 size;
+};
+struct drm_pvr_ioctl_vm_unmap_args {
+ __u32 vm_context_handle;
+ __u32 _padding_4;
+ __u64 device_addr;
+ __u64 size;
+};
+enum drm_pvr_ctx_priority {
+ DRM_PVR_CTX_PRIORITY_LOW = - 512,
+ DRM_PVR_CTX_PRIORITY_NORMAL = 0,
+ DRM_PVR_CTX_PRIORITY_HIGH = 512,
+};
+enum drm_pvr_ctx_type {
+ DRM_PVR_CTX_TYPE_RENDER = 0,
+ DRM_PVR_CTX_TYPE_COMPUTE,
+ DRM_PVR_CTX_TYPE_TRANSFER_FRAG,
+};
+struct drm_pvr_ioctl_create_context_args {
+ __u32 type;
+ __u32 flags;
+ __s32 priority;
+ __u32 handle;
+ __u64 static_context_state;
+ __u32 static_context_state_len;
+ __u32 vm_context_handle;
+ __u64 callstack_addr;
+};
+struct drm_pvr_ioctl_destroy_context_args {
+ __u32 handle;
+ __u32 _padding_4;
+};
+struct drm_pvr_ioctl_create_free_list_args {
+ __u64 free_list_gpu_addr;
+ __u32 initial_num_pages;
+ __u32 max_num_pages;
+ __u32 grow_num_pages;
+ __u32 grow_threshold;
+ __u32 vm_context_handle;
+ __u32 handle;
+};
+struct drm_pvr_ioctl_destroy_free_list_args {
+ __u32 handle;
+ __u32 _padding_4;
+};
+struct drm_pvr_create_hwrt_geom_data_args {
+ __u64 tpc_dev_addr;
+ __u32 tpc_size;
+ __u32 tpc_stride;
+ __u64 vheap_table_dev_addr;
+ __u64 rtc_dev_addr;
+};
+struct drm_pvr_create_hwrt_rt_data_args {
+ __u64 pm_mlist_dev_addr;
+ __u64 macrotile_array_dev_addr;
+ __u64 region_header_dev_addr;
+};
+#define PVR_DRM_HWRT_FREE_LIST_LOCAL 0
+#define PVR_DRM_HWRT_FREE_LIST_GLOBAL 1U
+struct drm_pvr_ioctl_create_hwrt_dataset_args {
+ struct drm_pvr_create_hwrt_geom_data_args geom_data_args;
+ struct drm_pvr_create_hwrt_rt_data_args rt_data_args[2];
+ __u32 free_list_handles[2];
+ __u32 width;
+ __u32 height;
+ __u32 samples;
+ __u32 layers;
+ __u32 isp_merge_lower_x;
+ __u32 isp_merge_lower_y;
+ __u32 isp_merge_scale_x;
+ __u32 isp_merge_scale_y;
+ __u32 isp_merge_upper_x;
+ __u32 isp_merge_upper_y;
+ __u32 region_header_size;
+ __u32 handle;
+};
+struct drm_pvr_ioctl_destroy_hwrt_dataset_args {
+ __u32 handle;
+ __u32 _padding_4;
+};
+#define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_MASK 0xf
+#define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_SYNCOBJ 0
+#define DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_TIMELINE_SYNCOBJ 1
+#define DRM_PVR_SYNC_OP_FLAG_SIGNAL _BITULL(31)
+#define DRM_PVR_SYNC_OP_FLAG_WAIT 0
+#define DRM_PVR_SYNC_OP_FLAGS_MASK (DRM_PVR_SYNC_OP_FLAG_HANDLE_TYPE_MASK | DRM_PVR_SYNC_OP_FLAG_SIGNAL)
+struct drm_pvr_sync_op {
+ __u32 handle;
+ __u32 flags;
+ __u64 value;
+};
+#define DRM_PVR_SUBMIT_JOB_GEOM_CMD_FIRST _BITULL(0)
+#define DRM_PVR_SUBMIT_JOB_GEOM_CMD_LAST _BITULL(1)
+#define DRM_PVR_SUBMIT_JOB_GEOM_CMD_SINGLE_CORE _BITULL(2)
+#define DRM_PVR_SUBMIT_JOB_GEOM_CMD_FLAGS_MASK (DRM_PVR_SUBMIT_JOB_GEOM_CMD_FIRST | DRM_PVR_SUBMIT_JOB_GEOM_CMD_LAST | DRM_PVR_SUBMIT_JOB_GEOM_CMD_SINGLE_CORE)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_SINGLE_CORE _BITULL(0)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_DEPTHBUFFER _BITULL(1)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_STENCILBUFFER _BITULL(2)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_PREVENT_CDM_OVERLAP _BITULL(3)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_SCRATCHBUFFER _BITULL(4)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_GET_VIS_RESULTS _BITULL(5)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_PARTIAL_RENDER _BITULL(6)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE _BITULL(7)
+#define DRM_PVR_SUBMIT_JOB_FRAG_CMD_FLAGS_MASK (DRM_PVR_SUBMIT_JOB_FRAG_CMD_SINGLE_CORE | DRM_PVR_SUBMIT_JOB_FRAG_CMD_DEPTHBUFFER | DRM_PVR_SUBMIT_JOB_FRAG_CMD_STENCILBUFFER | DRM_PVR_SUBMIT_JOB_FRAG_CMD_PREVENT_CDM_OVERLAP | DRM_PVR_SUBMIT_JOB_FRAG_CMD_SCRATCHBUFFER | DRM_PVR_SUBMIT_JOB_FRAG_CMD_GET_VIS_RESULTS | DRM_PVR_SUBMIT_JOB_FRAG_CMD_PARTIAL_RENDER | DRM_PVR_SUBMIT_JOB_FRAG_CMD_DISABLE_PIXELMERGE)
+#define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_PREVENT_ALL_OVERLAP _BITULL(0)
+#define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_SINGLE_CORE _BITULL(1)
+#define DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_FLAGS_MASK (DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_PREVENT_ALL_OVERLAP | DRM_PVR_SUBMIT_JOB_COMPUTE_CMD_SINGLE_CORE)
+#define DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_SINGLE_CORE _BITULL(0)
+#define DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_FLAGS_MASK DRM_PVR_SUBMIT_JOB_TRANSFER_CMD_SINGLE_CORE
+enum drm_pvr_job_type {
+ DRM_PVR_JOB_TYPE_GEOMETRY = 0,
+ DRM_PVR_JOB_TYPE_FRAGMENT,
+ DRM_PVR_JOB_TYPE_COMPUTE,
+ DRM_PVR_JOB_TYPE_TRANSFER_FRAG,
+};
+struct drm_pvr_hwrt_data_ref {
+ __u32 set_handle;
+ __u32 data_index;
+};
+struct drm_pvr_job {
+ __u32 type;
+ __u32 context_handle;
+ __u32 flags;
+ __u32 cmd_stream_len;
+ __u64 cmd_stream;
+ struct drm_pvr_obj_array sync_ops;
+ struct drm_pvr_hwrt_data_ref hwrt;
+};
+struct drm_pvr_ioctl_submit_jobs_args {
+ struct drm_pvr_obj_array jobs;
+};
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/libc/kernel/uapi/drm/v3d_drm.h b/libc/kernel/uapi/drm/v3d_drm.h
index 594856f6f..4000fd3e6 100644
--- a/libc/kernel/uapi/drm/v3d_drm.h
+++ b/libc/kernel/uapi/drm/v3d_drm.h
@@ -21,6 +21,7 @@ extern "C" {
#define DRM_V3D_PERFMON_CREATE 0x08
#define DRM_V3D_PERFMON_DESTROY 0x09
#define DRM_V3D_PERFMON_GET_VALUES 0x0a
+#define DRM_V3D_SUBMIT_CPU 0x0b
#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)
@@ -32,12 +33,19 @@ extern "C" {
#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_IOCTL_V3D_SUBMIT_CPU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CPU, struct drm_v3d_submit_cpu)
#define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01
#define DRM_V3D_SUBMIT_EXTENSION 0x02
struct drm_v3d_extension {
__u64 next;
__u32 id;
#define DRM_V3D_EXT_ID_MULTI_SYNC 0x01
+#define DRM_V3D_EXT_ID_CPU_INDIRECT_CSD 0x02
+#define DRM_V3D_EXT_ID_CPU_TIMESTAMP_QUERY 0x03
+#define DRM_V3D_EXT_ID_CPU_RESET_TIMESTAMP_QUERY 0x04
+#define DRM_V3D_EXT_ID_CPU_COPY_TIMESTAMP_QUERY 0x05
+#define DRM_V3D_EXT_ID_CPU_RESET_PERFORMANCE_QUERY 0x06
+#define DRM_V3D_EXT_ID_CPU_COPY_PERFORMANCE_QUERY 0x07
__u32 flags;
};
struct drm_v3d_sem {
@@ -52,6 +60,7 @@ enum v3d_queue {
V3D_TFU,
V3D_CSD,
V3D_CACHE_CLEAN,
+ V3D_CPU,
};
struct drm_v3d_multi_sync {
struct drm_v3d_extension base;
@@ -109,6 +118,7 @@ enum drm_v3d_param {
DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
DRM_V3D_PARAM_SUPPORTS_PERFMON,
DRM_V3D_PARAM_SUPPORTS_MULTISYNC_EXT,
+ DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE,
};
struct drm_v3d_get_param {
__u32 param;
@@ -133,6 +143,10 @@ struct drm_v3d_submit_tfu {
__u32 out_sync;
__u32 flags;
__u64 extensions;
+ struct {
+ __u32 ioc;
+ __u32 pad;
+ } v71;
};
struct drm_v3d_submit_csd {
__u32 cfg[7];
@@ -146,6 +160,66 @@ struct drm_v3d_submit_csd {
__u32 flags;
__u32 pad;
};
+struct drm_v3d_indirect_csd {
+ struct drm_v3d_extension base;
+ struct drm_v3d_submit_csd submit;
+ __u32 indirect;
+ __u32 offset;
+ __u32 wg_size;
+ __u32 wg_uniform_offsets[3];
+};
+struct drm_v3d_timestamp_query {
+ struct drm_v3d_extension base;
+ __u64 offsets;
+ __u64 syncs;
+ __u32 count;
+ __u32 pad;
+};
+struct drm_v3d_reset_timestamp_query {
+ struct drm_v3d_extension base;
+ __u64 syncs;
+ __u32 offset;
+ __u32 count;
+};
+struct drm_v3d_copy_timestamp_query {
+ struct drm_v3d_extension base;
+ __u8 do_64bit;
+ __u8 do_partial;
+ __u8 availability_bit;
+ __u8 pad;
+ __u32 offset;
+ __u32 stride;
+ __u32 count;
+ __u64 offsets;
+ __u64 syncs;
+};
+struct drm_v3d_reset_performance_query {
+ struct drm_v3d_extension base;
+ __u64 syncs;
+ __u32 count;
+ __u32 nperfmons;
+ __u64 kperfmon_ids;
+};
+struct drm_v3d_copy_performance_query {
+ struct drm_v3d_extension base;
+ __u8 do_64bit;
+ __u8 do_partial;
+ __u8 availability_bit;
+ __u8 pad;
+ __u32 offset;
+ __u32 stride;
+ __u32 nperfmons;
+ __u32 ncounters;
+ __u32 count;
+ __u64 syncs;
+ __u64 kperfmon_ids;
+};
+struct drm_v3d_submit_cpu {
+ __u64 bo_handles;
+ __u32 bo_handle_count;
+ __u32 flags;
+ __u64 extensions;
+};
enum {
V3D_PERFCNT_FEP_VALID_PRIMTS_NO_PIXELS,
V3D_PERFCNT_FEP_VALID_PRIMS,
diff --git a/libc/kernel/uapi/drm/virtgpu_drm.h b/libc/kernel/uapi/drm/virtgpu_drm.h
index 6babe2d90..d79c7d90a 100644
--- a/libc/kernel/uapi/drm/virtgpu_drm.h
+++ b/libc/kernel/uapi/drm/virtgpu_drm.h
@@ -58,6 +58,7 @@ struct drm_virtgpu_execbuffer {
#define VIRTGPU_PARAM_CROSS_DEVICE 5
#define VIRTGPU_PARAM_CONTEXT_INIT 6
#define VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7
+#define VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME 8
struct drm_virtgpu_getparam {
__u64 param;
__u64 value;
@@ -140,6 +141,7 @@ struct drm_virtgpu_resource_create_blob {
#define VIRTGPU_CONTEXT_PARAM_CAPSET_ID 0x0001
#define VIRTGPU_CONTEXT_PARAM_NUM_RINGS 0x0002
#define VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK 0x0003
+#define VIRTGPU_CONTEXT_PARAM_DEBUG_NAME 0x0004
struct drm_virtgpu_context_set_param {
__u64 param;
__u64 value;
diff --git a/libc/kernel/uapi/drm/xe_drm.h b/libc/kernel/uapi/drm/xe_drm.h
new file mode 100644
index 000000000..1e9f128e9
--- /dev/null
+++ b/libc/kernel/uapi/drm/xe_drm.h
@@ -0,0 +1,296 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef _UAPI_XE_DRM_H_
+#define _UAPI_XE_DRM_H_
+#include "drm.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define DRM_XE_DEVICE_QUERY 0x00
+#define DRM_XE_GEM_CREATE 0x01
+#define DRM_XE_GEM_MMAP_OFFSET 0x02
+#define DRM_XE_VM_CREATE 0x03
+#define DRM_XE_VM_DESTROY 0x04
+#define DRM_XE_VM_BIND 0x05
+#define DRM_XE_EXEC_QUEUE_CREATE 0x06
+#define DRM_XE_EXEC_QUEUE_DESTROY 0x07
+#define DRM_XE_EXEC_QUEUE_GET_PROPERTY 0x08
+#define DRM_XE_EXEC 0x09
+#define DRM_XE_WAIT_USER_FENCE 0x0a
+#define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
+#define DRM_IOCTL_XE_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)
+#define DRM_IOCTL_XE_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)
+#define DRM_IOCTL_XE_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)
+#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
+#define DRM_IOCTL_XE_VM_BIND DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
+#define DRM_IOCTL_XE_EXEC_QUEUE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)
+#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
+#define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)
+#define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
+#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
+struct drm_xe_user_extension {
+ __u64 next_extension;
+ __u32 name;
+ __u32 pad;
+};
+struct drm_xe_ext_set_property {
+ struct drm_xe_user_extension base;
+ __u32 property;
+ __u32 pad;
+ __u64 value;
+ __u64 reserved[2];
+};
+struct drm_xe_engine_class_instance {
+#define DRM_XE_ENGINE_CLASS_RENDER 0
+#define DRM_XE_ENGINE_CLASS_COPY 1
+#define DRM_XE_ENGINE_CLASS_VIDEO_DECODE 2
+#define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE 3
+#define DRM_XE_ENGINE_CLASS_COMPUTE 4
+#define DRM_XE_ENGINE_CLASS_VM_BIND 5
+ __u16 engine_class;
+ __u16 engine_instance;
+ __u16 gt_id;
+ __u16 pad;
+};
+struct drm_xe_engine {
+ struct drm_xe_engine_class_instance instance;
+ __u64 reserved[3];
+};
+struct drm_xe_query_engines {
+ __u32 num_engines;
+ __u32 pad;
+ struct drm_xe_engine engines[];
+};
+enum drm_xe_memory_class {
+ DRM_XE_MEM_REGION_CLASS_SYSMEM = 0,
+ DRM_XE_MEM_REGION_CLASS_VRAM
+};
+struct drm_xe_mem_region {
+ __u16 mem_class;
+ __u16 instance;
+ __u32 min_page_size;
+ __u64 total_size;
+ __u64 used;
+ __u64 cpu_visible_size;
+ __u64 cpu_visible_used;
+ __u64 reserved[6];
+};
+struct drm_xe_query_mem_regions {
+ __u32 num_mem_regions;
+ __u32 pad;
+ struct drm_xe_mem_region mem_regions[];
+};
+struct drm_xe_query_config {
+ __u32 num_params;
+ __u32 pad;
+#define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0
+#define DRM_XE_QUERY_CONFIG_FLAGS 1
+#define DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM (1 << 0)
+#define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT 2
+#define DRM_XE_QUERY_CONFIG_VA_BITS 3
+#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 4
+ __u64 info[];
+};
+struct drm_xe_gt {
+#define DRM_XE_QUERY_GT_TYPE_MAIN 0
+#define DRM_XE_QUERY_GT_TYPE_MEDIA 1
+ __u16 type;
+ __u16 tile_id;
+ __u16 gt_id;
+ __u16 pad[3];
+ __u32 reference_clock;
+ __u64 near_mem_regions;
+ __u64 far_mem_regions;
+ __u64 reserved[8];
+};
+struct drm_xe_query_gt_list {
+ __u32 num_gt;
+ __u32 pad;
+ struct drm_xe_gt gt_list[];
+};
+struct drm_xe_query_topology_mask {
+ __u16 gt_id;
+#define DRM_XE_TOPO_DSS_GEOMETRY (1 << 0)
+#define DRM_XE_TOPO_DSS_COMPUTE (1 << 1)
+#define DRM_XE_TOPO_EU_PER_DSS (1 << 2)
+ __u16 type;
+ __u32 num_bytes;
+ __u8 mask[];
+};
+struct drm_xe_query_engine_cycles {
+ struct drm_xe_engine_class_instance eci;
+ __s32 clockid;
+ __u32 width;
+ __u64 engine_cycles;
+ __u64 cpu_timestamp;
+ __u64 cpu_delta;
+};
+struct drm_xe_device_query {
+ __u64 extensions;
+#define DRM_XE_DEVICE_QUERY_ENGINES 0
+#define DRM_XE_DEVICE_QUERY_MEM_REGIONS 1
+#define DRM_XE_DEVICE_QUERY_CONFIG 2
+#define DRM_XE_DEVICE_QUERY_GT_LIST 3
+#define DRM_XE_DEVICE_QUERY_HWCONFIG 4
+#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5
+#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
+ __u32 query;
+ __u32 size;
+ __u64 data;
+ __u64 reserved[2];
+};
+struct drm_xe_gem_create {
+ __u64 extensions;
+ __u64 size;
+ __u32 placement;
+#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0)
+#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (1 << 1)
+#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (1 << 2)
+ __u32 flags;
+ __u32 vm_id;
+ __u32 handle;
+#define DRM_XE_GEM_CPU_CACHING_WB 1
+#define DRM_XE_GEM_CPU_CACHING_WC 2
+ __u16 cpu_caching;
+ __u16 pad[3];
+ __u64 reserved[2];
+};
+struct drm_xe_gem_mmap_offset {
+ __u64 extensions;
+ __u32 handle;
+ __u32 flags;
+ __u64 offset;
+ __u64 reserved[2];
+};
+struct drm_xe_vm_create {
+ __u64 extensions;
+#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE (1 << 0)
+#define DRM_XE_VM_CREATE_FLAG_LR_MODE (1 << 1)
+#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE (1 << 2)
+ __u32 flags;
+ __u32 vm_id;
+ __u64 reserved[2];
+};
+struct drm_xe_vm_destroy {
+ __u32 vm_id;
+ __u32 pad;
+ __u64 reserved[2];
+};
+struct drm_xe_vm_bind_op {
+ __u64 extensions;
+ __u32 obj;
+ __u16 pat_index;
+ __u16 pad;
+ union {
+ __u64 obj_offset;
+ __u64 userptr;
+ };
+ __u64 range;
+ __u64 addr;
+#define DRM_XE_VM_BIND_OP_MAP 0x0
+#define DRM_XE_VM_BIND_OP_UNMAP 0x1
+#define DRM_XE_VM_BIND_OP_MAP_USERPTR 0x2
+#define DRM_XE_VM_BIND_OP_UNMAP_ALL 0x3
+#define DRM_XE_VM_BIND_OP_PREFETCH 0x4
+ __u32 op;
+#define DRM_XE_VM_BIND_FLAG_NULL (1 << 2)
+#define DRM_XE_VM_BIND_FLAG_DUMPABLE (1 << 3)
+ __u32 flags;
+ __u32 prefetch_mem_region_instance;
+ __u32 pad2;
+ __u64 reserved[3];
+};
+struct drm_xe_vm_bind {
+ __u64 extensions;
+ __u32 vm_id;
+ __u32 exec_queue_id;
+ __u32 pad;
+ __u32 num_binds;
+ union {
+ struct drm_xe_vm_bind_op bind;
+ __u64 vector_of_binds;
+ };
+ __u32 pad2;
+ __u32 num_syncs;
+ __u64 syncs;
+ __u64 reserved[2];
+};
+struct drm_xe_exec_queue_create {
+#define DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY 0
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY 0
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE 1
+ __u64 extensions;
+ __u16 width;
+ __u16 num_placements;
+ __u32 vm_id;
+ __u32 flags;
+ __u32 exec_queue_id;
+ __u64 instances;
+ __u64 reserved[2];
+};
+struct drm_xe_exec_queue_destroy {
+ __u32 exec_queue_id;
+ __u32 pad;
+ __u64 reserved[2];
+};
+struct drm_xe_exec_queue_get_property {
+ __u64 extensions;
+ __u32 exec_queue_id;
+#define DRM_XE_EXEC_QUEUE_GET_PROPERTY_BAN 0
+ __u32 property;
+ __u64 value;
+ __u64 reserved[2];
+};
+struct drm_xe_sync {
+ __u64 extensions;
+#define DRM_XE_SYNC_TYPE_SYNCOBJ 0x0
+#define DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ 0x1
+#define DRM_XE_SYNC_TYPE_USER_FENCE 0x2
+ __u32 type;
+#define DRM_XE_SYNC_FLAG_SIGNAL (1 << 0)
+ __u32 flags;
+ union {
+ __u32 handle;
+ __u64 addr;
+ };
+ __u64 timeline_value;
+ __u64 reserved[2];
+};
+struct drm_xe_exec {
+ __u64 extensions;
+ __u32 exec_queue_id;
+ __u32 num_syncs;
+ __u64 syncs;
+ __u64 address;
+ __u16 num_batch_buffer;
+ __u16 pad[3];
+ __u64 reserved[2];
+};
+struct drm_xe_wait_user_fence {
+ __u64 extensions;
+ __u64 addr;
+#define DRM_XE_UFENCE_WAIT_OP_EQ 0x0
+#define DRM_XE_UFENCE_WAIT_OP_NEQ 0x1
+#define DRM_XE_UFENCE_WAIT_OP_GT 0x2
+#define DRM_XE_UFENCE_WAIT_OP_GTE 0x3
+#define DRM_XE_UFENCE_WAIT_OP_LT 0x4
+#define DRM_XE_UFENCE_WAIT_OP_LTE 0x5
+ __u16 op;
+#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 0)
+ __u16 flags;
+ __u32 pad;
+ __u64 value;
+ __u64 mask;
+ __s64 timeout;
+ __u32 exec_queue_id;
+ __u32 pad2;
+ __u64 reserved[2];
+};
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/libc/kernel/uapi/linux/android/binder.h b/libc/kernel/uapi/linux/android/binder.h
index 1abb3a307..6e64ebc30 100644
--- a/libc/kernel/uapi/linux/android/binder.h
+++ b/libc/kernel/uapi/linux/android/binder.h
@@ -120,20 +120,22 @@ struct binder_extended_error {
__u32 command;
__s32 param;
};
-#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
-#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
-#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
-#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
-#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
-#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
-#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
-#define BINDER_GET_NODE_DEBUG_INFO _IOWR('b', 11, struct binder_node_debug_info)
-#define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref)
-#define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object)
-#define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info)
-#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info)
-#define BINDER_ENABLE_ONEWAY_SPAM_DETECTION _IOW('b', 16, __u32)
-#define BINDER_GET_EXTENDED_ERROR _IOWR('b', 17, struct binder_extended_error)
+enum {
+ BINDER_WRITE_READ = _IOWR('b', 1, struct binder_write_read),
+ BINDER_SET_IDLE_TIMEOUT = _IOW('b', 3, __s64),
+ BINDER_SET_MAX_THREADS = _IOW('b', 5, __u32),
+ BINDER_SET_IDLE_PRIORITY = _IOW('b', 6, __s32),
+ BINDER_SET_CONTEXT_MGR = _IOW('b', 7, __s32),
+ BINDER_THREAD_EXIT = _IOW('b', 8, __s32),
+ BINDER_VERSION = _IOWR('b', 9, struct binder_version),
+ BINDER_GET_NODE_DEBUG_INFO = _IOWR('b', 11, struct binder_node_debug_info),
+ BINDER_GET_NODE_INFO_FOR_REF = _IOWR('b', 12, struct binder_node_info_for_ref),
+ BINDER_SET_CONTEXT_MGR_EXT = _IOW('b', 13, struct flat_binder_object),
+ BINDER_FREEZE = _IOW('b', 14, struct binder_freeze_info),
+ BINDER_GET_FROZEN_INFO = _IOWR('b', 15, struct binder_frozen_status_info),
+ BINDER_ENABLE_ONEWAY_SPAM_DETECTION = _IOW('b', 16, __u32),
+ BINDER_GET_EXTENDED_ERROR = _IOWR('b', 17, struct binder_extended_error),
+};
enum transaction_flags {
TF_ONE_WAY = 0x01,
TF_ROOT_OBJECT = 0x04,
diff --git a/libc/kernel/uapi/linux/batadv_packet.h b/libc/kernel/uapi/linux/batadv_packet.h
index eb72d6392..83e5e71b0 100644
--- a/libc/kernel/uapi/linux/batadv_packet.h
+++ b/libc/kernel/uapi/linux/batadv_packet.h
@@ -51,6 +51,7 @@ enum batadv_mcast_flags {
BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
+ BATADV_MCAST_HAVE_MC_PTYPE_CAPA = 1UL << 5,
};
#define BATADV_TT_DATA_TYPE_MASK 0x0F
enum batadv_tt_data_flags {
@@ -76,6 +77,7 @@ enum batadv_tvlv_type {
BATADV_TVLV_TT = 0x04,
BATADV_TVLV_ROAM = 0x05,
BATADV_TVLV_MCAST = 0x06,
+ BATADV_TVLV_MCAST_TRACKER = 0x07,
};
#pragma pack(2)
struct batadv_bla_claim_dst {
@@ -208,6 +210,13 @@ struct batadv_bcast_packet {
__be32 seqno;
__u8 orig[ETH_ALEN];
};
+struct batadv_mcast_packet {
+ __u8 packet_type;
+ __u8 version;
+ __u8 ttl;
+ __u8 reserved;
+ __be16 tvlv_len;
+};
struct batadv_coded_packet {
__u8 packet_type;
__u8 version;
@@ -267,5 +276,8 @@ struct batadv_tvlv_mcast_data {
__u8 flags;
__u8 reserved[3];
};
+struct batadv_tvlv_mcast_tracker {
+ __be16 num_dests;
+};
#pragma pack()
#endif
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index 25e8ad7a9..8f82b7128 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -271,8 +271,9 @@ enum bpf_link_type {
BPF_LINK_TYPE_TCX = 11,
BPF_LINK_TYPE_UPROBE_MULTI = 12,
BPF_LINK_TYPE_NETKIT = 13,
- MAX_BPF_LINK_TYPE,
+ __MAX_BPF_LINK_TYPE,
};
+#define MAX_BPF_LINK_TYPE __MAX_BPF_LINK_TYPE
enum bpf_perf_event_type {
BPF_PERF_EVENT_UNSPEC = 0,
BPF_PERF_EVENT_UPROBE = 1,
@@ -296,6 +297,7 @@ enum bpf_perf_event_type {
#define BPF_F_SLEEPABLE (1U << 4)
#define BPF_F_XDP_HAS_FRAGS (1U << 5)
#define BPF_F_XDP_DEV_BOUND_ONLY (1U << 6)
+#define BPF_F_TEST_REG_INVARIANTS (1U << 7)
enum {
BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
};
@@ -1063,6 +1065,16 @@ struct bpf_link_info {
__u64 missed;
} kprobe_multi;
struct {
+ __aligned_u64 path;
+ __aligned_u64 offsets;
+ __aligned_u64 ref_ctr_offsets;
+ __aligned_u64 cookies;
+ __u32 path_size;
+ __u32 count;
+ __u32 flags;
+ __u32 pid;
+ } uprobe_multi;
+ struct {
__u32 type;
__u32 : 32;
union {
@@ -1198,6 +1210,7 @@ enum {
BPF_TCP_LISTEN,
BPF_TCP_CLOSING,
BPF_TCP_NEW_SYN_RECV,
+ BPF_TCP_BOUND_INACTIVE,
BPF_TCP_MAX_STATES
};
enum {
@@ -1358,34 +1371,25 @@ struct bpf_spin_lock {
__u32 val;
};
struct bpf_timer {
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[2];
} __attribute__((aligned(8)));
struct bpf_dynptr {
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[2];
} __attribute__((aligned(8)));
struct bpf_list_head {
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[2];
} __attribute__((aligned(8)));
struct bpf_list_node {
- __u64 : 64;
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[3];
} __attribute__((aligned(8)));
struct bpf_rb_root {
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[2];
} __attribute__((aligned(8)));
struct bpf_rb_node {
- __u64 : 64;
- __u64 : 64;
- __u64 : 64;
- __u64 : 64;
+ __u64 __opaque[4];
} __attribute__((aligned(8)));
struct bpf_refcount {
- __u32 : 32;
+ __u32 __opaque[1];
} __attribute__((aligned(4)));
struct bpf_sysctl {
__u32 write;
diff --git a/libc/kernel/uapi/linux/bpfilter.h b/libc/kernel/uapi/linux/bpfilter.h
deleted file mode 100644
index a0833a3eb..000000000
--- a/libc/kernel/uapi/linux/bpfilter.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is auto-generated. Modifications will be lost.
- *
- * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
- * for more information.
- */
-#ifndef _UAPI_LINUX_BPFILTER_H
-#define _UAPI_LINUX_BPFILTER_H
-#include <linux/if.h>
-enum {
- BPFILTER_IPT_SO_SET_REPLACE = 64,
- BPFILTER_IPT_SO_SET_ADD_COUNTERS = 65,
- BPFILTER_IPT_SET_MAX,
-};
-enum {
- BPFILTER_IPT_SO_GET_INFO = 64,
- BPFILTER_IPT_SO_GET_ENTRIES = 65,
- BPFILTER_IPT_SO_GET_REVISION_MATCH = 66,
- BPFILTER_IPT_SO_GET_REVISION_TARGET = 67,
- BPFILTER_IPT_GET_MAX,
-};
-#endif
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index 27564f83b..5d449f830 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -310,6 +310,7 @@ struct btrfs_ioctl_clone_range_args {
};
#define BTRFS_DEFRAG_RANGE_COMPRESS 1
#define BTRFS_DEFRAG_RANGE_START_IO 2
+#define BTRFS_DEFRAG_RANGE_FLAGS_SUPP (BTRFS_DEFRAG_RANGE_COMPRESS | BTRFS_DEFRAG_RANGE_START_IO)
struct btrfs_ioctl_defrag_range_args {
__u64 start;
__u64 len;
diff --git a/libc/kernel/uapi/linux/cxl_mem.h b/libc/kernel/uapi/linux/cxl_mem.h
index a0088266f..942e817f4 100644
--- a/libc/kernel/uapi/linux/cxl_mem.h
+++ b/libc/kernel/uapi/linux/cxl_mem.h
@@ -9,7 +9,7 @@
#include <linux/types.h>
#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
-#define CXL_CMDS ___C(INVALID, "Invalid Command"), ___C(IDENTIFY, "Identify Command"), ___C(RAW, "Raw device command"), ___C(GET_SUPPORTED_LOGS, "Get Supported Logs"), ___C(GET_FW_INFO, "Get FW Info"), ___C(GET_PARTITION_INFO, "Get Partition Information"), ___C(GET_LSA, "Get Label Storage Area"), ___C(GET_HEALTH_INFO, "Get Health Info"), ___C(GET_LOG, "Get Log"), ___C(SET_PARTITION_INFO, "Set Partition Information"), ___C(SET_LSA, "Set Label Storage Area"), ___C(GET_ALERT_CONFIG, "Get Alert Configuration"), ___C(SET_ALERT_CONFIG, "Set Alert Configuration"), ___C(GET_SHUTDOWN_STATE, "Get Shutdown State"), ___C(SET_SHUTDOWN_STATE, "Set Shutdown State"), ___DEPRECATED(GET_POISON, "Get Poison List"), ___DEPRECATED(INJECT_POISON, "Inject Poison"), ___DEPRECATED(CLEAR_POISON, "Clear Poison"), ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), ___DEPRECATED(SCAN_MEDIA, "Scan Media"), ___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"), ___C(MAX, "invalid / last command")
+#define CXL_CMDS ___C(INVALID, "Invalid Command"), ___C(IDENTIFY, "Identify Command"), ___C(RAW, "Raw device command"), ___C(GET_SUPPORTED_LOGS, "Get Supported Logs"), ___C(GET_FW_INFO, "Get FW Info"), ___C(GET_PARTITION_INFO, "Get Partition Information"), ___C(GET_LSA, "Get Label Storage Area"), ___C(GET_HEALTH_INFO, "Get Health Info"), ___C(GET_LOG, "Get Log"), ___C(SET_PARTITION_INFO, "Set Partition Information"), ___C(SET_LSA, "Set Label Storage Area"), ___C(GET_ALERT_CONFIG, "Get Alert Configuration"), ___C(SET_ALERT_CONFIG, "Set Alert Configuration"), ___C(GET_SHUTDOWN_STATE, "Get Shutdown State"), ___C(SET_SHUTDOWN_STATE, "Set Shutdown State"), ___DEPRECATED(GET_POISON, "Get Poison List"), ___DEPRECATED(INJECT_POISON, "Inject Poison"), ___DEPRECATED(CLEAR_POISON, "Clear Poison"), ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), ___DEPRECATED(SCAN_MEDIA, "Scan Media"), ___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"), ___C(GET_TIMESTAMP, "Get Timestamp"), ___C(MAX, "invalid / last command")
#define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a
#define ___DEPRECATED(a,b) CXL_MEM_DEPRECATED_ID_ ##a
enum {
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index bc44a70fe..968d6be44 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -97,6 +97,7 @@ enum devlink_command {
DEVLINK_CMD_LINECARD_DEL,
DEVLINK_CMD_SELFTESTS_GET,
DEVLINK_CMD_SELFTESTS_RUN,
+ DEVLINK_CMD_NOTIFY_FILTER_SET,
__DEVLINK_CMD_MAX,
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/dpll.h b/libc/kernel/uapi/linux/dpll.h
index 9b5f37ddc..cbefd15b9 100644
--- a/libc/kernel/uapi/linux/dpll.h
+++ b/libc/kernel/uapi/linux/dpll.h
@@ -98,6 +98,7 @@ enum dpll_a_pin {
DPLL_A_PIN_PHASE_ADJUST_MAX,
DPLL_A_PIN_PHASE_ADJUST,
DPLL_A_PIN_PHASE_OFFSET,
+ DPLL_A_PIN_FRACTIONAL_FREQUENCY_OFFSET,
__DPLL_A_PIN_MAX,
DPLL_A_PIN_MAX = (__DPLL_A_PIN_MAX - 1)
};
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 0d166afeb..e3466cfa1 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -433,7 +433,8 @@ struct ethtool_rxfh {
__u32 indir_size;
__u32 key_size;
__u8 hfunc;
- __u8 rsvd8[3];
+ __u8 input_xfrm;
+ __u8 rsvd8[2];
__u32 rsvd32;
__u32 rss_config[];
};
@@ -857,6 +858,8 @@ enum ethtool_link_mode_bit_indices {
#define WAKE_MAGICSECURE (1 << 6)
#define WAKE_FILTER (1 << 7)
#define WOL_MODE_COUNT 8
+#define RXH_XFRM_SYM_XOR (1 << 0)
+#define RXH_XFRM_NO_CHANGE 0xff
#define TCP_V4_FLOW 0x01
#define UDP_V4_FLOW 0x02
#define SCTP_V4_FLOW 0x03
diff --git a/libc/kernel/uapi/linux/ethtool_netlink.h b/libc/kernel/uapi/linux/ethtool_netlink.h
index c5012d241..e4fc40e65 100644
--- a/libc/kernel/uapi/linux/ethtool_netlink.h
+++ b/libc/kernel/uapi/linux/ethtool_netlink.h
@@ -638,6 +638,7 @@ enum {
ETHTOOL_A_RSS_HFUNC,
ETHTOOL_A_RSS_INDIR,
ETHTOOL_A_RSS_HKEY,
+ ETHTOOL_A_RSS_INPUT_XFRM,
__ETHTOOL_A_RSS_CNT,
ETHTOOL_A_RSS_MAX = (__ETHTOOL_A_RSS_CNT - 1),
};
diff --git a/libc/kernel/uapi/linux/fs.h b/libc/kernel/uapi/linux/fs.h
index 9288653d7..f1a8eacb0 100644
--- a/libc/kernel/uapi/linux/fs.h
+++ b/libc/kernel/uapi/linux/fs.h
@@ -192,6 +192,7 @@ typedef int __bitwise __kernel_rwf_t;
#define PAGE_IS_SWAPPED (1 << 4)
#define PAGE_IS_PFNZERO (1 << 5)
#define PAGE_IS_HUGE (1 << 6)
+#define PAGE_IS_SOFT_DIRTY (1 << 7)
struct page_region {
__u64 start;
__u64 end;
diff --git a/libc/kernel/uapi/linux/if_bridge.h b/libc/kernel/uapi/linux/if_bridge.h
index a7388767d..97c0fb69d 100644
--- a/libc/kernel/uapi/linux/if_bridge.h
+++ b/libc/kernel/uapi/linux/if_bridge.h
@@ -587,6 +587,7 @@ enum {
MDBE_ATTR_VNI,
MDBE_ATTR_IFINDEX,
MDBE_ATTR_SRC_VNI,
+ MDBE_ATTR_STATE_MASK,
__MDBE_ATTR_MAX,
};
#define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 54b751e8b..19bbfa10b 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -536,6 +536,7 @@ enum {
IFLA_VXLAN_DF,
IFLA_VXLAN_VNIFILTER,
IFLA_VXLAN_LOCALBYPASS,
+ IFLA_VXLAN_LABEL_POLICY,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -550,6 +551,12 @@ enum ifla_vxlan_df {
__VXLAN_DF_END,
VXLAN_DF_MAX = __VXLAN_DF_END - 1,
};
+enum ifla_vxlan_label_policy {
+ VXLAN_LABEL_FIXED = 0,
+ VXLAN_LABEL_INHERIT = 1,
+ __VXLAN_LABEL_END,
+ VXLAN_LABEL_MAX = __VXLAN_LABEL_END - 1,
+};
enum {
IFLA_GENEVE_UNSPEC,
IFLA_GENEVE_ID,
diff --git a/libc/kernel/uapi/linux/if_xdp.h b/libc/kernel/uapi/linux/if_xdp.h
index 02a014ac6..b7eec87cb 100644
--- a/libc/kernel/uapi/linux/if_xdp.h
+++ b/libc/kernel/uapi/linux/if_xdp.h
@@ -13,6 +13,7 @@
#define XDP_USE_NEED_WAKEUP (1 << 3)
#define XDP_USE_SG (1 << 4)
#define XDP_UMEM_UNALIGNED_CHUNK_FLAG (1 << 0)
+#define XDP_UMEM_TX_SW_CSUM (1 << 1)
struct sockaddr_xdp {
__u16 sxdp_family;
__u16 sxdp_flags;
@@ -47,6 +48,7 @@ struct xdp_umem_reg {
__u32 chunk_size;
__u32 headroom;
__u32 flags;
+ __u32 tx_metadata_len;
};
struct xdp_statistics {
__u64 rx_dropped;
@@ -66,10 +68,25 @@ struct xdp_options {
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
#define XSK_UNALIGNED_BUF_OFFSET_SHIFT 48
#define XSK_UNALIGNED_BUF_ADDR_MASK ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1)
+#define XDP_TXMD_FLAGS_TIMESTAMP (1 << 0)
+#define XDP_TXMD_FLAGS_CHECKSUM (1 << 1)
+struct xsk_tx_metadata {
+ __u64 flags;
+ union {
+ struct {
+ __u16 csum_start;
+ __u16 csum_offset;
+ } request;
+ struct {
+ __u64 tx_timestamp;
+ } completion;
+ };
+};
struct xdp_desc {
__u64 addr;
__u32 len;
__u32 options;
};
#define XDP_PKT_CONTD (1 << 0)
+#define XDP_TX_METADATA (1 << 1)
#endif
diff --git a/libc/kernel/uapi/linux/iio/types.h b/libc/kernel/uapi/linux/iio/types.h
index 4e4324aac..f40cb95ba 100644
--- a/libc/kernel/uapi/linux/iio/types.h
+++ b/libc/kernel/uapi/linux/iio/types.h
@@ -99,6 +99,8 @@ enum iio_modifier {
IIO_MOD_PITCH,
IIO_MOD_YAW,
IIO_MOD_ROLL,
+ IIO_MOD_LIGHT_UVA,
+ IIO_MOD_LIGHT_UVB,
};
enum iio_event_type {
IIO_EV_TYPE_THRESH,
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index 57c6405b7..27675d5eb 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -58,6 +58,7 @@ struct io_uring_sqe {
__u32 uring_cmd_flags;
__u32 waitid_flags;
__u32 futex_flags;
+ __u32 install_fd_flags;
};
__u64 user_data;
union {
@@ -172,6 +173,7 @@ enum io_uring_op {
IORING_OP_FUTEX_WAIT,
IORING_OP_FUTEX_WAKE,
IORING_OP_FUTEX_WAITV,
+ IORING_OP_FIXED_FD_INSTALL,
IORING_OP_LAST,
};
#define IORING_URING_CMD_FIXED (1U << 0)
@@ -209,6 +211,7 @@ enum {
};
#define IORING_MSG_RING_CQE_SKIP (1U << 0)
#define IORING_MSG_RING_FLAGS_PASS (1U << 1)
+#define IORING_FIXED_FD_NO_CLOEXEC (1U << 0)
struct io_uring_cqe {
__u64 user_data;
__s32 res;
@@ -312,6 +315,7 @@ enum {
IORING_UNREGISTER_PBUF_RING = 23,
IORING_REGISTER_SYNC_CANCEL = 24,
IORING_REGISTER_FILE_ALLOC_RANGE = 25,
+ IORING_REGISTER_PBUF_STATUS = 26,
IORING_REGISTER_LAST,
IORING_REGISTER_USE_REGISTERED_RING = 1U << 31
};
@@ -397,6 +401,11 @@ struct io_uring_buf_reg {
__u16 flags;
__u64 resv[3];
};
+struct io_uring_buf_status {
+ __u32 buf_group;
+ __u32 head;
+ __u32 resv[8];
+};
enum {
IORING_RESTRICTION_REGISTER_OP = 0,
IORING_RESTRICTION_SQE_OP = 1,
diff --git a/libc/kernel/uapi/linux/iommufd.h b/libc/kernel/uapi/linux/iommufd.h
index d19a471e5..257062881 100644
--- a/libc/kernel/uapi/linux/iommufd.h
+++ b/libc/kernel/uapi/linux/iommufd.h
@@ -24,6 +24,7 @@ enum {
IOMMUFD_CMD_GET_HW_INFO,
IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING,
IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP,
+ IOMMUFD_CMD_HWPT_INVALIDATE,
};
struct iommu_destroy {
__u32 size;
@@ -200,4 +201,26 @@ struct iommu_hwpt_get_dirty_bitmap {
__aligned_u64 data;
};
#define IOMMU_HWPT_GET_DIRTY_BITMAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP)
+enum iommu_hwpt_invalidate_data_type {
+ IOMMU_HWPT_INVALIDATE_DATA_VTD_S1,
+};
+enum iommu_hwpt_vtd_s1_invalidate_flags {
+ IOMMU_VTD_INV_FLAGS_LEAF = 1 << 0,
+};
+struct iommu_hwpt_vtd_s1_invalidate {
+ __aligned_u64 addr;
+ __aligned_u64 npages;
+ __u32 flags;
+ __u32 __reserved;
+};
+struct iommu_hwpt_invalidate {
+ __u32 size;
+ __u32 hwpt_id;
+ __aligned_u64 data_uptr;
+ __u32 data_type;
+ __u32 entry_len;
+ __u32 entry_num;
+ __u32 __reserved;
+};
+#define IOMMU_HWPT_INVALIDATE _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_INVALIDATE)
#endif
diff --git a/libc/kernel/uapi/linux/kexec.h b/libc/kernel/uapi/linux/kexec.h
index 53c86f3e6..c5c862346 100644
--- a/libc/kernel/uapi/linux/kexec.h
+++ b/libc/kernel/uapi/linux/kexec.h
@@ -14,6 +14,7 @@
#define KEXEC_FILE_UNLOAD 0x00000001
#define KEXEC_FILE_ON_CRASH 0x00000002
#define KEXEC_FILE_NO_INITRAMFS 0x00000004
+#define KEXEC_FILE_DEBUG 0x00000008
#define KEXEC_ARCH_DEFAULT (0 << 16)
#define KEXEC_ARCH_386 (3 << 16)
#define KEXEC_ARCH_68K (4 << 16)
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 2a89638fc..ea4f7695b 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -12,59 +12,6 @@
#include <linux/ioctl.h>
#include <asm/kvm.h>
#define KVM_API_VERSION 12
-#define KVM_TRC_SHIFT 16
-#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
-#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1))
-#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
-#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
-#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
-#define KVM_TRC_HEAD_SIZE 12
-#define KVM_TRC_CYCLE_SIZE 8
-#define KVM_TRC_EXTRA_MAX 7
-#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
-#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
-#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
-#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
-#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
-#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
-#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
-#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
-#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
-#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
-#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
-#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
-#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
-#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
-#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
-#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
-#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
-#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
-#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
-#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
-#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
-#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
-#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
-#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
-struct kvm_user_trace_setup {
- __u32 buf_size;
- __u32 buf_nr;
-};
-#define __KVM_DEPRECATED_MAIN_W_0x06 _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
-#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07)
-#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08)
-#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq)
-struct kvm_breakpoint {
- __u32 enabled;
- __u32 padding;
- __u64 address;
-};
-struct kvm_debug_guest {
- __u32 enabled;
- __u32 pad;
- struct kvm_breakpoint breakpoints[4];
- __u32 singlestep;
-};
-#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
struct kvm_userspace_memory_region {
__u32 slot;
__u32 flags;
@@ -72,8 +19,20 @@ struct kvm_userspace_memory_region {
__u64 memory_size;
__u64 userspace_addr;
};
+struct kvm_userspace_memory_region2 {
+ __u32 slot;
+ __u32 flags;
+ __u64 guest_phys_addr;
+ __u64 memory_size;
+ __u64 userspace_addr;
+ __u64 guest_memfd_offset;
+ __u32 guest_memfd;
+ __u32 pad1;
+ __u64 pad2[14];
+};
#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
#define KVM_MEM_READONLY (1UL << 1)
+#define KVM_MEM_GUEST_MEMFD (1UL << 2)
struct kvm_irq_level {
union {
__u32 irq;
@@ -201,6 +160,7 @@ struct kvm_xen_exit {
#define KVM_EXIT_RISCV_CSR 36
#define KVM_EXIT_NOTIFY 37
#define KVM_EXIT_LOONGARCH_IOCSR 38
+#define KVM_EXIT_MEMORY_FAULT 39
#define KVM_INTERNAL_ERROR_EMULATION 1
#define KVM_INTERNAL_ERROR_SIMUL_EX 2
#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
@@ -383,6 +343,12 @@ struct kvm_run {
#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
__u32 flags;
} notify;
+ struct {
+#define KVM_MEMORY_EXIT_FLAG_PRIVATE (1ULL << 3)
+ __u64 flags;
+ __u64 gpa;
+ __u64 size;
+ } memory_fault;
char padding[256];
};
#define SYNC_REGS_SIZE_BYTES 2048
@@ -683,9 +649,6 @@ struct kvm_ppc_resize_hpt {
#define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04)
#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
-#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
-#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
-#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
#define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
#define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
#define KVM_CAP_IRQCHIP 0
@@ -933,6 +896,11 @@ struct kvm_ppc_resize_hpt {
#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
#define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
+#define KVM_CAP_USER_MEMORY2 231
+#define KVM_CAP_MEMORY_FAULT_INFO 232
+#define KVM_CAP_MEMORY_ATTRIBUTES 233
+#define KVM_CAP_GUEST_MEMFD 234
+#define KVM_CAP_VM_TYPES 235
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_irqchip {
__u32 irqchip;
@@ -1008,6 +976,7 @@ struct kvm_x86_mce {
#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
+#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE (1 << 7)
struct kvm_xen_hvm_config {
__u32 flags;
__u32 msr;
@@ -1148,6 +1117,7 @@ struct kvm_vfio_spapr_tce {
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region)
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
+#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, struct kvm_userspace_memory_region2)
struct kvm_s390_ucas_mapping {
__u64 user_addr;
__u64 vcpu_addr;
@@ -1166,15 +1136,8 @@ struct kvm_s390_ucas_mapping {
#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
#define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
#define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
-#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, struct kvm_assigned_pci_dev)
#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
-#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
-#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
-#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, struct kvm_assigned_pci_dev)
-#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr)
-#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
-#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
@@ -1187,7 +1150,6 @@ struct kvm_s390_ucas_mapping {
#define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
#define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
#define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
-#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev)
#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
@@ -1218,7 +1180,6 @@ struct kvm_s390_ucas_mapping {
#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
-#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
@@ -1679,4 +1640,18 @@ struct kvm_s390_zpci_op {
#define KVM_S390_ZPCIOP_REG_AEN 0
#define KVM_S390_ZPCIOP_DEREG_AEN 1
#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
+#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd2, struct kvm_memory_attributes)
+struct kvm_memory_attributes {
+ __u64 address;
+ __u64 size;
+ __u64 attributes;
+ __u64 flags;
+};
+#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
+#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
+struct kvm_create_guest_memfd {
+ __u64 size;
+ __u64 flags;
+ __u64 reserved[6];
+};
#endif
diff --git a/libc/kernel/uapi/linux/lsm.h b/libc/kernel/uapi/linux/lsm.h
new file mode 100644
index 000000000..9d538ee19
--- /dev/null
+++ b/libc/kernel/uapi/linux/lsm.h
@@ -0,0 +1,39 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef _UAPI_LINUX_LSM_H
+#define _UAPI_LINUX_LSM_H
+#include <linux/stddef.h>
+#include <linux/types.h>
+#include <linux/unistd.h>
+struct lsm_ctx {
+ __u64 id;
+ __u64 flags;
+ __u64 len;
+ __u64 ctx_len;
+ __u8 ctx[] __counted_by(ctx_len);
+};
+#define LSM_ID_UNDEF 0
+#define LSM_ID_CAPABILITY 100
+#define LSM_ID_SELINUX 101
+#define LSM_ID_SMACK 102
+#define LSM_ID_TOMOYO 103
+#define LSM_ID_APPARMOR 104
+#define LSM_ID_YAMA 105
+#define LSM_ID_LOADPIN 106
+#define LSM_ID_SAFESETID 107
+#define LSM_ID_LOCKDOWN 108
+#define LSM_ID_BPF 109
+#define LSM_ID_LANDLOCK 110
+#define LSM_ATTR_UNDEF 0
+#define LSM_ATTR_CURRENT 100
+#define LSM_ATTR_EXEC 101
+#define LSM_ATTR_FSCREATE 102
+#define LSM_ATTR_KEYCREATE 103
+#define LSM_ATTR_PREV 104
+#define LSM_ATTR_SOCKCREATE 105
+#define LSM_FLAG_SINGLE 0x0001
+#endif
diff --git a/libc/kernel/uapi/linux/mount.h b/libc/kernel/uapi/linux/mount.h
index faef8afc4..1166a7a3b 100644
--- a/libc/kernel/uapi/linux/mount.h
+++ b/libc/kernel/uapi/linux/mount.h
@@ -88,4 +88,41 @@ struct mount_attr {
__u64 userns_fd;
};
#define MOUNT_ATTR_SIZE_VER0 32
+struct statmount {
+ __u32 size;
+ __u32 __spare1;
+ __u64 mask;
+ __u32 sb_dev_major;
+ __u32 sb_dev_minor;
+ __u64 sb_magic;
+ __u32 sb_flags;
+ __u32 fs_type;
+ __u64 mnt_id;
+ __u64 mnt_parent_id;
+ __u32 mnt_id_old;
+ __u32 mnt_parent_id_old;
+ __u64 mnt_attr;
+ __u64 mnt_propagation;
+ __u64 mnt_peer_group;
+ __u64 mnt_master;
+ __u64 propagate_from;
+ __u32 mnt_root;
+ __u32 mnt_point;
+ __u64 __spare2[50];
+ char str[];
+};
+struct mnt_id_req {
+ __u32 size;
+ __u32 spare;
+ __u64 mnt_id;
+ __u64 param;
+};
+#define MNT_ID_REQ_SIZE_VER0 24
+#define STATMOUNT_SB_BASIC 0x00000001U
+#define STATMOUNT_MNT_BASIC 0x00000002U
+#define STATMOUNT_PROPAGATE_FROM 0x00000004U
+#define STATMOUNT_MNT_ROOT 0x00000008U
+#define STATMOUNT_MNT_POINT 0x00000010U
+#define STATMOUNT_FS_TYPE 0x00000020U
+#define LSMT_ROOT 0xffffffffffffffff
#endif
diff --git a/libc/kernel/uapi/linux/mptcp.h b/libc/kernel/uapi/linux/mptcp.h
index 6f5d27247..3c9ba5ee4 100644
--- a/libc/kernel/uapi/linux/mptcp.h
+++ b/libc/kernel/uapi/linux/mptcp.h
@@ -52,6 +52,7 @@ struct mptcp_info {
__u64 mptcpi_bytes_sent;
__u64 mptcpi_bytes_received;
__u64 mptcpi_bytes_acked;
+ __u8 mptcpi_subflows_total;
};
#define MPTCP_RST_EUNSPEC 0
#define MPTCP_RST_EMPTCP 1
diff --git a/libc/kernel/uapi/linux/netdev.h b/libc/kernel/uapi/linux/netdev.h
index 3c5cb9446..6d90ae41e 100644
--- a/libc/kernel/uapi/linux/netdev.h
+++ b/libc/kernel/uapi/linux/netdev.h
@@ -21,7 +21,15 @@ enum netdev_xdp_act {
enum netdev_xdp_rx_metadata {
NETDEV_XDP_RX_METADATA_TIMESTAMP = 1,
NETDEV_XDP_RX_METADATA_HASH = 2,
- NETDEV_XDP_RX_METADATA_MASK = 3,
+ NETDEV_XDP_RX_METADATA_VLAN_TAG = 4,
+};
+enum netdev_xsk_flags {
+ NETDEV_XSK_FLAGS_TX_TIMESTAMP = 1,
+ NETDEV_XSK_FLAGS_TX_CHECKSUM = 2,
+};
+enum netdev_queue_type {
+ NETDEV_QUEUE_TYPE_RX,
+ NETDEV_QUEUE_TYPE_TX,
};
enum {
NETDEV_A_DEV_IFINDEX = 1,
@@ -29,16 +37,67 @@ enum {
NETDEV_A_DEV_XDP_FEATURES,
NETDEV_A_DEV_XDP_ZC_MAX_SEGS,
NETDEV_A_DEV_XDP_RX_METADATA_FEATURES,
+ NETDEV_A_DEV_XSK_FEATURES,
__NETDEV_A_DEV_MAX,
NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1)
};
enum {
+ NETDEV_A_PAGE_POOL_ID = 1,
+ NETDEV_A_PAGE_POOL_IFINDEX,
+ NETDEV_A_PAGE_POOL_NAPI_ID,
+ NETDEV_A_PAGE_POOL_INFLIGHT,
+ NETDEV_A_PAGE_POOL_INFLIGHT_MEM,
+ NETDEV_A_PAGE_POOL_DETACH_TIME,
+ __NETDEV_A_PAGE_POOL_MAX,
+ NETDEV_A_PAGE_POOL_MAX = (__NETDEV_A_PAGE_POOL_MAX - 1)
+};
+enum {
+ NETDEV_A_PAGE_POOL_STATS_INFO = 1,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_FAST = 8,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_SLOW,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_SLOW_HIGH_ORDER,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_EMPTY,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_REFILL,
+ NETDEV_A_PAGE_POOL_STATS_ALLOC_WAIVE,
+ NETDEV_A_PAGE_POOL_STATS_RECYCLE_CACHED,
+ NETDEV_A_PAGE_POOL_STATS_RECYCLE_CACHE_FULL,
+ NETDEV_A_PAGE_POOL_STATS_RECYCLE_RING,
+ NETDEV_A_PAGE_POOL_STATS_RECYCLE_RING_FULL,
+ NETDEV_A_PAGE_POOL_STATS_RECYCLE_RELEASED_REFCNT,
+ __NETDEV_A_PAGE_POOL_STATS_MAX,
+ NETDEV_A_PAGE_POOL_STATS_MAX = (__NETDEV_A_PAGE_POOL_STATS_MAX - 1)
+};
+enum {
+ NETDEV_A_NAPI_IFINDEX = 1,
+ NETDEV_A_NAPI_ID,
+ NETDEV_A_NAPI_IRQ,
+ NETDEV_A_NAPI_PID,
+ __NETDEV_A_NAPI_MAX,
+ NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
+};
+enum {
+ NETDEV_A_QUEUE_ID = 1,
+ NETDEV_A_QUEUE_IFINDEX,
+ NETDEV_A_QUEUE_TYPE,
+ NETDEV_A_QUEUE_NAPI_ID,
+ __NETDEV_A_QUEUE_MAX,
+ NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)
+};
+enum {
NETDEV_CMD_DEV_GET = 1,
NETDEV_CMD_DEV_ADD_NTF,
NETDEV_CMD_DEV_DEL_NTF,
NETDEV_CMD_DEV_CHANGE_NTF,
+ NETDEV_CMD_PAGE_POOL_GET,
+ NETDEV_CMD_PAGE_POOL_ADD_NTF,
+ NETDEV_CMD_PAGE_POOL_DEL_NTF,
+ NETDEV_CMD_PAGE_POOL_CHANGE_NTF,
+ NETDEV_CMD_PAGE_POOL_STATS_GET,
+ NETDEV_CMD_QUEUE_GET,
+ NETDEV_CMD_NAPI_GET,
__NETDEV_CMD_MAX,
NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)
};
#define NETDEV_MCGRP_MGMT "mgmt"
+#define NETDEV_MCGRP_PAGE_POOL "page-pool"
#endif
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index 1d0af179e..2216fa8bf 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -157,6 +157,7 @@ enum nft_rule_attributes {
};
#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
enum nft_rule_compat_flags {
+ NFT_RULE_COMPAT_F_UNUSED = (1 << 0),
NFT_RULE_COMPAT_F_INV = (1 << 1),
NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
};
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index bf87c0ed9..3286d9b39 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -180,6 +180,7 @@ enum nl80211_commands {
NL80211_CMD_REMOVE_LINK_STA,
NL80211_CMD_SET_HW_TIMESTAMP,
NL80211_CMD_LINKS_REMOVED,
+ NL80211_CMD_SET_TID_TO_LINK_MAPPING,
__NL80211_CMD_AFTER_LAST,
NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
};
@@ -523,6 +524,9 @@ enum nl80211_attrs {
NL80211_ATTR_HW_TIMESTAMP_ENABLED,
NL80211_ATTR_EMA_RNR_ELEMS,
NL80211_ATTR_MLO_LINK_DISABLED,
+ NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA,
+ NL80211_ATTR_MLO_TTLM_DLINK,
+ NL80211_ATTR_MLO_TTLM_ULINK,
__NL80211_ATTR_AFTER_LAST,
NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -868,6 +872,9 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_NO_320MHZ,
NL80211_FREQUENCY_ATTR_NO_EHT,
NL80211_FREQUENCY_ATTR_PSD,
+ NL80211_FREQUENCY_ATTR_DFS_CONCURRENT,
+ NL80211_FREQUENCY_ATTR_NO_UHB_VLP_CLIENT,
+ NL80211_FREQUENCY_ATTR_NO_UHB_AFC_CLIENT,
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
};
@@ -940,6 +947,9 @@ enum nl80211_reg_rule_flags {
NL80211_RRF_NO_320MHZ = 1 << 18,
NL80211_RRF_NO_EHT = 1 << 19,
NL80211_RRF_PSD = 1 << 20,
+ NL80211_RRF_DFS_CONCURRENT = 1 << 21,
+ NL80211_RRF_NO_UHB_VLP_CLIENT = 1 << 22,
+ NL80211_RRF_NO_UHB_AFC_CLIENT = 1 << 23,
};
#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
@@ -1104,6 +1114,14 @@ enum nl80211_bss_scan_width {
NL80211_BSS_CHAN_WIDTH_1,
NL80211_BSS_CHAN_WIDTH_2,
};
+enum nl80211_bss_use_for {
+ NL80211_BSS_USE_FOR_NORMAL = 1 << 0,
+ NL80211_BSS_USE_FOR_MLD_LINK = 1 << 1,
+};
+enum nl80211_bss_cannot_use_reasons {
+ NL80211_BSS_CANNOT_USE_NSTR_NONPRIMARY = 1 << 0,
+ NL80211_BSS_CANNOT_USE_UHB_PWR_MISMATCH = 1 << 1,
+};
enum nl80211_bss {
__NL80211_BSS_INVALID,
NL80211_BSS_BSSID,
@@ -1128,6 +1146,8 @@ enum nl80211_bss {
NL80211_BSS_FREQUENCY_OFFSET,
NL80211_BSS_MLO_LINK_ID,
NL80211_BSS_MLD_ADDR,
+ NL80211_BSS_USE_FOR,
+ NL80211_BSS_CANNOT_USE_REASONS,
__NL80211_BSS_AFTER_LAST,
NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
};
@@ -1547,6 +1567,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_AUTH_AND_DEAUTH_RANDOM_TA,
NL80211_EXT_FEATURE_OWE_OFFLOAD,
NL80211_EXT_FEATURE_OWE_OFFLOAD_AP,
+ NL80211_EXT_FEATURE_DFS_CONCURRENT,
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
};
diff --git a/libc/kernel/uapi/linux/nsm.h b/libc/kernel/uapi/linux/nsm.h
new file mode 100644
index 000000000..5c8e27d7c
--- /dev/null
+++ b/libc/kernel/uapi/linux/nsm.h
@@ -0,0 +1,23 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef __UAPI_LINUX_NSM_H
+#define __UAPI_LINUX_NSM_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#define NSM_MAGIC 0x0A
+#define NSM_REQUEST_MAX_SIZE 0x1000
+#define NSM_RESPONSE_MAX_SIZE 0x3000
+struct nsm_iovec {
+ __u64 addr;
+ __u64 len;
+};
+struct nsm_raw {
+ struct nsm_iovec request;
+ struct nsm_iovec response;
+};
+#define NSM_IOCTL_RAW _IOWR(NSM_MAGIC, 0x0, struct nsm_raw)
+#endif
diff --git a/libc/kernel/uapi/linux/pcitest.h b/libc/kernel/uapi/linux/pcitest.h
index 2e8e761f1..38e498d64 100644
--- a/libc/kernel/uapi/linux/pcitest.h
+++ b/libc/kernel/uapi/linux/pcitest.h
@@ -7,7 +7,8 @@
#ifndef __UAPI_LINUX_PCITEST_H
#define __UAPI_LINUX_PCITEST_H
#define PCITEST_BAR _IO('P', 0x1)
-#define PCITEST_LEGACY_IRQ _IO('P', 0x2)
+#define PCITEST_INTX_IRQ _IO('P', 0x2)
+#define PCITEST_LEGACY_IRQ PCITEST_INTX_IRQ
#define PCITEST_MSI _IOW('P', 0x3, int)
#define PCITEST_WRITE _IOW('P', 0x4, unsigned long)
#define PCITEST_READ _IOW('P', 0x5, unsigned long)
diff --git a/libc/kernel/uapi/linux/perf_event.h b/libc/kernel/uapi/linux/perf_event.h
index 4b01018a8..16a1a2e3d 100644
--- a/libc/kernel/uapi/linux/perf_event.h
+++ b/libc/kernel/uapi/linux/perf_event.h
@@ -118,6 +118,7 @@ enum perf_branch_sample_type_shift {
PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16,
PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17,
PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT = 18,
+ PERF_SAMPLE_BRANCH_COUNTERS_SHIFT = 19,
PERF_SAMPLE_BRANCH_MAX_SHIFT
};
enum perf_branch_sample_type {
@@ -140,6 +141,7 @@ enum perf_branch_sample_type {
PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
PERF_SAMPLE_BRANCH_PRIV_SAVE = 1U << PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT,
+ PERF_SAMPLE_BRANCH_COUNTERS = 1U << PERF_SAMPLE_BRANCH_COUNTERS_SHIFT,
PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
};
enum {
@@ -502,6 +504,7 @@ struct perf_branch_entry {
__u64 to;
__u64 mispred : 1, predicted : 1, in_tx : 1, abort : 1, cycles : 16, type : 4, spec : 2, new_type : 4, priv : 3, reserved : 31;
};
+#define PERF_BRANCH_ENTRY_INFO_BITS_MAX 33
union perf_sample_weight {
__u64 full;
#ifdef __LITTLE_ENDIAN_BITFIELD
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index 8ea50d47b..b402fa6b8 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -205,30 +205,6 @@ struct tc_u32_pcnt {
#define TC_U32_EAT 8
#define TC_U32_MAXDEPTH 8
enum {
- TCA_RSVP_UNSPEC,
- TCA_RSVP_CLASSID,
- TCA_RSVP_DST,
- TCA_RSVP_SRC,
- TCA_RSVP_PINFO,
- TCA_RSVP_POLICE,
- TCA_RSVP_ACT,
- __TCA_RSVP_MAX
-};
-#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1)
-struct tc_rsvp_gpi {
- __u32 key;
- __u32 mask;
- int offset;
-};
-struct tc_rsvp_pinfo {
- struct tc_rsvp_gpi dpi;
- struct tc_rsvp_gpi spi;
- __u8 protocol;
- __u8 tunnelid;
- __u8 tunnelhdr;
- __u8 pad;
-};
-enum {
TCA_ROUTE4_UNSPEC,
TCA_ROUTE4_CLASSID,
TCA_ROUTE4_TO,
@@ -250,18 +226,6 @@ enum {
};
#define TCA_FW_MAX (__TCA_FW_MAX - 1)
enum {
- TCA_TCINDEX_UNSPEC,
- TCA_TCINDEX_HASH,
- TCA_TCINDEX_MASK,
- TCA_TCINDEX_SHIFT,
- TCA_TCINDEX_FALL_THROUGH,
- TCA_TCINDEX_CLASSID,
- TCA_TCINDEX_POLICE,
- TCA_TCINDEX_ACT,
- __TCA_TCINDEX_MAX
-};
-#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1)
-enum {
FLOW_KEY_SRC,
FLOW_KEY_DST,
FLOW_KEY_PROTO,
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index 9047c8e50..c3488c26f 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -327,95 +327,6 @@ enum {
__TCA_HFSC_MAX,
};
#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1)
-#define TC_CBQ_MAXPRIO 8
-#define TC_CBQ_MAXLEVEL 8
-#define TC_CBQ_DEF_EWMA 5
-struct tc_cbq_lssopt {
- unsigned char change;
- unsigned char flags;
-#define TCF_CBQ_LSS_BOUNDED 1
-#define TCF_CBQ_LSS_ISOLATED 2
- unsigned char ewma_log;
- unsigned char level;
-#define TCF_CBQ_LSS_FLAGS 1
-#define TCF_CBQ_LSS_EWMA 2
-#define TCF_CBQ_LSS_MAXIDLE 4
-#define TCF_CBQ_LSS_MINIDLE 8
-#define TCF_CBQ_LSS_OFFTIME 0x10
-#define TCF_CBQ_LSS_AVPKT 0x20
- __u32 maxidle;
- __u32 minidle;
- __u32 offtime;
- __u32 avpkt;
-};
-struct tc_cbq_wrropt {
- unsigned char flags;
- unsigned char priority;
- unsigned char cpriority;
- unsigned char __reserved;
- __u32 allot;
- __u32 weight;
-};
-struct tc_cbq_ovl {
- unsigned char strategy;
-#define TC_CBQ_OVL_CLASSIC 0
-#define TC_CBQ_OVL_DELAY 1
-#define TC_CBQ_OVL_LOWPRIO 2
-#define TC_CBQ_OVL_DROP 3
-#define TC_CBQ_OVL_RCLASSIC 4
- unsigned char priority2;
- __u16 pad;
- __u32 penalty;
-};
-struct tc_cbq_police {
- unsigned char police;
- unsigned char __res1;
- unsigned short __res2;
-};
-struct tc_cbq_fopt {
- __u32 split;
- __u32 defmap;
- __u32 defchange;
-};
-struct tc_cbq_xstats {
- __u32 borrows;
- __u32 overactions;
- __s32 avgidle;
- __s32 undertime;
-};
-enum {
- TCA_CBQ_UNSPEC,
- TCA_CBQ_LSSOPT,
- TCA_CBQ_WRROPT,
- TCA_CBQ_FOPT,
- TCA_CBQ_OVL_STRATEGY,
- TCA_CBQ_RATE,
- TCA_CBQ_RTAB,
- TCA_CBQ_POLICE,
- __TCA_CBQ_MAX,
-};
-#define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1)
-enum {
- TCA_DSMARK_UNSPEC,
- TCA_DSMARK_INDICES,
- TCA_DSMARK_DEFAULT_INDEX,
- TCA_DSMARK_SET_TC_INDEX,
- TCA_DSMARK_MASK,
- TCA_DSMARK_VALUE,
- __TCA_DSMARK_MAX,
-};
-#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1)
-enum {
- TCA_ATM_UNSPEC,
- TCA_ATM_FD,
- TCA_ATM_PTR,
- TCA_ATM_HDR,
- TCA_ATM_EXCESS,
- TCA_ATM_ADDR,
- TCA_ATM_STATE,
- __TCA_ATM_MAX,
-};
-#define TCA_ATM_MAX (__TCA_ATM_MAX - 1)
enum {
TCA_NETEM_UNSPEC,
TCA_NETEM_CORR,
diff --git a/libc/kernel/uapi/linux/raid/md_u.h b/libc/kernel/uapi/linux/raid/md_u.h
index f5ae289e5..f291f649a 100644
--- a/libc/kernel/uapi/linux/raid/md_u.h
+++ b/libc/kernel/uapi/linux/raid/md_u.h
@@ -57,9 +57,6 @@ typedef struct mdu_array_info_s {
int layout;
int chunk_size;
} mdu_array_info_t;
-#define LEVEL_MULTIPATH (- 4)
-#define LEVEL_LINEAR (- 1)
-#define LEVEL_FAULTY (- 5)
#define LEVEL_NONE (- 1000000)
typedef struct mdu_disk_info_s {
int number;
diff --git a/libc/kernel/uapi/linux/resource.h b/libc/kernel/uapi/linux/resource.h
index e64c79e1a..05e201b2f 100644
--- a/libc/kernel/uapi/linux/resource.h
+++ b/libc/kernel/uapi/linux/resource.h
@@ -6,7 +6,7 @@
*/
#ifndef _UAPI_LINUX_RESOURCE_H
#define _UAPI_LINUX_RESOURCE_H
-#include <linux/time.h>
+#include <linux/time_types.h>
#include <linux/types.h>
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN (- 1)
diff --git a/libc/kernel/uapi/linux/serial.h b/libc/kernel/uapi/linux/serial.h
index adbdd1bb0..ed5ed6640 100644
--- a/libc/kernel/uapi/linux/serial.h
+++ b/libc/kernel/uapi/linux/serial.h
@@ -6,6 +6,7 @@
*/
#ifndef _UAPI_LINUX_SERIAL_H
#define _UAPI_LINUX_SERIAL_H
+#include <linux/const.h>
#include <linux/types.h>
#include <linux/tty_flags.h>
struct serial_struct {
@@ -79,14 +80,15 @@ struct serial_icounter_struct {
};
struct serial_rs485 {
__u32 flags;
-#define SER_RS485_ENABLED (1 << 0)
-#define SER_RS485_RTS_ON_SEND (1 << 1)
-#define SER_RS485_RTS_AFTER_SEND (1 << 2)
-#define SER_RS485_RX_DURING_TX (1 << 4)
-#define SER_RS485_TERMINATE_BUS (1 << 5)
-#define SER_RS485_ADDRB (1 << 6)
-#define SER_RS485_ADDR_RECV (1 << 7)
-#define SER_RS485_ADDR_DEST (1 << 8)
+#define SER_RS485_ENABLED _BITUL(0)
+#define SER_RS485_RTS_ON_SEND _BITUL(1)
+#define SER_RS485_RTS_AFTER_SEND _BITUL(2)
+#define SER_RS485_RX_DURING_TX _BITUL(4)
+#define SER_RS485_TERMINATE_BUS _BITUL(5)
+#define SER_RS485_ADDRB _BITUL(6)
+#define SER_RS485_ADDR_RECV _BITUL(7)
+#define SER_RS485_ADDR_DEST _BITUL(8)
+#define SER_RS485_MODE_RS422 _BITUL(9)
__u32 delay_rts_before_send;
__u32 delay_rts_after_send;
union {
diff --git a/libc/kernel/uapi/linux/smc.h b/libc/kernel/uapi/linux/smc.h
index 4521cebe1..5e75fac0e 100644
--- a/libc/kernel/uapi/linux/smc.h
+++ b/libc/kernel/uapi/linux/smc.h
@@ -132,6 +132,8 @@ enum {
SMC_NLA_LGR_D_CHID,
SMC_NLA_LGR_D_PAD,
SMC_NLA_LGR_D_V2_COMMON,
+ SMC_NLA_LGR_D_EXT_GID,
+ SMC_NLA_LGR_D_PEER_EXT_GID,
__SMC_NLA_LGR_D_MAX,
SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/smc_diag.h b/libc/kernel/uapi/linux/smc_diag.h
index be540acb1..b358acf97 100644
--- a/libc/kernel/uapi/linux/smc_diag.h
+++ b/libc/kernel/uapi/linux/smc_diag.h
@@ -85,5 +85,7 @@ struct smcd_diag_dmbinfo {
__aligned_u64 my_gid;
__aligned_u64 token;
__aligned_u64 peer_token;
+ __aligned_u64 peer_gid_ext;
+ __aligned_u64 my_gid_ext;
};
#endif
diff --git a/libc/kernel/uapi/linux/stat.h b/libc/kernel/uapi/linux/stat.h
index 2fb7437c7..9974f3ead 100644
--- a/libc/kernel/uapi/linux/stat.h
+++ b/libc/kernel/uapi/linux/stat.h
@@ -85,6 +85,7 @@ struct statx {
#define STATX_BTIME 0x00000800U
#define STATX_MNT_ID 0x00001000U
#define STATX_DIOALIGN 0x00002000U
+#define STATX_MNT_ID_UNIQUE 0x00004000U
#define STATX__RESERVED 0x80000000U
#define STATX_ALL 0x00000fffU
#define STATX_ATTR_COMPRESSED 0x00000004
diff --git a/libc/kernel/uapi/linux/sync_file.h b/libc/kernel/uapi/linux/sync_file.h
index 423d248ce..bde8c162e 100644
--- a/libc/kernel/uapi/linux/sync_file.h
+++ b/libc/kernel/uapi/linux/sync_file.h
@@ -30,7 +30,12 @@ struct sync_file_info {
__u32 pad;
__u64 sync_fence_info;
};
+struct sync_set_deadline {
+ __u64 deadline_ns;
+ __u64 pad;
+};
#define SYNC_IOC_MAGIC '>'
#define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
#define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
+#define SYNC_IOC_SET_DEADLINE _IOW(SYNC_IOC_MAGIC, 5, struct sync_set_deadline)
#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_ipt.h b/libc/kernel/uapi/linux/tc_act/tc_ipt.h
deleted file mode 100644
index a2fc93309..000000000
--- a/libc/kernel/uapi/linux/tc_act/tc_ipt.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is auto-generated. Modifications will be lost.
- *
- * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
- * for more information.
- */
-#ifndef __LINUX_TC_IPT_H
-#define __LINUX_TC_IPT_H
-#include <linux/pkt_cls.h>
-enum {
- TCA_IPT_UNSPEC,
- TCA_IPT_TABLE,
- TCA_IPT_HOOK,
- TCA_IPT_INDEX,
- TCA_IPT_CNT,
- TCA_IPT_TM,
- TCA_IPT_TARG,
- TCA_IPT_PAD,
- __TCA_IPT_MAX
-};
-#define TCA_IPT_MAX (__TCA_IPT_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_mirred.h b/libc/kernel/uapi/linux/tc_act/tc_mirred.h
index d87b74a2d..dc51bc73d 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_mirred.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_mirred.h
@@ -22,6 +22,7 @@ enum {
TCA_MIRRED_TM,
TCA_MIRRED_PARMS,
TCA_MIRRED_PAD,
+ TCA_MIRRED_BLOCKID,
__TCA_MIRRED_MAX
};
#define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1)
diff --git a/libc/kernel/uapi/linux/thp7312.h b/libc/kernel/uapi/linux/thp7312.h
new file mode 100644
index 000000000..fbd5571aa
--- /dev/null
+++ b/libc/kernel/uapi/linux/thp7312.h
@@ -0,0 +1,14 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef __UAPI_THP7312_H_
+#define __UAPI_THP7312_H_
+#include <linux/v4l2-controls.h>
+#define V4L2_CID_THP7312_LOW_LIGHT_COMPENSATION (V4L2_CID_USER_THP7312_BASE + 0x01)
+#define V4L2_CID_THP7312_AUTO_FOCUS_METHOD (V4L2_CID_USER_THP7312_BASE + 0x02)
+#define V4L2_CID_THP7312_NOISE_REDUCTION_AUTO (V4L2_CID_USER_THP7312_BASE + 0x03)
+#define V4L2_CID_THP7312_NOISE_REDUCTION_ABSOLUTE (V4L2_CID_USER_THP7312_BASE + 0x04)
+#endif
diff --git a/libc/kernel/uapi/linux/time_types.h b/libc/kernel/uapi/linux/time_types.h
index 668f6ae62..bca869889 100644
--- a/libc/kernel/uapi/linux/time_types.h
+++ b/libc/kernel/uapi/linux/time_types.h
@@ -6,6 +6,7 @@
*/
#ifndef _UAPI_LINUX_TIME_TYPES_H
#define _UAPI_LINUX_TIME_TYPES_H
+#include <linux/time.h>
#include <linux/types.h>
struct __kernel_timespec {
__kernel_time64_t tv_sec;
diff --git a/libc/kernel/uapi/linux/usb/f_accessory.h b/libc/kernel/uapi/linux/usb/f_accessory.h
deleted file mode 100644
index abd864cab..000000000
--- a/libc/kernel/uapi/linux/usb/f_accessory.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is auto-generated. Modifications will be lost.
- *
- * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
- * for more information.
- */
-#ifndef _UAPI_LINUX_USB_F_ACCESSORY_H
-#define _UAPI_LINUX_USB_F_ACCESSORY_H
-#define USB_ACCESSORY_VENDOR_ID 0x18D1
-#define USB_ACCESSORY_PRODUCT_ID 0x2D00
-#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
-#define ACCESSORY_STRING_MANUFACTURER 0
-#define ACCESSORY_STRING_MODEL 1
-#define ACCESSORY_STRING_DESCRIPTION 2
-#define ACCESSORY_STRING_VERSION 3
-#define ACCESSORY_STRING_URI 4
-#define ACCESSORY_STRING_SERIAL 5
-#define ACCESSORY_GET_PROTOCOL 51
-#define ACCESSORY_SEND_STRING 52
-#define ACCESSORY_START 53
-#define ACCESSORY_REGISTER_HID 54
-#define ACCESSORY_UNREGISTER_HID 55
-#define ACCESSORY_SET_HID_REPORT_DESC 56
-#define ACCESSORY_SEND_HID_EVENT 57
-#define ACCESSORY_SET_AUDIO_MODE 58
-#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256])
-#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256])
-#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256])
-#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
-#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
-#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
-#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
-#define ACCESSORY_GET_AUDIO_MODE _IO('M', 8)
-#endif
diff --git a/libc/kernel/uapi/linux/usb/functionfs.h b/libc/kernel/uapi/linux/usb/functionfs.h
index 889360e15..417093eef 100644
--- a/libc/kernel/uapi/linux/usb/functionfs.h
+++ b/libc/kernel/uapi/linux/usb/functionfs.h
@@ -59,8 +59,9 @@ struct usb_os_desc_header {
struct usb_ext_compat_desc {
__u8 bFirstInterfaceNumber;
__u8 Reserved1;
- __u8 CompatibleID[8];
+ __struct_group(, IDs,, __u8 CompatibleID[8];
__u8 SubCompatibleID[8];
+ );
__u8 Reserved2[6];
};
struct usb_ext_prop_desc {
diff --git a/libc/kernel/uapi/linux/userfaultfd.h b/libc/kernel/uapi/linux/userfaultfd.h
index 5eeea4e0a..1dc2d791a 100644
--- a/libc/kernel/uapi/linux/userfaultfd.h
+++ b/libc/kernel/uapi/linux/userfaultfd.h
@@ -11,15 +11,16 @@
#define USERFAULTFD_IOC_NEW _IO(USERFAULTFD_IOC, 0x00)
#define UFFD_API ((__u64) 0xAA)
#define UFFD_API_REGISTER_MODES (UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP | UFFDIO_REGISTER_MODE_MINOR)
-#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID | UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM | UFFD_FEATURE_EXACT_ADDRESS | UFFD_FEATURE_WP_HUGETLBFS_SHMEM | UFFD_FEATURE_WP_UNPOPULATED | UFFD_FEATURE_POISON | UFFD_FEATURE_WP_ASYNC)
+#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID | UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM | UFFD_FEATURE_EXACT_ADDRESS | UFFD_FEATURE_WP_HUGETLBFS_SHMEM | UFFD_FEATURE_WP_UNPOPULATED | UFFD_FEATURE_POISON | UFFD_FEATURE_WP_ASYNC | UFFD_FEATURE_MOVE)
#define UFFD_API_IOCTLS ((__u64) 1 << _UFFDIO_REGISTER | (__u64) 1 << _UFFDIO_UNREGISTER | (__u64) 1 << _UFFDIO_API)
-#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE | (__u64) 1 << _UFFDIO_WRITEPROTECT | (__u64) 1 << _UFFDIO_CONTINUE | (__u64) 1 << _UFFDIO_POISON)
+#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE | (__u64) 1 << _UFFDIO_MOVE | (__u64) 1 << _UFFDIO_WRITEPROTECT | (__u64) 1 << _UFFDIO_CONTINUE | (__u64) 1 << _UFFDIO_POISON)
#define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_WRITEPROTECT | (__u64) 1 << _UFFDIO_CONTINUE | (__u64) 1 << _UFFDIO_POISON)
#define _UFFDIO_REGISTER (0x00)
#define _UFFDIO_UNREGISTER (0x01)
#define _UFFDIO_WAKE (0x02)
#define _UFFDIO_COPY (0x03)
#define _UFFDIO_ZEROPAGE (0x04)
+#define _UFFDIO_MOVE (0x05)
#define _UFFDIO_WRITEPROTECT (0x06)
#define _UFFDIO_CONTINUE (0x07)
#define _UFFDIO_POISON (0x08)
@@ -31,6 +32,7 @@
#define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, struct uffdio_range)
#define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, struct uffdio_copy)
#define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, struct uffdio_zeropage)
+#define UFFDIO_MOVE _IOWR(UFFDIO, _UFFDIO_MOVE, struct uffdio_move)
#define UFFDIO_WRITEPROTECT _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, struct uffdio_writeprotect)
#define UFFDIO_CONTINUE _IOWR(UFFDIO, _UFFDIO_CONTINUE, struct uffdio_continue)
#define UFFDIO_POISON _IOWR(UFFDIO, _UFFDIO_POISON, struct uffdio_poison)
@@ -92,6 +94,7 @@ struct uffdio_api {
#define UFFD_FEATURE_WP_UNPOPULATED (1 << 13)
#define UFFD_FEATURE_POISON (1 << 14)
#define UFFD_FEATURE_WP_ASYNC (1 << 15)
+#define UFFD_FEATURE_MOVE (1 << 16)
__u64 features;
__u64 ioctls;
};
@@ -141,5 +144,14 @@ struct uffdio_poison {
__u64 mode;
__s64 updated;
};
+struct uffdio_move {
+ __u64 dst;
+ __u64 src;
+ __u64 len;
+#define UFFDIO_MOVE_MODE_DONTWAKE ((__u64) 1 << 0)
+#define UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES ((__u64) 1 << 1)
+ __u64 mode;
+ __s64 move;
+};
#define UFFD_USER_MODE_ONLY 1
#endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 90cb69d0f..23158dcbc 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -111,6 +111,7 @@ enum v4l2_colorfx {
#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190)
#define V4L2_CID_USER_ASPEED_BASE (V4L2_CID_USER_BASE + 0x11a0)
#define V4L2_CID_USER_NPCM_BASE (V4L2_CID_USER_BASE + 0x11b0)
+#define V4L2_CID_USER_THP7312_BASE (V4L2_CID_USER_BASE + 0x11c0)
#define V4L2_CID_CODEC_BASE (V4L2_CTRL_CLASS_CODEC | 0x900)
#define V4L2_CID_CODEC_CLASS (V4L2_CTRL_CLASS_CODEC | 1)
#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_CODEC_BASE + 0)
diff --git a/libc/kernel/uapi/linux/v4l2-subdev.h b/libc/kernel/uapi/linux/v4l2-subdev.h
index d684a5499..9caaa4755 100644
--- a/libc/kernel/uapi/linux/v4l2-subdev.h
+++ b/libc/kernel/uapi/linux/v4l2-subdev.h
@@ -59,7 +59,8 @@ struct v4l2_subdev_frame_interval {
__u32 pad;
struct v4l2_fract interval;
__u32 stream;
- __u32 reserved[8];
+ __u32 which;
+ __u32 reserved[7];
};
struct v4l2_subdev_frame_interval_enum {
__u32 index;
@@ -104,6 +105,7 @@ struct v4l2_subdev_routing {
__u32 reserved[6];
};
#define V4L2_SUBDEV_CLIENT_CAP_STREAMS (1ULL << 0)
+#define V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH (1ULL << 1)
struct v4l2_subdev_client_capability {
__u64 capabilities;
};
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index 645a2ab62..549c079e7 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -4,8 +4,8 @@
* See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
* for more information.
*/
-#define LINUX_VERSION_CODE 395008
+#define LINUX_VERSION_CODE 395264
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define LINUX_VERSION_MAJOR 6
-#define LINUX_VERSION_PATCHLEVEL 7
+#define LINUX_VERSION_PATCHLEVEL 8
#define LINUX_VERSION_SUBLEVEL 0
diff --git a/libc/kernel/uapi/linux/vfio.h b/libc/kernel/uapi/linux/vfio.h
index 1107b2185..5910e4099 100644
--- a/libc/kernel/uapi/linux/vfio.h
+++ b/libc/kernel/uapi/linux/vfio.h
@@ -336,6 +336,7 @@ enum vfio_device_mig_state {
VFIO_DEVICE_STATE_RUNNING_P2P = 5,
VFIO_DEVICE_STATE_PRE_COPY = 6,
VFIO_DEVICE_STATE_PRE_COPY_P2P = 7,
+ VFIO_DEVICE_STATE_NR,
};
struct vfio_precopy_info {
__u32 argsz;
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index bb9888890..ed9148430 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -562,6 +562,7 @@ struct v4l2_requestbuffers {
#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)
#define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5)
#define V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS (1 << 6)
+#define V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS (1 << 7)
struct v4l2_plane {
__u32 bytesused;
__u32 length;
@@ -911,7 +912,7 @@ struct v4l2_ext_control {
__s64 * p_s64;
struct v4l2_area * p_area;
struct v4l2_ctrl_h264_sps * p_h264_sps;
- struct v4l2_ctrl_h264_pps * p_h264_pps;
+ struct v4l2_ctrl_h264_pps * p_h264_pps;
struct v4l2_ctrl_h264_scaling_matrix * p_h264_scaling_matrix;
struct v4l2_ctrl_h264_pred_weights * p_h264_pred_weights;
struct v4l2_ctrl_h264_slice_params * p_h264_slice_params;
@@ -932,6 +933,8 @@ struct v4l2_ext_control {
struct v4l2_ctrl_av1_tile_group_entry * p_av1_tile_group_entry;
struct v4l2_ctrl_av1_frame * p_av1_frame;
struct v4l2_ctrl_av1_film_grain * p_av1_film_grain;
+ struct v4l2_ctrl_hdr10_cll_info * p_hdr10_cll_info;
+ struct v4l2_ctrl_hdr10_mastering_display * p_hdr10_mastering_display;
void * ptr;
};
} __attribute__((packed));
@@ -1429,7 +1432,8 @@ struct v4l2_create_buffers {
struct v4l2_format format;
__u32 capabilities;
__u32 flags;
- __u32 reserved[6];
+ __u32 max_num_buffers;
+ __u32 reserved[5];
};
#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
diff --git a/libc/kernel/uapi/linux/virtio_config.h b/libc/kernel/uapi/linux/virtio_config.h
index 520a472bb..021845c10 100644
--- a/libc/kernel/uapi/linux/virtio_config.h
+++ b/libc/kernel/uapi/linux/virtio_config.h
@@ -14,7 +14,7 @@
#define VIRTIO_CONFIG_S_NEEDS_RESET 0x40
#define VIRTIO_CONFIG_S_FAILED 0x80
#define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END 41
+#define VIRTIO_TRANSPORT_F_END 42
#ifndef VIRTIO_CONFIG_NO_LEGACY
#define VIRTIO_F_NOTIFY_ON_EMPTY 24
#define VIRTIO_F_ANY_LAYOUT 27
@@ -29,4 +29,5 @@
#define VIRTIO_F_NOTIFICATION_DATA 38
#define VIRTIO_F_NOTIF_CONFIG_DATA 39
#define VIRTIO_F_RING_RESET 40
+#define VIRTIO_F_ADMIN_VQ 41
#endif
diff --git a/libc/kernel/uapi/linux/virtio_pci.h b/libc/kernel/uapi/linux/virtio_pci.h
index f9595bcc5..013548c6e 100644
--- a/libc/kernel/uapi/linux/virtio_pci.h
+++ b/libc/kernel/uapi/linux/virtio_pci.h
@@ -78,6 +78,8 @@ struct virtio_pci_modern_common_cfg {
struct virtio_pci_common_cfg cfg;
__le16 queue_notify_data;
__le16 queue_reset;
+ __le16 admin_queue_index;
+ __le16 admin_queue_num;
};
struct virtio_pci_cfg_cap {
struct virtio_pci_cap cap;
@@ -112,5 +114,48 @@ struct virtio_pci_cfg_cap {
#define VIRTIO_PCI_COMMON_Q_USEDHI 52
#define VIRTIO_PCI_COMMON_Q_NDATA 56
#define VIRTIO_PCI_COMMON_Q_RESET 58
+#define VIRTIO_PCI_COMMON_ADM_Q_IDX 60
+#define VIRTIO_PCI_COMMON_ADM_Q_NUM 62
#endif
+#define VIRTIO_ADMIN_STATUS_OK 0
+#define VIRTIO_ADMIN_CMD_LIST_QUERY 0x0
+#define VIRTIO_ADMIN_CMD_LIST_USE 0x1
+#define VIRTIO_ADMIN_GROUP_TYPE_SRIOV 0x1
+#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_WRITE 0x2
+#define VIRTIO_ADMIN_CMD_LEGACY_COMMON_CFG_READ 0x3
+#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_WRITE 0x4
+#define VIRTIO_ADMIN_CMD_LEGACY_DEV_CFG_READ 0x5
+#define VIRTIO_ADMIN_CMD_LEGACY_NOTIFY_INFO 0x6
+struct __attribute__((__packed__)) virtio_admin_cmd_hdr {
+ __le16 opcode;
+ __le16 group_type;
+ __u8 reserved1[12];
+ __le64 group_member_id;
+};
+struct __attribute__((__packed__)) virtio_admin_cmd_status {
+ __le16 status;
+ __le16 status_qualifier;
+ __u8 reserved2[4];
+};
+struct __attribute__((__packed__)) virtio_admin_cmd_legacy_wr_data {
+ __u8 offset;
+ __u8 reserved[7];
+ __u8 registers[];
+};
+struct __attribute__((__packed__)) virtio_admin_cmd_legacy_rd_data {
+ __u8 offset;
+};
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_END 0
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_DEV 0x1
+#define VIRTIO_ADMIN_CMD_NOTIFY_INFO_FLAGS_OWNER_MEM 0x2
+#define VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO 4
+struct __attribute__((__packed__)) virtio_admin_cmd_notify_info_data {
+ __u8 flags;
+ __u8 bar;
+ __u8 padding[6];
+ __le64 offset;
+};
+struct virtio_admin_cmd_notify_info_result {
+ struct virtio_admin_cmd_notify_info_data entries[VIRTIO_ADMIN_CMD_MAX_NOTIFY_INFO];
+};
#endif
diff --git a/libc/kernel/uapi/linux/virtio_pmem.h b/libc/kernel/uapi/linux/virtio_pmem.h
index 182baf7ec..da0f764ba 100644
--- a/libc/kernel/uapi/linux/virtio_pmem.h
+++ b/libc/kernel/uapi/linux/virtio_pmem.h
@@ -9,6 +9,8 @@
#include <linux/types.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
+#define VIRTIO_PMEM_F_SHMEM_REGION 0
+#define VIRTIO_PMEM_SHMEM_REGION_ID 0
struct virtio_pmem_config {
__le64 start;
__le64 size;
diff --git a/libc/kernel/uapi/rdma/bnxt_re-abi.h b/libc/kernel/uapi/rdma/bnxt_re-abi.h
index 86e16a054..3dceafd8f 100644
--- a/libc/kernel/uapi/rdma/bnxt_re-abi.h
+++ b/libc/kernel/uapi/rdma/bnxt_re-abi.h
@@ -17,12 +17,20 @@ enum {
BNXT_RE_UCNTX_CMASK_HAVE_MODE = 0x02ULL,
BNXT_RE_UCNTX_CMASK_WC_DPI_ENABLED = 0x04ULL,
BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL,
+ BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL,
+ BNXT_RE_COMP_MASK_UCNTX_HW_RETX_ENABLED = 0x40,
};
enum bnxt_re_wqe_mode {
BNXT_QPLIB_WQE_MODE_STATIC = 0x00,
BNXT_QPLIB_WQE_MODE_VARIABLE = 0x01,
BNXT_QPLIB_WQE_MODE_INVALID = 0x02,
};
+enum {
+ BNXT_RE_COMP_MASK_REQ_UCNTX_POW2_SUPPORT = 0x01,
+};
+struct bnxt_re_uctx_req {
+ __aligned_u64 comp_mask;
+};
struct bnxt_re_uctx_resp {
__u32 dev_id;
__u32 max_qp;
@@ -45,11 +53,15 @@ struct bnxt_re_cq_req {
__aligned_u64 cq_va;
__aligned_u64 cq_handle;
};
+enum bnxt_re_cq_mask {
+ BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT = 0x1,
+};
struct bnxt_re_cq_resp {
__u32 cqid;
__u32 tail;
__u32 phase;
__u32 rsvd;
+ __aligned_u64 comp_mask;
};
struct bnxt_re_resize_cq_req {
__aligned_u64 cq_va;
@@ -79,6 +91,7 @@ enum bnxt_re_shpg_offt {
enum bnxt_re_objects {
BNXT_RE_OBJECT_ALLOC_PAGE = (1U << UVERBS_ID_NS_SHIFT),
BNXT_RE_OBJECT_NOTIFY_DRV,
+ BNXT_RE_OBJECT_GET_TOGGLE_MEM,
};
enum bnxt_re_alloc_page_type {
BNXT_RE_ALLOC_WC_PAGE = 0,
@@ -102,4 +115,23 @@ enum bnxt_re_alloc_page_methods {
enum bnxt_re_notify_drv_methods {
BNXT_RE_METHOD_NOTIFY_DRV = (1U << UVERBS_ID_NS_SHIFT),
};
+enum bnxt_re_get_toggle_mem_type {
+ BNXT_RE_CQ_TOGGLE_MEM = 0,
+ BNXT_RE_SRQ_TOGGLE_MEM,
+};
+enum bnxt_re_var_toggle_mem_attrs {
+ BNXT_RE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+ BNXT_RE_TOGGLE_MEM_TYPE,
+ BNXT_RE_TOGGLE_MEM_RES_ID,
+ BNXT_RE_TOGGLE_MEM_MMAP_PAGE,
+ BNXT_RE_TOGGLE_MEM_MMAP_OFFSET,
+ BNXT_RE_TOGGLE_MEM_MMAP_LENGTH,
+};
+enum bnxt_re_toggle_mem_attrs {
+ BNXT_RE_RELEASE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+};
+enum bnxt_re_toggle_mem_methods {
+ BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT),
+ BNXT_RE_METHOD_RELEASE_TOGGLE_MEM,
+};
#endif
diff --git a/libc/kernel/uapi/rdma/efa-abi.h b/libc/kernel/uapi/rdma/efa-abi.h
index c327764c4..2b30941a8 100644
--- a/libc/kernel/uapi/rdma/efa-abi.h
+++ b/libc/kernel/uapi/rdma/efa-abi.h
@@ -7,6 +7,7 @@
#ifndef EFA_ABI_USER_H
#define EFA_ABI_USER_H
#include <linux/types.h>
+#include <rdma/ib_user_ioctl_cmds.h>
#define EFA_UVERBS_ABI_VERSION 1
enum {
EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH = 1 << 0,
@@ -104,4 +105,19 @@ struct efa_ibv_ex_query_device_resp {
__u32 max_rdma_size;
__u32 device_caps;
};
+enum {
+ EFA_QUERY_MR_VALIDITY_RECV_IC_ID = 1 << 0,
+ EFA_QUERY_MR_VALIDITY_RDMA_READ_IC_ID = 1 << 1,
+ EFA_QUERY_MR_VALIDITY_RDMA_RECV_IC_ID = 1 << 2,
+};
+enum efa_query_mr_attrs {
+ EFA_IB_ATTR_QUERY_MR_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
+ EFA_IB_ATTR_QUERY_MR_RESP_IC_ID_VALIDITY,
+ EFA_IB_ATTR_QUERY_MR_RESP_RECV_IC_ID,
+ EFA_IB_ATTR_QUERY_MR_RESP_RDMA_READ_IC_ID,
+ EFA_IB_ATTR_QUERY_MR_RESP_RDMA_RECV_IC_ID,
+};
+enum efa_mr_methods {
+ EFA_IB_METHOD_MR_QUERY = (1U << UVERBS_ID_NS_SHIFT),
+};
#endif
diff --git a/libc/kernel/uapi/rdma/hns-abi.h b/libc/kernel/uapi/rdma/hns-abi.h
index f9effb335..54a56722c 100644
--- a/libc/kernel/uapi/rdma/hns-abi.h
+++ b/libc/kernel/uapi/rdma/hns-abi.h
@@ -81,4 +81,8 @@ struct hns_roce_ib_alloc_ucontext {
struct hns_roce_ib_alloc_pd_resp {
__u32 pdn;
};
+struct hns_roce_ib_create_ah_resp {
+ __u8 dmac[6];
+ __u8 reserved[2];
+};
#endif
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index dc6420baf..22cf99e25 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/if_ether.h>
#include <rdma/ib_user_ioctl_verbs.h>
+#include <rdma/mlx5_user_ioctl_verbs.h>
enum {
MLX5_QP_FLAG_SIGNATURE = 1 << 0,
MLX5_QP_FLAG_SCATTER_CQE = 1 << 1,
@@ -186,6 +187,7 @@ struct mlx5_ib_query_device_resp {
__u32 tunnel_offloads_caps;
struct mlx5_ib_dci_streams_caps dci_streams_caps;
__u16 reserved;
+ struct mlx5_ib_uapi_reg reg_c0;
};
enum mlx5_ib_create_cq_flags {
MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index 57fc43e22..f087ee81f 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -32,6 +32,7 @@ enum mlx5_ib_uapi_dm_type {
MLX5_IB_UAPI_DM_TYPE_STEERING_SW_ICM,
MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_SW_ICM,
MLX5_IB_UAPI_DM_TYPE_HEADER_MODIFY_PATTERN_SW_ICM,
+ MLX5_IB_UAPI_DM_TYPE_ENCAP_SW_ICM,
};
enum mlx5_ib_uapi_devx_create_event_channel_flags {
MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
diff --git a/libc/kernel/uapi/regulator/regulator.h b/libc/kernel/uapi/regulator/regulator.h
new file mode 100644
index 000000000..23ce7c6ec
--- /dev/null
+++ b/libc/kernel/uapi/regulator/regulator.h
@@ -0,0 +1,47 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef _UAPI_REGULATOR_H
+#define _UAPI_REGULATOR_H
+#include <stdint.h>
+#define REGULATOR_EVENT_UNDER_VOLTAGE 0x01
+#define REGULATOR_EVENT_OVER_CURRENT 0x02
+#define REGULATOR_EVENT_REGULATION_OUT 0x04
+#define REGULATOR_EVENT_FAIL 0x08
+#define REGULATOR_EVENT_OVER_TEMP 0x10
+#define REGULATOR_EVENT_FORCE_DISABLE 0x20
+#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
+#define REGULATOR_EVENT_DISABLE 0x80
+#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
+#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
+#define REGULATOR_EVENT_PRE_DISABLE 0x400
+#define REGULATOR_EVENT_ABORT_DISABLE 0x800
+#define REGULATOR_EVENT_ENABLE 0x1000
+#define REGULATOR_EVENT_UNDER_VOLTAGE_WARN 0x2000
+#define REGULATOR_EVENT_OVER_CURRENT_WARN 0x4000
+#define REGULATOR_EVENT_OVER_VOLTAGE_WARN 0x8000
+#define REGULATOR_EVENT_OVER_TEMP_WARN 0x10000
+#define REGULATOR_EVENT_WARN_MASK 0x1E000
+struct reg_genl_event {
+ char reg_name[32];
+ uint64_t event;
+};
+enum {
+ REG_GENL_ATTR_UNSPEC,
+ REG_GENL_ATTR_EVENT,
+ __REG_GENL_ATTR_MAX,
+};
+#define REG_GENL_ATTR_MAX (__REG_GENL_ATTR_MAX - 1)
+enum {
+ REG_GENL_CMD_UNSPEC,
+ REG_GENL_CMD_EVENT,
+ __REG_GENL_CMD_MAX,
+};
+#define REG_GENL_CMD_MAX (__REG_GENL_CMD_MAX - 1)
+#define REG_GENL_FAMILY_NAME "reg_event"
+#define REG_GENL_VERSION 0x01
+#define REG_GENL_MCAST_GROUP_NAME "reg_mc_group"
+#endif
diff --git a/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h b/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h
index f12c36f9a..bac50179a 100644
--- a/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h
+++ b/libc/kernel/uapi/scsi/scsi_bsg_mpi3mr.h
@@ -242,6 +242,8 @@ struct mpi3_nvme_encapsulated_error_reply {
#define MPI3MR_NVME_DATA_FORMAT_PRP 0
#define MPI3MR_NVME_DATA_FORMAT_SGL1 1
#define MPI3MR_NVME_DATA_FORMAT_SGL2 2
+#define MPI3MR_NVMESGL_DATA_SEGMENT 0x00
+#define MPI3MR_NVMESGL_LAST_SEGMENT 0x03
struct mpi3_scsi_task_mgmt_request {
__le16 host_tag;
__u8 ioc_use_only02;
diff --git a/libc/kernel/uapi/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index 7da2fbbdb..b608ed51f 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -92,7 +92,7 @@ struct snd_hwdep_dsp_image {
#define SNDRV_HWDEP_IOCTL_INFO _IOR('H', 0x01, struct snd_hwdep_info)
#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 17)
typedef unsigned long snd_pcm_uframes_t;
typedef signed long snd_pcm_sframes_t;
enum {
@@ -201,7 +201,10 @@ typedef int __bitwise snd_pcm_format_t;
#endif
typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_SUBFORMAT_STD (( snd_pcm_subformat_t) 0)
-#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
+#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX (( snd_pcm_subformat_t) 1)
+#define SNDRV_PCM_SUBFORMAT_MSBITS_20 (( snd_pcm_subformat_t) 2)
+#define SNDRV_PCM_SUBFORMAT_MSBITS_24 (( snd_pcm_subformat_t) 3)
+#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
#define SNDRV_PCM_INFO_MMAP 0x00000001
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002
#define SNDRV_PCM_INFO_DOUBLE 0x00000004
diff --git a/libc/kernel/uapi/sound/scarlett2.h b/libc/kernel/uapi/sound/scarlett2.h
new file mode 100644
index 000000000..13e6abed1
--- /dev/null
+++ b/libc/kernel/uapi/sound/scarlett2.h
@@ -0,0 +1,30 @@
+/*
+ * This file is auto-generated. Modifications will be lost.
+ *
+ * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
+ * for more information.
+ */
+#ifndef __UAPI_SOUND_SCARLETT2_H
+#define __UAPI_SOUND_SCARLETT2_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#define SCARLETT2_HWDEP_MAJOR 1
+#define SCARLETT2_HWDEP_MINOR 0
+#define SCARLETT2_HWDEP_SUBMINOR 0
+#define SCARLETT2_HWDEP_VERSION ((SCARLETT2_HWDEP_MAJOR << 16) | (SCARLETT2_HWDEP_MINOR << 8) | SCARLETT2_HWDEP_SUBMINOR)
+#define SCARLETT2_HWDEP_VERSION_MAJOR(v) (((v) >> 16) & 0xFF)
+#define SCARLETT2_HWDEP_VERSION_MINOR(v) (((v) >> 8) & 0xFF)
+#define SCARLETT2_HWDEP_VERSION_SUBMINOR(v) ((v) & 0xFF)
+#define SCARLETT2_IOCTL_PVERSION _IOR('S', 0x60, int)
+#define SCARLETT2_IOCTL_REBOOT _IO('S', 0x61)
+#define SCARLETT2_SEGMENT_ID_SETTINGS 0
+#define SCARLETT2_SEGMENT_ID_FIRMWARE 1
+#define SCARLETT2_SEGMENT_ID_COUNT 2
+#define SCARLETT2_IOCTL_SELECT_FLASH_SEGMENT _IOW('S', 0x62, int)
+#define SCARLETT2_IOCTL_ERASE_FLASH_SEGMENT _IO('S', 0x63)
+struct scarlett2_flash_segment_erase_progress {
+ unsigned char progress;
+ unsigned char num_blocks;
+};
+#define SCARLETT2_IOCTL_GET_ERASE_PROGRESS _IOR('S', 0x64, struct scarlett2_flash_segment_erase_progress)
+#endif
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
index d57d55bb6..b55a895e4 100644
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ b/libc/kernel/uapi/sound/sof/tokens.h
@@ -15,6 +15,7 @@
#define SOF_TPLG_KCTL_BYTES_WO_ID 262
#define SOF_TKN_BUF_SIZE 100
#define SOF_TKN_BUF_CAPS 101
+#define SOF_TKN_BUF_FLAGS 102
#define SOF_TKN_DAI_TYPE 154
#define SOF_TKN_DAI_INDEX 155
#define SOF_TKN_DAI_DIRECTION 156
@@ -125,4 +126,6 @@
#define SOF_TKN_AMD_ACPI2S_RATE 1700
#define SOF_TKN_AMD_ACPI2S_CH 1701
#define SOF_TKN_AMD_ACPI2S_TDM_MODE 1702
+#define SOF_TKN_IMX_MICFIL_RATE 2000
+#define SOF_TKN_IMX_MICFIL_CH 2001
#endif
diff --git a/libc/kernel/uapi/xen/gntalloc.h b/libc/kernel/uapi/xen/gntalloc.h
index 02e4d4756..4f0e7b89b 100644
--- a/libc/kernel/uapi/xen/gntalloc.h
+++ b/libc/kernel/uapi/xen/gntalloc.h
@@ -13,7 +13,10 @@ struct ioctl_gntalloc_alloc_gref {
__u16 flags;
__u32 count;
__u64 index;
- __u32 gref_ids[1];
+ union {
+ __u32 gref_ids[1];
+ __DECLARE_FLEX_ARRAY(__u32, gref_ids_flex);
+ };
};
#define GNTALLOC_FLAG_WRITABLE 1
#define IOCTL_GNTALLOC_DEALLOC_GREF _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 3731a5d26..b66b8e27f 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -70,7 +70,7 @@ bool* g_zygote_child;
const MallocDispatch* g_dispatch;
-static __always_inline uint64_t Nanotime() {
+static inline __always_inline uint64_t Nanotime() {
struct timespec t = {};
clock_gettime(CLOCK_MONOTONIC, &t);
return static_cast<uint64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index a06b8ee30..ffc6d4a43 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -152,6 +152,10 @@ typedef struct {
// mode, and bug reports will be created by debuggerd, however the process
// will recover and continue to function as if the memory safety bug wasn't
// detected.
+ //
+ // In Android 15, this is the same as TURN_ON_WITH_SAMPLING, as GWP-ASan is
+ // only ever used in non-crashing mode (even for platform executables and
+ // system apps).
TURN_ON_FOR_APP_SAMPLED_NON_CRASHING,
};
diff --git a/libc/private/WriteProtected.h b/libc/private/WriteProtected.h
index fac07cb61..bbe35e529 100644
--- a/libc/private/WriteProtected.h
+++ b/libc/private/WriteProtected.h
@@ -51,30 +51,39 @@ class WriteProtected {
void initialize() {
// Not strictly necessary, but this will hopefully segfault if we initialize
// multiple times by accident.
- memset(&contents, 0, sizeof(contents));
+ memset(contents_addr(), 0, sizeof(contents));
set_protection(PROT_READ);
}
const T* operator->() {
- return &contents.value;
+ return &contents_addr()->value;
}
const T& operator*() {
- return contents.value;
+ return contents_addr()->value;
}
template <typename Mutator>
void mutate(Mutator mutator) {
set_protection(PROT_READ | PROT_WRITE);
- mutator(&contents.value);
+ mutator(&contents_addr()->value);
set_protection(PROT_READ);
}
private:
WriteProtectedContents<T> contents;
- void set_protection(int prot) {
+ WriteProtectedContents<T>* contents_addr() {
auto addr = &contents;
+ // Hide the fact that we're returning the address of contents from the compiler.
+ // Otherwise it may generate code assuming alignment of 64KB even though the
+ // variable is only guaranteed to have 4KB alignment.
+ __asm__ __volatile__("" : "+r"(addr));
+ return addr;
+ }
+
+ void set_protection(int prot) {
+ auto addr = contents_addr();
#if __has_feature(hwaddress_sanitizer)
// The mprotect system call does not currently untag pointers, so do it
// ourselves.
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
index 9dd5e35ce..1dedb61e7 100644
--- a/libc/system_properties/system_properties.cpp
+++ b/libc/system_properties/system_properties.cpp
@@ -120,14 +120,18 @@ bool SystemProperties::AreaInit(const char* filename, bool* fsetxattr_failed,
return false;
}
- auto* appcompat_contexts = new (appcompat_override_contexts_data_) ContextsSerialized();
appcompat_filename_ = PropertiesFilename(properties_filename_.c_str(), "appcompat_override");
- if (!appcompat_contexts->Initialize(true, appcompat_filename_.c_str(), fsetxattr_failed,
- load_default_path)) {
- appcompat_override_contexts_ = nullptr;
- return false;
+ appcompat_override_contexts_ = nullptr;
+ if (access(appcompat_filename_.c_str(), F_OK) != -1) {
+ auto* appcompat_contexts = new (appcompat_override_contexts_data_) ContextsSerialized();
+ if (!appcompat_contexts->Initialize(true, appcompat_filename_.c_str(), fsetxattr_failed,
+ load_default_path)) {
+ // The appcompat folder exists, but initializing it failed
+ return false;
+ } else {
+ appcompat_override_contexts_ = appcompat_contexts;
+ }
}
- appcompat_override_contexts_ = appcompat_contexts;
initialized_ = true;
return true;
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index 8e6f87da8..cbc52b539 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -42,23 +42,8 @@ extern const char* __progname;
#define PROTO_NORMAL(x)
-/* OpenBSD's <ctype.h> uses these names, which conflicted with stlport.
- * Additionally, we changed the numeric/digit type from N to D for libcxx.
- */
-#define _U _CTYPE_U
-#define _L _CTYPE_L
-#define _N _CTYPE_D
-#define _S _CTYPE_S
-#define _P _CTYPE_P
-#define _C _CTYPE_C
-#define _X _CTYPE_X
-#define _B _CTYPE_B
-
-/* OpenBSD has this, but we can't really implement it correctly on Linux. */
-#define issetugid() 0
-
#if !defined(ANDROID_HOST_MUSL)
-#define explicit_bzero(p, s) memset(p, 0, s)
+#define explicit_bzero(p, s) memset_explicit(p, 0, s)
#endif
#if defined(ANDROID_HOST_MUSL)
diff --git a/libc/upstream-openbsd/lib/libc/crypt/arc4random.c b/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
index 8a4ecc9e8..0737cf3fb 100644
--- a/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
+++ b/libc/upstream-openbsd/lib/libc/crypt/arc4random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.54 2015/09/13 08:31:47 guenther Exp $ */
+/* $OpenBSD: arc4random.c,v 1.58 2022/07/31 13:41:45 tb Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -49,6 +49,8 @@
#define BLOCKSZ 64
#define RSBUFSZ (16*BLOCKSZ)
+#define REKEY_BASE (1024*1024) /* NB. should be a power of 2 */
+
/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
static struct _rs {
size_t rs_have; /* valid bytes at end of rs_buf */
@@ -78,7 +80,7 @@ _rs_init(u_char *buf, size_t n)
abort();
}
- chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8, 0);
+ chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8);
chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
}
@@ -86,6 +88,7 @@ static void
_rs_stir(void)
{
u_char rnd[KEYSZ + IVSZ];
+ uint32_t rekey_fuzz = 0;
if (getentropy(rnd, sizeof rnd) == -1)
_getentropy_fail();
@@ -100,7 +103,10 @@ _rs_stir(void)
rs->rs_have = 0;
memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
- rs->rs_count = 1600000;
+ /* rekey interval should not be predictable */
+ chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz,
+ (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz));
+ rs->rs_count = REKEY_BASE + (rekey_fuzz % REKEY_BASE);
}
static inline void
diff --git a/libc/upstream-openbsd/lib/libc/crypt/chacha_private.h b/libc/upstream-openbsd/lib/libc/crypt/chacha_private.h
index 7c3680fa6..b0427b6b3 100644
--- a/libc/upstream-openbsd/lib/libc/crypt/chacha_private.h
+++ b/libc/upstream-openbsd/lib/libc/crypt/chacha_private.h
@@ -4,7 +4,7 @@ D. J. Bernstein
Public domain.
*/
-/* $OpenBSD: chacha_private.h,v 1.2 2013/10/04 07:02:27 djm Exp $ */
+/* $OpenBSD: chacha_private.h,v 1.3 2022/02/28 21:56:29 dtucker Exp $ */
typedef unsigned char u8;
typedef unsigned int u32;
@@ -52,7 +52,7 @@ static const char sigma[16] = "expand 32-byte k";
static const char tau[16] = "expand 16-byte k";
static void
-chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
+chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits)
{
const char *constants;
diff --git a/libc/upstream-openbsd/lib/libc/gen/ctype_.c b/libc/upstream-openbsd/lib/libc/gen/ctype_.c
index 897224433..9742c9f16 100644
--- a/libc/upstream-openbsd/lib/libc/gen/ctype_.c
+++ b/libc/upstream-openbsd/lib/libc/gen/ctype_.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctype_.c,v 1.12 2015/09/19 04:02:21 guenther Exp $ */
+/* $OpenBSD: ctype_.c,v 1.13 2024/02/04 13:03:18 jca Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
@@ -36,6 +36,16 @@
#include <ctype.h>
#include "ctype_private.h"
+/* Shorter names for the defines provided by <ctype.h> */
+#define _U _CTYPE_U
+#define _L _CTYPE_L
+#define _N _CTYPE_N
+#define _S _CTYPE_S
+#define _P _CTYPE_P
+#define _C _CTYPE_C
+#define _X _CTYPE_X
+#define _B _CTYPE_B
+
const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
0,
_C, _C, _C, _C, _C, _C, _C, _C,
diff --git a/libc/upstream-openbsd/lib/libc/net/htonl.c b/libc/upstream-openbsd/lib/libc/net/htonl.c
index 6ee6e7efb..58bfb4699 100644
--- a/libc/upstream-openbsd/lib/libc/net/htonl.c
+++ b/libc/upstream-openbsd/lib/libc/net/htonl.c
@@ -1,6 +1,5 @@
-/* $OpenBSD: htonl.c,v 1.7 2014/07/21 01:51:10 guenther Exp $ */
+/* $OpenBSD: htonl.c,v 1.8 2024/04/15 14:30:48 naddy Exp $ */
/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
@@ -9,13 +8,8 @@
#undef htonl
-u_int32_t
-htonl(u_int32_t x)
+uint32_t
+htonl(uint32_t x)
{
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *)&x;
- return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
-#else
- return x;
-#endif
+ return htobe32(x);
}
diff --git a/libc/upstream-openbsd/lib/libc/net/htons.c b/libc/upstream-openbsd/lib/libc/net/htons.c
index f48d91ee0..28b13cef9 100644
--- a/libc/upstream-openbsd/lib/libc/net/htons.c
+++ b/libc/upstream-openbsd/lib/libc/net/htons.c
@@ -1,6 +1,5 @@
-/* $OpenBSD: htons.c,v 1.9 2014/07/21 01:51:10 guenther Exp $ */
+/* $OpenBSD: htons.c,v 1.10 2024/04/15 14:30:48 naddy Exp $ */
/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
@@ -9,13 +8,8 @@
#undef htons
-u_int16_t
-htons(u_int16_t x)
+uint16_t
+htons(uint16_t x)
{
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *) &x;
- return (u_int16_t)(s[0] << 8 | s[1]);
-#else
- return x;
-#endif
+ return htobe16(x);
}
diff --git a/libc/upstream-openbsd/lib/libc/net/ntohl.c b/libc/upstream-openbsd/lib/libc/net/ntohl.c
index 0d05bac78..7592398e8 100644
--- a/libc/upstream-openbsd/lib/libc/net/ntohl.c
+++ b/libc/upstream-openbsd/lib/libc/net/ntohl.c
@@ -1,6 +1,5 @@
-/* $OpenBSD: ntohl.c,v 1.7 2014/07/21 01:51:10 guenther Exp $ */
+/* $OpenBSD: ntohl.c,v 1.8 2024/04/15 14:30:48 naddy Exp $ */
/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
@@ -9,13 +8,8 @@
#undef ntohl
-u_int32_t
-ntohl(u_int32_t x)
+uint32_t
+ntohl(uint32_t x)
{
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *)&x;
- return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
-#else
- return x;
-#endif
+ return be32toh(x);
}
diff --git a/libc/upstream-openbsd/lib/libc/net/ntohs.c b/libc/upstream-openbsd/lib/libc/net/ntohs.c
index b5ea361f8..ef22ea306 100644
--- a/libc/upstream-openbsd/lib/libc/net/ntohs.c
+++ b/libc/upstream-openbsd/lib/libc/net/ntohs.c
@@ -1,6 +1,5 @@
-/* $OpenBSD: ntohs.c,v 1.9 2014/07/21 01:51:10 guenther Exp $ */
+/* $OpenBSD: ntohs.c,v 1.10 2024/04/15 14:30:48 naddy Exp $ */
/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
@@ -9,13 +8,8 @@
#undef ntohs
-u_int16_t
-ntohs(u_int16_t x)
+uint16_t
+ntohs(uint16_t x)
{
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *) &x;
- return (u_int16_t)(s[0] << 8 | s[1]);
-#else
- return x;
-#endif
+ return be16toh(x);
}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c b/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
index d83de8845..d615245ab 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fvwrite.c,v 1.21 2023/10/06 16:41:02 millert Exp $ */
+/* $OpenBSD: fvwrite.c,v 1.22 2024/04/28 14:28:02 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,6 +31,7 @@
* SUCH DAMAGE.
*/
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -76,11 +77,12 @@ __sfvwrite(FILE *fp, struct __suio *uio)
}
if (fp->_flags & __SNBF) {
/*
- * Unbuffered: write up to BUFSIZ bytes at a time.
+ * Unbuffered: write up to INT_MAX bytes at a time, to not
+ * truncate the value of len if it is greater than 2^31 bytes.
*/
do {
GETIOV(;);
- w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ));
+ w = (*fp->_write)(fp->_cookie, p, MIN(len, INT_MAX));
if (w <= 0)
goto err;
p += w;
@@ -90,7 +92,8 @@ __sfvwrite(FILE *fp, struct __suio *uio)
/*
* Fully buffered: fill partially full buffer, if any,
* and then flush. If there is no partial buffer, write
- * one _bf._size byte chunk directly (without copying).
+ * entire payload directly (without copying) up to a
+ * multiple of the buffer size.
*
* String output is a special case: write as many bytes
* as fit, but pretend we wrote everything. This makes
@@ -134,7 +137,15 @@ __sfvwrite(FILE *fp, struct __suio *uio)
if (__sflush(fp))
goto err;
} else if (len >= (w = fp->_bf._size)) {
- /* write directly */
+ /*
+ * Write directly up to INT_MAX or greatest
+ * multiple of buffer size (whichever is
+ * smaller), keeping in the memory buffer the
+ * remaining part of payload that is smaller
+ * than buffer size.
+ */
+ if (w != 0)
+ w = MIN(w * (len / w), INT_MAX);
w = (*fp->_write)(fp->_cookie, p, w);
if (w <= 0)
goto err;
diff --git a/linker/arch/arm64/tlsdesc_resolver.S b/linker/arch/arm64/tlsdesc_resolver.S
index ad155e288..84407ddbc 100644
--- a/linker/arch/arm64/tlsdesc_resolver.S
+++ b/linker/arch/arm64/tlsdesc_resolver.S
@@ -56,12 +56,12 @@ ENTRY_PRIVATE(tlsdesc_resolver_dynamic)
ldr x22, [x0] // TlsDynamicResolverArg::generation
cmp x21, x22
- b.lo .fallback
+ b.lo L(fallback)
ldr x21, [x0, #8] // TlsIndex::module_id
ldr x22, [x0, #16] // TlsIndex::offset
ldr x21, [x20, x21, lsl #3] // TlsDtv::modules[module_id]
- cbz x21, .fallback
+ cbz x21, L(fallback)
add x0, x21, x22
sub x0, x0, x19
@@ -75,7 +75,7 @@ ENTRY_PRIVATE(tlsdesc_resolver_dynamic)
.cfi_restore x20
ret
-.fallback:
+L(fallback):
.cfi_restore_state
ldp x21, x22, [sp, #16]
.cfi_restore x21
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f813c1a68..8b467a376 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -2788,7 +2788,7 @@ bool soinfo::lookup_version_info(const VersionTracker& version_tracker, ElfW(Wor
return true;
}
-void soinfo::apply_relr_reloc(ElfW(Addr) offset) {
+static void apply_relr_reloc(ElfW(Addr) offset, ElfW(Addr) load_bias) {
ElfW(Addr) address = offset + load_bias;
*reinterpret_cast<ElfW(Addr)*>(address) += load_bias;
}
@@ -2796,20 +2796,18 @@ void soinfo::apply_relr_reloc(ElfW(Addr) offset) {
// Process relocations in SHT_RELR section (experimental).
// Details of the encoding are described in this post:
// https://groups.google.com/d/msg/generic-abi/bX460iggiKg/Pi9aSwwABgAJ
-bool soinfo::relocate_relr() {
- ElfW(Relr)* begin = relr_;
- ElfW(Relr)* end = relr_ + relr_count_;
+bool relocate_relr(const ElfW(Relr)* begin, const ElfW(Relr)* end, ElfW(Addr) load_bias) {
constexpr size_t wordsize = sizeof(ElfW(Addr));
ElfW(Addr) base = 0;
- for (ElfW(Relr)* current = begin; current < end; ++current) {
+ for (const ElfW(Relr)* current = begin; current < end; ++current) {
ElfW(Relr) entry = *current;
ElfW(Addr) offset;
if ((entry&1) == 0) {
// Even entry: encodes the offset for next relocation.
offset = static_cast<ElfW(Addr)>(entry);
- apply_relr_reloc(offset);
+ apply_relr_reloc(offset, load_bias);
// Set base offset for subsequent bitmap entries.
base = offset + wordsize;
continue;
@@ -2820,7 +2818,7 @@ bool soinfo::relocate_relr() {
while (entry != 0) {
entry >>= 1;
if ((entry&1) != 0) {
- apply_relr_reloc(offset);
+ apply_relr_reloc(offset, load_bias);
}
offset += wordsize;
}
diff --git a/linker/linker.h b/linker/linker.h
index 275182fd4..ac2222d47 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -179,6 +179,7 @@ struct address_space_params {
int get_application_target_sdk_version();
ElfW(Versym) find_verdef_version_index(const soinfo* si, const version_info* vi);
bool validate_verdef_section(const soinfo* si);
+bool relocate_relr(const ElfW(Relr)* begin, const ElfW(Relr)* end, ElfW(Addr) load_bias);
struct platform_properties {
#if defined(__aarch64__)
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index c0a68afd7..089ecebf9 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -29,6 +29,7 @@
#include "linker_main.h"
#include <link.h>
+#include <stdlib.h>
#include <sys/auxv.h>
#include "linker.h"
@@ -220,14 +221,10 @@ static ExecutableInfo get_executable_info(const char* arg_path) {
exe_path = arg_path;
}
- // Path might be a symlink
+ // Path might be a symlink; we need the target so that we get the right
+ // linker configuration later.
char sym_path[PATH_MAX];
- ssize_t sym_path_len = readlink(exe_path, sym_path, sizeof(sym_path));
- if (sym_path_len > 0 && sym_path_len < static_cast<ssize_t>(sizeof(sym_path))) {
- result.path = std::string(sym_path, sym_path_len);
- } else {
- result.path = std::string(exe_path, strlen(exe_path));
- }
+ result.path = std::string(realpath(exe_path, sym_path) != nullptr ? sym_path : exe_path);
result.phdr = reinterpret_cast<const ElfW(Phdr)*>(getauxval(AT_PHDR));
result.phdr_count = getauxval(AT_PHNUM);
@@ -635,9 +632,10 @@ static void call_ifunc_resolvers_for_section(RelType* begin, RelType* end) {
}
}
-static void call_ifunc_resolvers() {
- // Find the IRELATIVE relocations using the DT_JMPREL and DT_PLTRELSZ, or DT_RELA? and DT_RELA?SZ
- // dynamic tags.
+static void relocate_linker() {
+ // The linker should only have relative relocations (in RELR) and IRELATIVE
+ // relocations. Find the IRELATIVE relocations using the DT_JMPREL and
+ // DT_PLTRELSZ, or DT_RELA/DT_RELASZ (DT_REL/DT_RELSZ on ILP32).
auto ehdr = reinterpret_cast<ElfW(Addr)>(&__ehdr_start);
auto* phdr = reinterpret_cast<ElfW(Phdr)*>(ehdr + __ehdr_start.e_phoff);
for (size_t i = 0; i != __ehdr_start.e_phnum; ++i) {
@@ -645,21 +643,33 @@ static void call_ifunc_resolvers() {
continue;
}
auto *dyn = reinterpret_cast<ElfW(Dyn)*>(ehdr + phdr[i].p_vaddr);
- ElfW(Addr) pltrel = 0, pltrelsz = 0, rel = 0, relsz = 0;
+ ElfW(Addr) relr = 0, relrsz = 0, pltrel = 0, pltrelsz = 0, rel = 0, relsz = 0;
for (size_t j = 0, size = phdr[i].p_filesz / sizeof(ElfW(Dyn)); j != size; ++j) {
- // We can't handle IRELATIVE relocations in DT_ANDROID_REL[A].
+ const auto tag = dyn[j].d_tag;
+ const auto val = dyn[j].d_un.d_ptr;
+ // We don't currently handle IRELATIVE relocations in DT_ANDROID_REL[A].
// We disabled DT_ANDROID_REL[A] at build time; verify that it was actually disabled.
- CHECK(dyn[j].d_tag != DT_ANDROID_REL && dyn[j].d_tag != DT_ANDROID_RELA);
- if (dyn[j].d_tag == DT_JMPREL) {
- pltrel = dyn[j].d_un.d_ptr;
- } else if (dyn[j].d_tag == DT_PLTRELSZ) {
- pltrelsz = dyn[j].d_un.d_ptr;
- } else if (dyn[j].d_tag == kRelTag) {
- rel = dyn[j].d_un.d_ptr;
- } else if (dyn[j].d_tag == kRelSzTag) {
- relsz = dyn[j].d_un.d_ptr;
+ CHECK(tag != DT_ANDROID_REL && tag != DT_ANDROID_RELA);
+ if (tag == DT_RELR || tag == DT_ANDROID_RELR) {
+ relr = val;
+ } else if (tag == DT_RELRSZ || tag == DT_ANDROID_RELRSZ) {
+ relrsz = val;
+ } else if (tag == DT_JMPREL) {
+ pltrel = val;
+ } else if (tag == DT_PLTRELSZ) {
+ pltrelsz = val;
+ } else if (tag == kRelTag) {
+ rel = val;
+ } else if (tag == kRelSzTag) {
+ relsz = val;
}
}
+ // Apply RELR relocations first so that the GOT is initialized for ifunc
+ // resolvers.
+ if (relr && relrsz) {
+ relocate_relr(reinterpret_cast<ElfW(Relr*)>(ehdr + relr),
+ reinterpret_cast<ElfW(Relr*)>(ehdr + relr + relrsz), ehdr);
+ }
if (pltrel && pltrelsz) {
call_ifunc_resolvers_for_section(reinterpret_cast<RelType*>(ehdr + pltrel),
reinterpret_cast<RelType*>(ehdr + pltrel + pltrelsz));
@@ -737,8 +747,12 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_addr + elf_hdr->e_phoff);
- // string.h functions must not be used prior to calling the linker's ifunc resolvers.
- call_ifunc_resolvers();
+ // Relocate the linker. This step will initialize the GOT, which is needed for
+ // accessing non-hidden global variables. (On some targets, the stack
+ // protector uses GOT accesses rather than TLS.) Relocating the linker will
+ // also call the linker's ifunc resolvers so that string.h functions can be
+ // used.
+ relocate_linker();
soinfo tmp_linker_so(nullptr, nullptr, nullptr, 0, 0);
@@ -750,7 +764,6 @@ extern "C" ElfW(Addr) __linker_init(void* raw_args) {
tmp_linker_so.phnum = elf_hdr->e_phnum;
tmp_linker_so.set_linker_flag();
- // Prelink the linker so we can access linker globals.
if (!tmp_linker_so.prelink_image()) __linker_cannot_link(args.argv[0]);
if (!tmp_linker_so.link_image(SymbolLookupList(&tmp_linker_so), &tmp_linker_so, nullptr, nullptr)) __linker_cannot_link(args.argv[0]);
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 074012d3b..ef7671cee 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -724,6 +724,16 @@ bool ElfReader::ReadPadSegmentNote() {
continue;
}
+ // If the PT_NOTE extends beyond the file. The ELF is doing something
+ // strange -- obfuscation, embedding hidden loaders, ...
+ //
+ // It doesn't contain the pad_segment note. Skip it to avoid SIGBUS
+ // by accesses beyond the file.
+ off64_t note_end_off = file_offset_ + phdr->p_offset + phdr->p_filesz;
+ if (note_end_off > file_size_) {
+ continue;
+ }
+
// note_fragment is scoped to within the loop so that there is
// at most 1 PT_NOTE mapped at anytime during this search.
MappedFileFragment note_fragment;
@@ -1270,11 +1280,6 @@ int phdr_table_map_gnu_relro(const ElfW(Phdr)* phdr_table,
#if defined(__arm__)
-
-# ifndef PT_ARM_EXIDX
-# define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
-# endif
-
/* Return the address and size of the .ARM.exidx section in memory,
* if present.
*
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index 4deed3349..61242eb4c 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -43,8 +43,8 @@ class ElfReader {
public:
ElfReader();
- bool Read(const char* name, int fd, off64_t file_offset, off64_t file_size);
- bool Load(address_space_params* address_space);
+ [[nodiscard]] bool Read(const char* name, int fd, off64_t file_offset, off64_t file_size);
+ [[nodiscard]] bool Load(address_space_params* address_space);
const char* name() const { return name_.c_str(); }
size_t phdr_count() const { return phdr_num_; }
@@ -61,18 +61,18 @@ class ElfReader {
bool should_pad_segments() const { return should_pad_segments_; }
private:
- bool ReadElfHeader();
- bool VerifyElfHeader();
- bool ReadProgramHeaders();
- bool ReadSectionHeaders();
- bool ReadDynamicSection();
- bool ReadPadSegmentNote();
- bool ReserveAddressSpace(address_space_params* address_space);
- bool LoadSegments();
- bool FindPhdr();
- bool FindGnuPropertySection();
- bool CheckPhdr(ElfW(Addr));
- bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
+ [[nodiscard]] bool ReadElfHeader();
+ [[nodiscard]] bool VerifyElfHeader();
+ [[nodiscard]] bool ReadProgramHeaders();
+ [[nodiscard]] bool ReadSectionHeaders();
+ [[nodiscard]] bool ReadDynamicSection();
+ [[nodiscard]] bool ReadPadSegmentNote();
+ [[nodiscard]] bool ReserveAddressSpace(address_space_params* address_space);
+ [[nodiscard]] bool LoadSegments();
+ [[nodiscard]] bool FindPhdr();
+ [[nodiscard]] bool FindGnuPropertySection();
+ [[nodiscard]] bool CheckPhdr(ElfW(Addr));
+ [[nodiscard]] bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
bool did_read_;
bool did_load_;
diff --git a/linker/linker_relocate.cpp b/linker/linker_relocate.cpp
index 40299e980..85f7b3aab 100644
--- a/linker/linker_relocate.cpp
+++ b/linker/linker_relocate.cpp
@@ -609,9 +609,13 @@ bool soinfo::relocate(const SymbolLookupList& lookup_list) {
relocator.tlsdesc_args = &tlsdesc_args_;
relocator.tls_tp_base = __libc_shared_globals()->static_tls_layout.offset_thread_pointer();
- if (relr_ != nullptr) {
+ // The linker already applied its RELR relocations in an earlier pass, so
+ // skip the RELR relocations for the linker.
+ if (relr_ != nullptr && !is_linker()) {
DEBUG("[ relocating %s relr ]", get_realpath());
- if (!relocate_relr()) {
+ const ElfW(Relr)* begin = relr_;
+ const ElfW(Relr)* end = relr_ + relr_count_;
+ if (!relocate_relr(begin, end, load_bias)) {
return false;
}
}
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index a5d31d58c..9a13af2a6 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -384,8 +384,6 @@ struct soinfo {
private:
bool relocate(const SymbolLookupList& lookup_list);
- bool relocate_relr();
- void apply_relr_reloc(ElfW(Addr) offset);
// This part of the structure is only available
// when FLAG_NEW_SOINFO is set in this->flags.
diff --git a/tests/headers/posix/limits_h.c b/tests/headers/posix/limits_h.c
index 7e92d8139..0ca80a5ca 100644
--- a/tests/headers/posix/limits_h.c
+++ b/tests/headers/posix/limits_h.c
@@ -130,10 +130,10 @@ static void limits_h() {
MACRO(CHARCLASS_NAME_MAX);
MACRO(COLL_WEIGHTS_MAX);
MACRO(EXPR_NEST_MAX);
- MACRO(LINE_MAX);
MACRO(NGROUPS_MAX);
MACRO(RE_DUP_MAX);
#endif
+ MACRO(LINE_MAX);
MACRO_VALUE(_POSIX_CLOCKRES_MIN, 20000000);
diff --git a/tests/limits_test.cpp b/tests/limits_test.cpp
index e5902ad9c..bc13a3f7f 100644
--- a/tests/limits_test.cpp
+++ b/tests/limits_test.cpp
@@ -21,6 +21,7 @@
TEST(limits, macros) {
ASSERT_EQ(8, CHAR_BIT);
ASSERT_EQ(8 * static_cast<int>(sizeof(int)), WORD_BIT);
+ ASSERT_EQ(2048, LINE_MAX);
ASSERT_EQ(20, NZERO);
#if !defined(MB_LEN_MAX)
#error MB_LEN_MAX
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 2b48d852b..bd17b82fa 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -678,10 +678,12 @@ TEST(malloc, mallopt_smoke) {
TEST(malloc, mallopt_decay) {
#if defined(__BIONIC__)
SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
+ ASSERT_EQ(1, mallopt(M_DECAY_TIME, -1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
+ ASSERT_EQ(1, mallopt(M_DECAY_TIME, -1));
#else
GTEST_SKIP() << "bionic-only test";
#endif
@@ -1490,7 +1492,7 @@ TEST(malloc, zero_init) {
// release secondary allocations back to the OS) was modified to 0ms/1ms by
// mallopt_decay. Ensure that we delay for at least a second before releasing
// pages to the OS in order to avoid implicit zeroing by the kernel.
- mallopt(M_DECAY_TIME, 1000);
+ mallopt(M_DECAY_TIME, 1);
TestHeapZeroing(/* num_iterations */ 32, [](int iteration) -> int {
return 1 << (19 + iteration % 4);
});
@@ -1764,6 +1766,10 @@ TEST(android_mallopt, get_decay_time_enabled) {
EXPECT_EQ(1, mallopt(M_DECAY_TIME, 1));
EXPECT_TRUE(android_mallopt(M_GET_DECAY_TIME_ENABLED, &value, sizeof(value)));
EXPECT_TRUE(value);
+
+ EXPECT_EQ(1, mallopt(M_DECAY_TIME, -1));
+ EXPECT_TRUE(android_mallopt(M_GET_DECAY_TIME_ENABLED, &value, sizeof(value)));
+ EXPECT_FALSE(value);
#else
GTEST_SKIP() << "bionic-only test";
#endif
diff --git a/tests/sys_hwprobe_test.cpp b/tests/sys_hwprobe_test.cpp
index 6b74e1875..fd59e1ddc 100644
--- a/tests/sys_hwprobe_test.cpp
+++ b/tests/sys_hwprobe_test.cpp
@@ -33,6 +33,68 @@
#include <sys/syscall.h>
#endif
+
+#if defined(__riscv)
+#include <riscv_vector.h>
+
+__attribute__((noinline))
+uint64_t scalar_cast(uint8_t const* p) {
+ return *(uint64_t const*)p;
+}
+
+__attribute__((noinline))
+uint64_t scalar_memcpy(uint8_t const* p) {
+ uint64_t r;
+ __builtin_memcpy(&r, p, sizeof(r));
+ return r;
+}
+
+__attribute__((noinline))
+uint64_t vector_memcpy(uint8_t* d, uint8_t const* p) {
+ __builtin_memcpy(d, p, 16);
+ return *(uint64_t const*)d;
+}
+
+__attribute__((noinline))
+uint64_t vector_ldst(uint8_t* d, uint8_t const* p) {
+ __riscv_vse8(d, __riscv_vle8_v_u8m1(p, 16), 16);
+ return *(uint64_t const*)d;
+}
+
+__attribute__((noinline))
+uint64_t vector_ldst64(uint8_t* d, uint8_t const* p) {
+ __riscv_vse64((unsigned long *)d, __riscv_vle64_v_u64m1((const unsigned long *)p, 16), 16);
+ return *(uint64_t const*)d;
+}
+
+// For testing scalar and vector unaligned accesses.
+uint64_t tmp[3] = {1,1,1};
+uint64_t dst[3] = {1,1,1};
+#endif
+
+TEST(sys_hwprobe, __riscv_hwprobe_misaligned_scalar) {
+#if defined(__riscv)
+ uint8_t* p = (uint8_t*)tmp + 1;
+ ASSERT_NE(0U, scalar_cast(p));
+ ASSERT_NE(0U, scalar_memcpy(p));
+#else
+ GTEST_SKIP() << "__riscv_hwprobe requires riscv64";
+#endif
+}
+
+TEST(sys_hwprobe, __riscv_hwprobe_misaligned_vector) {
+#if defined(__riscv)
+ uint8_t* p = (uint8_t*)tmp + 1;
+ uint8_t* d = (uint8_t*)dst + 1;
+
+ ASSERT_NE(0U, vector_ldst(d, p));
+ ASSERT_NE(0U, vector_memcpy(d, p));
+ ASSERT_NE(0U, vector_ldst64(d, p));
+#else
+ GTEST_SKIP() << "__riscv_hwprobe requires riscv64";
+#endif
+}
+
TEST(sys_hwprobe, __riscv_hwprobe) {
#if defined(__riscv) && __has_include(<sys/hwprobe.h>)
riscv_hwprobe probes[] = {{.key = RISCV_HWPROBE_KEY_IMA_EXT_0},
@@ -82,4 +144,4 @@ TEST(sys_hwprobe, __riscv_hwprobe_fail) {
#else
GTEST_SKIP() << "__riscv_hwprobe requires riscv64";
#endif
-}
+} \ No newline at end of file