Skip to content

Update statx constants and types (Linux 6.8-6.14) #4401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rusty-snake
Copy link
Contributor

Description

This PR updates statx constants and types for features added in Linux 6.8 to 6.14.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot
Copy link
Collaborator

rustbot commented Apr 12, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-linux-like O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Apr 12, 2025
@rusty-snake
Copy link
Contributor Author

No idea why CI is failing.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as CI passes

@tgross35 tgross35 enabled auto-merge April 16, 2025 18:02
@tgross35 tgross35 force-pushed the statx-update branch 2 times, most recently from c70e79b to 1cb7f9b Compare April 25, 2025 04:51
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some of this may not be available on arm32 Android, can you check this against the bionic headers? https://cs.android.com/android/platform/superproject/main, cc @maurer

@rusty-snake
Copy link
Contributor Author

I'm not familiar with bionic/their source tree or how to check. Do we know it works on non-arm32 android (e.g. armv8)? Because the CI skipping it's sometimes hard to tell whether it broken because of architecture or libc or both. I can #[cfg] them out it this is wanted but I suspect it is more likely that they were added to recent. Android 15 uses Linux 6.6 as the "main-kernel" right now AFAIK. These were all added in Linux 6.8 and later. Bionic supports statx so I suspect it will also support these new flags.

Copy link

@maurer maurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr:

  • Remove support for statx_dio_read_align on Android; it won't arrive for at least a year.
  • Bump the NDK version to 28, and the rest of your stuff should work.

This is going to be compatible from the Android PoV - only STATX_DIO_READ_ALIGN is not yet present in bionic, and that's likely because the latest kernel version Android uses is 6.12 right now.

The reason you're getting an error from offsetof for stx_subvol is not because of the architecture, it's because NDK 27 (current LTS NDK) does not yet have that field. NDK 28 (stable and released, but not LTS) does.

Probably (subject to @tgross35 agreement) we should switch to NDK 28b in this PR.

Support in bionic for statx_dio_read_align is probably more than a year out, because Android needs to release a kernel >= 6.14, and then needs to have an NDK release. I don't anticipate any differences between our support and anyone else's, but no Android device will exist that supports it for at least a year, so it'd be a mistake to try to use it. I'd suggest configuring out statx_dio_read_align both field and constant.

pub const STATX_MNT_ID_UNIQUE: c_uint = 0x4000;
pub const STATX_SUBVOL: c_uint = 0x_0000_8000;
pub const STATX_WRITE_ATOMIC: c_uint = 0x_0001_0000;
pub const STATX_DIO_READ_ALIGN: c_uint = 0x_0002_0000;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant is not yet present in bionic, likely because it was introduced to Linux in 6.14, and the latest Android kernel is 6.12.

@tgross35
Copy link
Contributor

Probably (subject to @tgross35 agreement) we should switch to NDK 28b in this PR.

I have no objections to bumping the version. Is there any chance you, or anyone else from the android team / more familiar, might be able to do it in a separate PR? We have been having some pretty consistent intermittent failures (#4297), it would be good for somebody more familiar with the platform to double check that the way we are setting up and testing actually makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux-like O-unix S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants