@@ -55,88 +55,18 @@ Table I \
5555Summary of exploit mitigations supported by the Rust compiler when building
5656programs for the Linux operating system on the AMD64 architecture and
5757equivalent.
58- <table class =" table " >
59- <tr >
60- <td ><strong >Exploit mitigation</strong >
61- </td >
62- <td ><strong >Supported and enabled by default</strong >
63- </td >
64- <td ><strong >Since</strong >
65- </td >
66- </tr >
67- <tr >
68- <td >Position-independent executable
69- </td >
70- <td >Yes
71- </td >
72- <td >0.12.0 (2014-10-09)
73- </td >
74- </tr >
75- <tr >
76- <td >Integer overflow checks
77- </td >
78- <td >Yes (enabled when debug assertions are enabled, and disabled when debug assertions are disabled)
79- </td >
80- <td >1.1.0 (2015-06-25)
81- </td >
82- </tr >
83- <tr >
84- <td >Non-executable memory regions
85- </td >
86- <td >Yes
87- </td >
88- <td >1.8.0 (2016-04-14)
89- </td >
90- </tr >
91- <tr >
92- <td >Stack clashing protection
93- </td >
94- <td >Yes
95- </td >
96- <td >1.20.0 (2017-08-31)
97- </td >
98- </tr >
99- <tr >
100- <td >Read-only relocations and immediate binding
101- </td >
102- <td >Yes
103- </td >
104- <td >1.21.0 (2017-10-12)
105- </td >
106- </tr >
107- <tr >
108- <td >Heap corruption protection
109- </td >
110- <td >Yes
111- </td >
112- <td >1.32.0 (2019-01-17) (via operating system default or specified allocator)
113- </td >
114- </tr >
115- <tr >
116- <td >Stack smashing protection
117- </td >
118- <td >Yes
119- </td >
120- <td >Nightly
121- </td >
122- </tr >
123- <tr >
124- <td >Forward-edge control flow protection
125- </td >
126- <td >Yes
127- </td >
128- <td >Nightly
129- </td >
130- </tr >
131- <tr >
132- <td >Backward-edge control flow protection (e.g., shadow and safe stack)
133- </td >
134- <td >No
135- </td >
136- <td >
137- </td >
138- </tr >
139- </table >
58+
59+ | Exploit mitigation | Supported and enabled by default | Since |
60+ | - | - | - |
61+ | Position-independent executable | Yes | 0.12.0 (2014-10-09) |
62+ | Integer overflow checks | Yes (enabled when debug assertions are enabled, and disabled when debug assertions are disabled) | 1.1.0 (2015-06-25) |
63+ | Non-executable memory regions | Yes | 1.8.0 (2016-04-14) |
64+ | Stack clashing protection | Yes | 1.20.0 (2017-08-31) |
65+ | Read-only relocations and immediate binding | Yes | 1.21.0 (2017-10-12) |
66+ | Heap corruption protection | Yes | 1.32.0 (2019-01-17) (via operating system default or specified allocator) |
67+ | Stack smashing protection | Yes | Nightly |
68+ | Forward-edge control flow protection | Yes | Nightly |
69+ | Backward-edge control flow protection (e.g., shadow and safe stack) | Yes | Nightly |
14070
14171<small id =" fn:1 " >1\. See
14272< https://github.com/rust-lang/rust/tree/master/compiler/rustc_target/src/spec >
@@ -513,20 +443,21 @@ Newer processors provide hardware assistance for backward-edge control flow
513443protection, such as ARM Pointer Authentication, and Intel Shadow Stack as
514444part of Intel CET.
515445
516- The Rust compiler does not support shadow or safe stack. There is work
517- currently ongoing to add support for the sanitizers [ 40 ] , which may or may
518- not include support for safe stack< sup id = " fnref:7 " role = " doc-noteref " ><a
519- href="#fn:7" class="footnote">7</ a ></ sup > .
446+ The Rust compiler supports shadow stack for aarch64 only
447+ < sup id = " fnref:7 " role = " doc-noteref " >< a href = " #fn:7 " class = " footnote " >7</ a ></ sup >
448+ on nightly Rust compilers [ 43 ] - [ 44 ] . Safe stack is available on nightly
449+ Rust compilers [ 45 ] - [ 46 ] .
520450
521451``` text
522452$ readelf -s target/release/hello-rust | grep __safestack_init
453+ 1177: 00000000000057b0 444 FUNC GLOBAL DEFAULT 9 __safestack_init
523454```
524455Fig. 16. Checking if LLVM SafeStack is enabled for a given binary.
525456
526457The presence of the ` __safestack_init ` symbol indicates that LLVM SafeStack
527- is enabled for a given binary. Conversely, the absence of the
458+ is enabled for a given binary (see Fig. 16) . Conversely, the absence of the
528459` __safestack_init ` symbol indicates that LLVM SafeStack is not enabled for a
529- given binary (see Fig. 16) .
460+ given binary.
530461
531462<small id =" fn:7 " >7\. The shadow stack implementation for the AMD64
532463architecture and equivalent in LLVM was removed due to performance and
@@ -698,3 +629,15 @@ defaults (unrelated to `READ_IMPLIES_EXEC`).
698629
69963042 . bbjornse. “add codegen option for using LLVM stack smash protection #84197 .”
700631 GitHub. < https://github.com/rust-lang/rust/pull/84197 >
632+
633+ 43 . ivanloz. “Add support for LLVM ShadowCallStack. #98208 .” GitHub.
634+ < https://github.com/rust-lang/rust/pull/98208 > .
635+
636+ 44 . “ShadowCallStack.” The Rust Unstable Book.
637+ [ https://doc.rust-lang.org/unstable-book/compiler-flags/sanitizer.html#shadowcallstack ] ( ../unstable-book/compiler-flags/sanitizer.html#shadowcallstack ) .
638+
639+ 45 . W. Wiser. “Add support for LLVM SafeStack #112000 ” GitHub.
640+ < https://github.com/rust-lang/rust/pull/112000 >
641+
642+ 46 . “SafeStack.” The Rust Unstable Book.
643+ [ https://doc.rust-lang/org/unstable-book/compiler-flags/sanitizer.html#safestack ] ( ../unstable-book/compiler-flags/sanitizer.html#safestack ) .
0 commit comments