Commit Graph

14 Commits (f853d6d9b75454ed125c6d025e2c0256a5c9fbdf)

Author SHA1 Message Date
jethrogb f853d6d9b7
Manually patch ret instruction for LVI (#359)
Co-authored-by: Jethro Beekman <jethro@fortanix.com>
2020-06-01 10:55:42 -05:00
Tyler Mandry cae3e6ea23
Set probestack visibility to hidden on ELF targets (#340) 2020-02-11 22:21:12 -08:00
Adam Schwalm d7191b14c1 Add separate rust_probestack definition for uefi (#335)
This is necessary because the Mach-O definition must have the
triple underscore, but the UEFI one must not.
2020-01-06 10:22:30 -06:00
Runji Wang 9193bbee5d Fix compile error on x86_64-unknown-uefi target (#331)
* fix compile error on x86_64-unknown-uefi target

* Fix tests on nightly
2019-12-10 09:02:14 -08:00
Tyler Mandry 2566aa663b Add control flow information to __rust_probestack (#328) 2019-12-06 08:51:42 -06:00
Dan Aloni 985a43095c probestack: add frame pointers for easier traceback
This turns the following backtrace,

```
>> bt
 #0  0x0000555555576f73 in __rust_probestack () at /cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.14/src/probestack.rs:55
Backtrace stopped: Cannot access memory at address 0x7fffff7fedf0
```

To this:

```
>>> bt
 #0  0x0000555555574e47 in __rust_probestack ()
 #1  0x00005555555595ba in test::main ()
 #2  0x00005555555594f3 in std::rt::lang_start::{{closure}} ()
 #3  0x0000555555561ae3 in std::panicking::try::do_call ()
 #4  0x000055555556595a in __rust_maybe_catch_panic ()
 #5  0x000055555555af9b in std::rt::lang_start_internal ()
 #6  0x00005555555594d5 in std::rt::lang_start ()
 #7  0x000055555555977b in main ()
```
2019-07-24 10:18:30 +03:00
Alex Crichton c88c9502b7 Run rustfmt over everything 2019-05-14 14:40:38 -07:00
Masaki Hara 1d15be6a86 Explain why we need extra check in probestack. 2018-05-28 13:29:35 +09:00
Masaki Hara 56293ad7c7 Fix segfault on probestack with dynamic alloca. 2018-05-27 23:28:17 +09:00
Dan Gohman a6ecd1a73f Add "volatile" and "memory" clobber to asm! that doesn't fall through.
Use the "volatile" option and the "memory" clobber on inline asm that does
things like return directly, to reduce the chances of compilers rearranging
the code.
2017-11-15 12:49:10 -08:00
Matt Ickstadt a40cc6a12d Don't compile probestack functions during testing 2017-09-15 18:13:06 -05:00
Alex Crichton 91eaa85902 Don't mangle probes all the time 2017-07-07 20:35:14 -07:00
Alex Crichton f9f6bd0589 Tweak definition of probestack functions
It looks like the old `__rust_probestack` routine is incompatible with newer
linux kernels. My best guess for this is that the kernel's auto-growth logic is
failing to trigger, causing what looks like a legitimate segfault to get
delivered. My best guess for why *that's* happening is that the faulting address
is below `%rsp`, whereas previously all faulting stack addresses were above
`%rsp`. The probestack routine does not modify `%rsp` as it's probing the stack,
and presumably newer kernels are interpreting this as a legitimate violation.

This commit tweaks the probestack routine to instead update `%rsp` incrementally
as probing happens. The ABI of the function, however, requires that `%rsp`
isn't changed as part of the function so it's restored at the end to the
previous value.
2017-07-07 10:16:03 -07:00
Alex Crichton 7ccf8408d0 Add `__rust_probestack` intrinsic
Will be required for rust-lang/rust#42816
2017-07-06 06:58:32 -07:00