summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/runtime.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/rustix/src/runtime.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/runtime.rs')
-rw-r--r--vendor/rustix/src/runtime.rs46
1 files changed, 42 insertions, 4 deletions
diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs
index 2cb0eba54..3c754a62f 100644
--- a/vendor/rustix/src/runtime.rs
+++ b/vendor/rustix/src/runtime.rs
@@ -4,7 +4,7 @@
//! Do not use the functions in this module unless you've read all of their
//! code. They don't always behave the same way as functions with similar names
//! in `libc`. Sometimes information about the differences is included in the
-//! Linux documentation under "C library/kernel differences" sections. And, if
+//! Linux documentation under “C library/kernel differences” sections. And, if
//! there is a libc in the process, these functions may have surprising
//! interactions with it.
//!
@@ -89,7 +89,7 @@ pub unsafe fn arm_set_tls(data: *mut c_void) -> io::Result<()> {
backend::runtime::syscalls::tls::arm_set_tls(data)
}
-/// `prctl(PR_SET_FS, data)`—Set the x86_64 `fs` register.
+/// `prctl(PR_SET_FS, data)`—Set the x86-64 `fs` register.
///
/// # Safety
///
@@ -101,7 +101,7 @@ pub unsafe fn set_fs(data: *mut c_void) {
backend::runtime::syscalls::tls::set_fs(data)
}
-/// Set the x86_64 thread ID address.
+/// Set the x86-64 thread ID address.
///
/// # Safety
///
@@ -188,7 +188,7 @@ pub const EXIT_FAILURE: i32 = backend::c::EXIT_FAILURE;
/// Return fields from the main executable segment headers ("phdrs") relevant
/// to initializing TLS provided to the program at startup.
///
-/// `addr` will always be non-null, even when the TLS data is absent, ao that
+/// `addr` will always be non-null, even when the TLS data is absent, so that
/// the `addr` and `file_size` parameters are suitable for creating a slice
/// with `slice::from_raw_parts`.
#[inline]
@@ -485,3 +485,41 @@ pub unsafe fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> {
pub unsafe fn sigtimedwait(set: &Sigset, timeout: Option<Timespec>) -> io::Result<Siginfo> {
backend::runtime::syscalls::sigtimedwait(set, timeout)
}
+
+/// `getauxval(AT_SECURE)`—Returns the Linux “secure execution” mode.
+///
+/// Return a boolean value indicating whether “secure execution” mode was
+/// requested, due to the process having elevated privileges. This includes
+/// whether the `AT_SECURE` AUX value is set, and whether the initial real UID
+/// and GID differ from the initial effective UID and GID.
+///
+/// The meaning of “secure execution” mode is beyond the scope of this comment.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man3/getauxval.3.html
+#[cfg(any(
+ linux_raw,
+ any(
+ all(target_os = "android", target_pointer_width = "64"),
+ target_os = "linux",
+ )
+))]
+#[inline]
+pub fn linux_secure() -> bool {
+ backend::param::auxv::linux_secure()
+}
+
+/// `brk(addr)`—Change the location of the “program break”.
+///
+/// # Safety
+///
+/// This is not identical to `brk` in libc. libc `brk` may have bookkeeping
+/// that needs to be kept up to date that this doesn't keep up to date, so
+/// don't use it unless you are implementing libc.
+#[cfg(linux_raw)]
+#[inline]
+pub unsafe fn brk(addr: *mut c_void) -> io::Result<*mut c_void> {
+ backend::runtime::syscalls::brk(addr)
+}