Why do we need for an Undefined Behavior Annex to C++

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • rust

    Empowering everyone to build reliable and efficient software.

  • On Unix targets, it installs a signal handler for SIGSEGV and checks if the faulting address falls within the range of the stack guards. See https://github.com/rust-lang/rust/blob/411f34b/library/std/s...

    The stack guards would normally be setup by the system runtime (e.g. kernel in the case of the main thread stack, libc for thread stacks), not Rust's runtime. Likewise, stack probes that ensure stack operations don't skip guard pages are usually (always?) emitted by the compiler backend (e.g. GCC, LLVM), not Rust's instrumentation, per se.

    In this sense Rust isn't doing anything different than any other typical C or C++ binary, except hijacking SIGSEGV as Rust does is normally frowned upon, especially when it's merely for aesthetics--i.e. printing a pretty message. Also, attempting to introspect current thread metadata from a signal handler gives me pause. I'm not familiar enough with Rust to down the underlying code. I presume it's using at some POSIX threads interfaces, but POSIX thread interfaces aren't async-signal-safe, and though SIGSEGV is a synchronous signal, that doesn't mean the Rust runtime isn't technically relying on undefined behavior.

  • compiler-builtins

    Porting `compiler-rt` intrinsics to Rust

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts