File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ fn main() {
2727 if args. len ( ) > 0 {
2828 match & args[ 0 ] [ ..] {
2929 "main-recurse" => overflow_recurse ( ) ,
30+ "main-tls-recurse" => tls_recurse ( ) ,
3031 "child-recurse" => thread:: spawn ( overflow_recurse) . join ( ) . unwrap ( ) ,
32+ "child-tls-recurse" => thread:: spawn ( tls_recurse) . join ( ) . unwrap ( ) ,
3133 "child-frame" => overflow_frame ( ) ,
3234 _ => panic ! ( ) ,
3335 }
@@ -42,8 +44,10 @@ fn main() {
4244 // details
4345 if cfg ! ( not( target_os = "linux" ) ) {
4446 assert_overflow ( Command :: new ( & me) . arg ( "main-recurse" ) ) ;
47+ assert_overflow ( Command :: new ( & me) . arg ( "main-tls-recurse" ) ) ;
4548 }
4649 assert_overflow ( Command :: new ( & me) . arg ( "child-recurse" ) ) ;
50+ assert_overflow ( Command :: new ( & me) . arg ( "child-tls-recurse" ) ) ;
4751 assert_overflow ( Command :: new ( & me) . arg ( "child-frame" ) ) ;
4852}
4953
@@ -56,6 +60,20 @@ fn recurse(array: &MaybeUninit<[u64; 1024]>) {
5660 recurse ( & local) ;
5761}
5862
63+ fn tls_recurse ( ) {
64+ struct RecursiveDrop ;
65+
66+ impl Drop for RecursiveDrop {
67+ fn drop ( & mut self ) {
68+ overflow_recurse ( ) ;
69+ }
70+ }
71+
72+ thread_local ! ( static LOCAL : RecursiveDrop = const { RecursiveDrop } ) ;
73+
74+ LOCAL . with ( |_| { } ) ;
75+ }
76+
5977#[ inline( never) ]
6078fn overflow_recurse ( ) {
6179 recurse ( & MaybeUninit :: uninit ( ) ) ;
You can’t perform that action at this time.
0 commit comments