Skip to content

Commit dc5745d

Browse files
committed
Fix documentation tests
1 parent 2b9e505 commit dc5745d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/doc/rustc/src/exploit-mitigations.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ randomization (ASLR). This is also referred to as “full ASLR”.
150150
The Rust compiler supports position-independent executable and enables it by
151151
default since version 0.12.0 (2014-10-09)[10][13].
152152

153-
```
153+
```text
154154
$ readelf -h target/release/hello-rust | grep Type:
155155
Type: DYN (Shared object file)
156156
```
@@ -171,15 +171,15 @@ resulting in an overflow or wraparound.
171171
The Rust compiler supports integer overflow checks, and enables it when
172172
debug assertions are enabled since version 1.1.0 (2015-06-25)[14][20].
173173

174-
```rust
174+
```compile_fail
175175
fn main() {
176176
let u: u8 = 255;
177177
println!("u: {}", u + 1);
178178
}
179179
```
180180
Fig. 2. hello-rust-integer program.
181181

182-
```
182+
```text
183183
$ cargo run
184184
Compiling hello-rust-integer v0.1.0 (/home/rcvalle/hello-rust-integer)
185185
Finished dev [unoptimized + debuginfo] target(s) in 0.23s
@@ -189,7 +189,7 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
189189
```
190190
Fig. 3. Build and execution of hello-rust-integer with debug assertions enabled.
191191

192-
```
192+
```text
193193
$ cargo run --release
194194
Compiling hello-rust-integer v0.1.0 (/home/rcvalle/hello-rust-integer)
195195
Finished release [optimized] target(s) in 0.23s
@@ -232,7 +232,7 @@ default since its initial release, version 0.1 (2012-01-20)[21], [22], but
232232
has regressed since then[23][25], and enforced by default since version
233233
1.8.0 (2016-04-14)[25].
234234

235-
```
235+
```text
236236
$ readelf -l target/release/hello-rust | grep -A 1 GNU_STACK
237237
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
238238
0x0000000000000000 0x0000000000000000 RW 0x10
@@ -299,7 +299,7 @@ also referred to as “partial RELRO”.
299299
The Rust compiler supports read-only relocations, and enables it by default
300300
since version 1.21.0 (2017-10-12)[30], [31].
301301

302-
```
302+
```text
303303
$ readelf -l target/release/hello-rust | grep GNU_RELRO
304304
GNU_RELRO 0x000000000002ee00 0x000000000002fe00 0x000000000002fe00
305305
```
@@ -321,7 +321,7 @@ RELRO”.
321321
The Rust compiler supports immediate binding, and enables it by default
322322
since version 1.21.0 (2017-10-12)[30], [31].
323323

324-
```
324+
```text
325325
$ readelf -d target/release/hello-rust | grep BIND_NOW
326326
0x000000000000001e (FLAGS) BIND_NOW
327327
```
@@ -366,7 +366,7 @@ C library default allocator<sup id="fnref:5" role="doc-noteref"><a
366366
href="#fn:5" class="footnote">5</a></sup> since version 1.32.0
367367
(2019-01-17)[39].
368368

369-
```rust
369+
```should_panic
370370
fn main() {
371371
let mut x = Box::new([0; 1024]);
372372
@@ -380,7 +380,7 @@ fn main() {
380380
```
381381
Fig. 11. hello-rust-heap program.
382382

383-
```
383+
```text
384384
$ cargo run
385385
Compiling hello-rust-heap v0.1.0 (/home/rcvalle/hello-rust-heap)
386386
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
@@ -390,7 +390,7 @@ Aborted
390390
```
391391
Fig. 12. Build and execution of hello-rust-heap with debug assertions enabled.
392392

393-
```
393+
```text
394394
$ cargo run --release
395395
Compiling hello-rust-heap v0.1.0 (/home/rcvalle/hello-rust-heap)
396396
Finished release [optimized] target(s) in 0.25s
@@ -456,7 +456,7 @@ class="footnote">6</a></sup>. There is work currently ongoing to add support
456456
for the [sanitizers](https://github.com/google/sanitizers)[40], which may or
457457
may not include support for LLVM CFI.
458458

459-
```
459+
```text
460460
$ readelf -s target/release/hello-rust | grep __cfi_init
461461
```
462462
Fig. 15. Checking if LLVM CFI is enabled for a given binary.
@@ -502,7 +502,7 @@ currently ongoing to add support for the sanitizers[40], which may or may
502502
not include support for safe stack<sup id="fnref:7" role="doc-noteref"><a
503503
href="#fn:7" class="footnote">7</a></sup>.
504504

505-
```
505+
```text
506506
$ readelf -s target/release/hello-rust | grep __safestack_init
507507
```
508508
Fig. 16. Checking if LLVM SafeStack is enabled for a given binary.

0 commit comments

Comments
 (0)