Skip to content

[0.2] Backports - #5454

Merged
tgross35 merged 93 commits into
rust-lang:libc-0.2from
tgross35:backport-orange-sweet
Aug 31, 2026
Merged

[0.2] Backports#5454
tgross35 merged 93 commits into
rust-lang:libc-0.2from
tgross35:backport-orange-sweet

Conversation

@tgross35

@tgross35 tgross35 commented Aug 31, 2026

Copy link
Copy Markdown
Member

Backport the following:

bushrat011899 and others added 30 commits August 31, 2026 10:26
Added in 27a38e3 causes `cargo-deny`
warnings due to the inclusion of an executable Python script.

(backport <rust-lang#5312>)
(cherry picked from commit 53bc12c)
The x86_64-linux-android job set TEST_CUTTLEFISH=1 in the workflow
matrix just so run-docker.sh could tell it apart.

Match on the target name instead, like the existing musl and
aarch64-linux-android checks, so the CI matrix carries no magic env
and running the job locally needs no special variable.

Suggested-by: Trevor Gross <tg@trevorgross.com>
Assisted-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>

(backport <rust-lang#5316>)
(cherry picked from commit aa2e589)
Also update wasmtime/wasi-sdk used in testing to keep them up-to-date.
All headers are located at https://github.com/WebAssembly/wasi-libc/blob/af323bda7f3ea816ebefd8e307619920432af89c/libc-top-half/musl/include/pthread.h

(backport <rust-lang#5310>)
(cherry picked from commit af22329)
* Extract wasi-sdk version information from `wasi/version.h`
* Conditionally verify `__wasi_rights_t` for the wasip1 target,
  deprecate it on other targets.
* Use `ptr::null_mut()`.

(backport <rust-lang#5310>)
(cherry picked from commit 0f50a2e)
Bumps [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm) from 1.4.2 to 1.4.4.
- [Release notes](https://github.com/vmactions/netbsd-vm/releases)
- [Commits](vmactions/netbsd-vm@0c26a4c...bf34bcd)

---
updated-dependencies:
- dependency-name: vmactions/netbsd-vm
  dependency-version: 1.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

(backport <rust-lang#5329>)
(cherry picked from commit 10d5038)
Bumps [taiki-e/install-action](https://github.com/taiki-e/install-action) from 2.84.0 to 2.85.2.
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](taiki-e/install-action@a6b2e2d...41049aa)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.85.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

(backport <rust-lang#5330>)
(cherry picked from commit 5414242)
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@9c091bb...3d3c42e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

(backport <rust-lang#5331>)
(cherry picked from commit 2eee169)
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.5.7 to 0.6.1.
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](zizmorcore/zizmor-action@192e21d...6fc4b00)

---
updated-dependencies:
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.6.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

(backport <rust-lang#5332>)
(cherry picked from commit 1f72f2c)
There is a conflict of `NETLINK_GENERIC` definitions between
`net/if_mib.h` and `netlink/netlink.h`. `netlink.h` is already exported
in the crate root for Linux (and those definitions are already used by
at least crates neli and netlink-packet-route.) `if_mib` does not seem
to be too widely used just yet, so this moves the `if_mib` module
contents into a namespace of their own to make space for `netlink`
support on FreeBSD (rust-lang#3194.)

Signed-off-by: Yann Dirson <yann.dirson@vates.fr>

Co-authored-by: dybucc <149513579+dybucc@users.noreply.github.com>

(backport <rust-lang#5325>)
(cherry picked from commit f51fe55)
(backport <rust-lang#5242>)
(cherry picked from commit 15a4536)
Add GNU/Hurd definition and skip the opaque type definition in the
top-level `unix` module. The definition fits that of [^1].

[^1]:
https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/bits/types/__fpos_t.h;h=bb04576651b9097b3027e4299cc30c88f334535f;hb=b5eecf35d91a3b29cff80b731bbc6bcce6863827

(backport <rust-lang#5242>)
(cherry picked from commit 442adc8)
Add uses of the `gnu_file_offset_bits64` `cfg` to the `hurd` module.
GNU/Hurd systems use glibc and that includes both the file offset and
`time_t` feature test macros. This patch ensures the right definition is
exposed on 64-unsuffixed types. Affected records don't directly use the
`cfg` to define their fields conditionally. They instead use the types
not prefixed with two underscores to define their fields. These types
are themselves conditionally defined. This avoids cluttering both the
type alias definition and the record definition.

(backport <rust-lang#5242>)
(cherry picked from commit fed788d)
Modify definition of `cpu_set_t` to use the same constant expression as
used upstream [^1]. This resolves to the same values as before but
relies on the conditional definition of the type `__cpu_mask` is defined
in terms of.

[^1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/bits/cpu-set.h;h=ddb79cefc2e5d93003f8da84eca6302f99153a22;hb=b5eecf35d91a3b29cff80b731bbc6bcce6863827

(backport <rust-lang#5242>)
(cherry picked from commit b518ad5)
Remove routine bindings that were already present in the `unix` module.
Those in the top-level `unix` module were already outfit with the
corresponding link name redirection under one of
`gnu_file_offset_bits64` or `gnu_time_bits64`. They have been preferred
over those in the `hurd` submodule.

(backport <rust-lang#5242>)
(cherry picked from commit 25a4d1f)
Add deprecation notices to `glob64_t` and 64-suffixed routines. The
bindings we expose have no difference whatsoever between `glob_t` and
`glob64_t`. Differing fields are exposed here as `void *`s.

(backport <rust-lang#5242>)
(cherry picked from commit 50ee7e3)
Add deprecation notice to `fallocate64` because this routine is only
exposed under Linux in glibc [^1].

[^1]:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/fcntl-linux.h;h=587b815124318864320973b864899b19466e46b8;hb=HEAD#l450

(backport <rust-lang#5242>)
(cherry picked from commit 611a311)
Add comments annotating file offset types and routines whose identifier
is 64-suffixed as slated for deprecation and eventual removal. this
holds only for 64-bit targets, so the comment adds a "parameter" to the
FIXME that will be found+replaced with a deprecation attribute later on.
These types otherwise provide redundant definitions.

(backport <rust-lang#5242>)
(cherry picked from commit d96acec)
Removes linking directory to libutil in MIPS32. This did not seem
necessary. Testing is pending.

(backport <rust-lang#5165>)
(cherry picked from commit 8b7c406)
Remove records that are already declared in top-level modules. This
affects x86_64 only. There is no such supported Rust target. This change
should virtually affect nobody.

(backport <rust-lang#5165>)
(cherry picked from commit 1d33a6e)
newlib errno is (*__errno()) so rust needs this to read errno.
std already links it on newlib

source
https://www.sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/sys/errno.h;hb=b6624e23e17bdc505f639d9f181225dbf3a50fc6

(backport <rust-lang#5346>)
(cherry picked from commit 8428e69)
(backport <rust-lang#5346>)
(cherry picked from commit 5c472fb)
`RUSTDOCFLAGS: -Dwarnings` is set for the whole CI workflow, but the
`docs` job runs on `ubuntu-26.04`, so it only ever documents the Linux
modules. Fifteen doc comments under `src/new` carry bare URLs, which
rustdoc reports as `this URL is not a hyperlink`, and all of them are in
Apple or BSD trees that the Linux job never compiles. The result is that
`cargo doc --workspace --no-deps` fails on those hosts while CI stays
green.

Wrapping each URL in angle brackets is the form already used elsewhere in
the same directories, for example `src/new/apple/xnu/net/mod.rs`.

Also drops a stray trailing apostrophe from the URL in
`src/new/freebsd/sys/mod.rs`.

Verified with `RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --target ...`,
which fails on `main` and passes here:

  aarch64-apple-darwin     3 errors -> ok
  x86_64-apple-darwin      3 errors -> ok
  x86_64-unknown-freebsd   9 errors -> ok
  x86_64-unknown-netbsd    1 error  -> ok

The remaining two lines are an OpenBSD module and an `i386` one; neither
target has a std available locally, so they are unverified, but the edit
is identical in form.

No API change, so there is nothing to add to `libc-test/semver`.

(backport <rust-lang#5353>)
(cherry picked from commit 9658498)
Add "android" to the Versions platform-version detection. Knowing it
allows version-gating the Android test skips instead of hardcoding them.

The level can appear in two macros:
  1. Old clang defines __ANDROID_API__ directly as an integer.
  2. Modern clang defines it as an alias of __ANDROID_MIN_SDK_VERSION__.

A toolchain whose target triple carries no API level defines neither
number, so nothing is parsed and the level stays undetected.

An undetected level (android == None) causes its consumers to treat it
conservatively: every API-gated skip stays active, as if the toolchain
targeted the oldest level possible.

Nothing consumes the value yet, so it has no effect on what is tested.
Next commits will add users for it.

Suggested-by: Trevor Gross <tg@trevorgross.com>
Assisted-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>

(backport <rust-lang#5280>)
(cherry picked from commit 61a5c68)
Convert the existing hardcoded "added in API level N" test skips into
gates on the detected API level added in the previous commit.

Items stay skipped when the toolchain builds below their introduction
level (or when no level was detected) and get tested once the toolchain
provably targets a high enough level.

There are no test coverage changes.

Assisted-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>

(backport <rust-lang#5280>)
(cherry picked from commit 1e77ff6)
apersomany and others added 23 commits August 31, 2026 11:58
Add SO_ATTACH_REUSEPORT_CBPF (51), SO_ATTACH_REUSEPORT_EBPF (52) and
SO_DETACH_REUSEPORT_BPF (68) to the Android module, as declared by bionic
in its kernel uapi asm-generic/socket.h:
https://android.googlesource.com/platform/bionic/+/731631f3/libc/kernel/uapi/asm-generic/socket.h

The generic architecture values apply to all Android ABIs.

Needed to compile aya for aarch64-linux-android.

(backport <rust-lang#5366>)
(cherry picked from commit 6b4c11a)
Socket options already exist for Apple (TCP_NODELAY, TCP_MAXSEG from
BSD, TCP_KEEPALIVE from Apple) but the header-and-options side doesn't.
This adds TH_*, the TCPOPT_*/TCPOLEN_* pairs, and the SACK limits. TH_*
is c_int because TH_AE is 0x100 and the composed masks exceed a byte.
TCPOPT_MULTIPATH left out, it's behind #if MPTCP and invisible to
userspace. MAX_SACK_BLKS got the usage-guidelines comment, the other two
limits are protocol-fixed.

https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/netinet/tcp.h#L107-L181

(backport <rust-lang#5358>)
(cherry picked from commit 530ed73)
(backport <rust-lang#5367>)
(cherry picked from commit 9e26f03)
(backport <rust-lang#5368>)
(cherry picked from commit 93a17ee)
`environ` is an array of pointers to the environment strings, declared
in <unistd.h> behind _GNU_SOURCE on glibc.

Ref: https://man7.org/linux/man-pages/man7/environ.7.html

(backport <rust-lang#5339>)
(cherry picked from commit cc74750)
This file could use some organization, so prepare for that.

(backport <rust-lang#5370>)
(cherry picked from commit 585c32e)
Avoid a new deprecation warning.

(backport <rust-lang#5374>)
(cherry picked from commit df2900e)
(backport <rust-lang#5374>)
(cherry picked from commit 3a6ec28)
These tests pass just fine for me on powerpc64le-unknown-linux-musl,
powerpc64-unknown-linux-musl and powerpc64le-unknown-linux-gnu.

(backport <rust-lang#5387>)
(cherry picked from commit 7dcbee3)
(backport <rust-lang#5383>)
(cherry picked from commit 7f28e6e)
Remove skip for `ioctl` and add `#define` for the macro required to get
this symbol's overload not to be exposed [^1]. This should allow there
to be only a single function signature against which to match.

[^1]: <https://cs.android.com/android/platform/superproject/+/android-latest-release:bionic/libc/include/bits/ioctl.h;l=45;drc=f769f7ed768d2f691e77e9605f2a1f57f414ba6e>

(backport <rust-lang#5384>)
(cherry picked from commit 60e7684)
The proper value for max_align_t was determined with the help of
a small C program which yielded a size of 24 for max_align_t with
an alignment of 8 bytes when compiled and run on s390x-linux:

glaubitz@zelenka:~$ cat max_align_t.c
#include <stdio.h>
#include <stddef.h>

int main() {

        printf("sizeof(max_align_t): %d\n", sizeof(max_align_t));
        printf("_Alignof(max_align_t): %d\n", _Alignof(max_align_t));
        return 0;
}
glaubitz@zelenka:~$ gcc max_align_t.c -o max_align_t
glaubitz@zelenka:~$ ./max_align_t
sizeof(max_align_t): 24
_Alignof(max_align_t): 8
glaubitz@zelenka:~$

(backport <rust-lang#5389>)
(cherry picked from commit 81abd81)
Leave a comment to deprecate LFS types once we reach stage 3 of the
64-bit deprecation story [^1].

[^1]: rust-lang#4805

(backport <rust-lang#5170>)
(cherry picked from commit 0773a60)
rust-lang/cc-rs#1845 was released which fixes
builds, so we can remove the pin.

Effectively reverts c106477 ("fix(ci): pin cc to 1.4.0").

(backport <rust-lang#5391>)
(cherry picked from commit 6f69e13)
[ reapplied for 0.2 - Trevor ]

(backport <rust-lang#5391>)
(cherry picked from commit 116b9ec)
Most of these got removed upstream a long time ago and have been
deprecated in `libc` for at least five years. Delete them, which allows
for some test code cleanup.

Closes: rust-lang#1356
Closes: rust-lang#1896

(backport <rust-lang#5401>)
(cherry picked from commit e2b191d)
(backport <rust-lang#5446>)
(cherry picked from commit bb23821)
(backport <rust-lang#5446>)
(cherry picked from commit 6ae84e4)
@tgross35
tgross35 force-pushed the backport-orange-sweet branch from 1a18eb1 to 9662db1 Compare August 31, 2026 11:58
@tgross35
tgross35 enabled auto-merge August 31, 2026 12:03
@tgross35
tgross35 added this pull request to the merge queue Aug 31, 2026
Merged via the queue into rust-lang:libc-0.2 with commit 4e6c3b1 Aug 31, 2026
55 checks passed
@tgross35
tgross35 deleted the backport-orange-sweet branch August 31, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.