rust/library/std/src
Dylan DPC 64e7bf9fae
Rollup merge of #95626 - saethlin:pass-pointer-to-prctl, r=cuviper
Don't cast thread name to an integer for prctl

`libc::prctl` and the `prctl` definitions in glibc, musl, and the kernel headers are C variadic functions. Therefore, all the arguments (except for the first) are untyped. It is only the Linux man page which says that `prctl` takes 4 `unsigned long` arguments. I have no idea why it says this.

In any case, the upshot is that we don't need to cast the pointer to an integer and confuse Miri.

But in light of this... what are we doing with those three `0`s? We're passing 3 `i32`s to `prctl`, which doesn't fill me with confidence. The man page says `unsigned long` and all the constants in the linux kernel are macros for expressions of the form `1UL << N`. I'm mostly commenting on this because looks a whole lot like some UB that was found in SQLite a few years ago: <https://youtu.be/LbzbHWdLAI0?t=1925> that was related to accidentally passing a 32-bit value from a literal `0` instead of a pointer-sized value. This happens to work on x86 due to the size of pointers and happens to work on x86_64 due to the calling convention. But also, there is no good reason for an implementation to be looking at those arguments. Some other calls to `prctl` require that other arguments be zeroed, but not `PR_SET_NAME`... so why are we even passing them?

I would prefer to end such questions by either passing 3 `libc::c_ulong`, or not passing those at all, but I'm not sure which is better.
2022-04-07 01:59:22 +02:00
..
backtrace Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
collections Rollup merge of #94826 - allgoewer:fix-retain-documentation, r=yaahc 2022-03-11 03:32:06 +01:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
f32 Implement IEEE 754-2019 minimun and maximum functions for f32/f64 2021-11-20 10:14:03 +01:00
f64 Remove fNN::lerp - consensus unlikely 2021-10-25 22:44:41 -05:00
ffi add CStr::from_bytes_until_nul 2022-03-18 15:46:49 -07:00
fs Add a testcase. 2022-03-20 15:56:25 -07:00
io Rollup merge of #95185 - m-ou-se:stabilize-stdin-lines, r=Mark-Simulacrum 2022-04-07 01:59:21 +02:00
lazy Upgrade wasm32 image to Ubuntu 20.04 2021-02-06 13:05:56 +01:00
net Adjust feature names that disagree on const stabilization version 2022-03-31 12:34:48 -07:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Rollup merge of #88025 - devnexen:netbsd_scm_creds, r=Amanieu 2022-04-05 22:58:54 +02:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path Rollup merge of #94650 - ChrisDenton:windows-absolute-fix, r=dtolnay 2022-03-19 14:50:24 +01:00
prelude update cfg(bootstrap)s 2022-01-28 15:01:07 +01:00
process Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
sync Rename RWLock to RwLock in std::sys. 2022-04-06 16:33:53 +02:00
sys Rollup merge of #95626 - saethlin:pass-pointer-to-prctl, r=cuviper 2022-04-07 01:59:22 +02:00
sys_common Rename RWLock to RwLock in std::sys. 2022-04-06 16:33:53 +02:00
thread Refer to u8 by absolute path in expansion of thread_local 2022-04-02 11:38:11 -07:00
time Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
alloc.rs Auto merge of #88098 - Amanieu:oom_panic, r=nagisa 2022-03-18 03:01:46 +00:00
ascii.rs Convert many files to intra-doc links 2020-09-02 17:37:40 -04:00
backtrace.rs revert changes that cast functions to raw pointers, portability hazard 2022-03-29 20:18:27 -04:00
env.rs Link to std::io's platform-specific behavior disclaimer 2022-03-27 21:01:28 -07:00
error.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
f32.rs remove now unnecessary lang items 2022-03-30 11:23:58 +02:00
f64.rs remove now unnecessary lang items 2022-03-30 11:23:58 +02:00
fs.rs Document synchronicity 2022-04-05 08:14:13 +01:00
keyword_docs.rs Rollup merge of #93692 - mfrw:mfrw/document-keyword-in, r=dtolnay 2022-03-19 02:02:02 +01:00
lazy.rs Add #[must_use] to core and std constructors 2021-10-10 02:44:26 -04:00
lib.rs Stabilize total_cmp 2022-04-04 18:57:49 +09:00
macros.rs Format core and std macro rules, removing needless surrounding blocks 2022-03-11 15:26:51 -08:00
num.rs Add Saturating type (based on Wrapping type) 2021-08-10 19:27:01 +02:00
panic.rs Configure panic hook backtrace behavior 2022-02-02 13:46:42 -05:00
panicking.rs Rename RWLock to RwLock in std::sys. 2022-04-06 16:33:53 +02:00
path.rs Make the stdlib largely conform to strict provenance. 2022-03-29 20:18:21 -04:00
primitive_docs.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
process.rs fix since field version for termination stabilization 2022-03-29 17:10:49 -07:00
rt.rs Change Termination::report return type to ExitCode 2022-01-28 12:53:36 -08:00
time.rs Link to std::io's platform-specific behavior disclaimer 2022-03-27 21:01:28 -07:00