99 * any of the gcc libraries
1010 *
1111 * This gcc plugin is needed for tracking the lowest border of the kernel stack.
12- * It instruments the kernel code inserting stackleak_track_stack () calls:
12+ * It instruments the kernel code inserting __sanitizer_cov_stack_depth () calls:
1313 * - after alloca();
1414 * - for the functions with a stack frame size greater than or equal
1515 * to the "track-min-size" plugin parameter.
@@ -33,7 +33,7 @@ __visible int plugin_is_GPL_compatible;
3333
3434static int track_frame_size = -1 ;
3535static bool build_for_x86 = false;
36- static const char track_function [] = "stackleak_track_stack " ;
36+ static const char track_function [] = "__sanitizer_cov_stack_depth " ;
3737static bool disable = false;
3838static bool verbose = false;
3939
@@ -58,7 +58,7 @@ static void add_stack_tracking_gcall(gimple_stmt_iterator *gsi, bool after)
5858 cgraph_node_ptr node ;
5959 basic_block bb ;
6060
61- /* Insert calling stackleak_track_stack () */
61+ /* Insert calling __sanitizer_cov_stack_depth () */
6262 stmt = gimple_build_call (track_function_decl , 0 );
6363 gimple_call = as_a_gcall (stmt );
6464 if (after )
@@ -120,12 +120,12 @@ static void add_stack_tracking_gasm(gimple_stmt_iterator *gsi, bool after)
120120 gcc_assert (build_for_x86 );
121121
122122 /*
123- * Insert calling stackleak_track_stack () in asm:
124- * asm volatile("call stackleak_track_stack "
123+ * Insert calling __sanitizer_cov_stack_depth () in asm:
124+ * asm volatile("call __sanitizer_cov_stack_depth "
125125 * :: "r" (current_stack_pointer))
126126 * Use ASM_CALL_CONSTRAINT trick from arch/x86/include/asm/asm.h.
127127 * This constraint is taken into account during gcc shrink-wrapping
128- * optimization. It is needed to be sure that stackleak_track_stack ()
128+ * optimization. It is needed to be sure that __sanitizer_cov_stack_depth ()
129129 * call is inserted after the prologue of the containing function,
130130 * when the stack frame is prepared.
131131 */
@@ -137,7 +137,7 @@ static void add_stack_tracking_gasm(gimple_stmt_iterator *gsi, bool after)
137137 input = build_tree_list (NULL_TREE , build_const_char_string (2 , "r" ));
138138 input = chainon (NULL_TREE , build_tree_list (input , sp_decl ));
139139 vec_safe_push (inputs , input );
140- asm_call = gimple_build_asm_vec ("call stackleak_track_stack " ,
140+ asm_call = gimple_build_asm_vec ("call __sanitizer_cov_stack_depth " ,
141141 inputs , NULL , NULL , NULL );
142142 gimple_asm_set_volatile (asm_call , true);
143143 if (after )
@@ -151,11 +151,11 @@ static void add_stack_tracking(gimple_stmt_iterator *gsi, bool after)
151151{
152152 /*
153153 * The 'no_caller_saved_registers' attribute is used for
154- * stackleak_track_stack (). If the compiler supports this attribute for
155- * the target arch, we can add calling stackleak_track_stack () in asm.
154+ * __sanitizer_cov_stack_depth (). If the compiler supports this attribute for
155+ * the target arch, we can add calling __sanitizer_cov_stack_depth () in asm.
156156 * That improves performance: we avoid useless operations with the
157157 * caller-saved registers in the functions from which we will remove
158- * stackleak_track_stack () call during the stackleak_cleanup pass.
158+ * __sanitizer_cov_stack_depth () call during the stackleak_cleanup pass.
159159 */
160160 if (lookup_attribute_spec (get_identifier ("no_caller_saved_registers" )))
161161 add_stack_tracking_gasm (gsi , after );
@@ -165,7 +165,7 @@ static void add_stack_tracking(gimple_stmt_iterator *gsi, bool after)
165165
166166/*
167167 * Work with the GIMPLE representation of the code. Insert the
168- * stackleak_track_stack () call after alloca() and into the beginning
168+ * __sanitizer_cov_stack_depth () call after alloca() and into the beginning
169169 * of the function if it is not instrumented.
170170 */
171171static unsigned int stackleak_instrument_execute (void )
@@ -205,7 +205,7 @@ static unsigned int stackleak_instrument_execute(void)
205205 DECL_NAME_POINTER (current_function_decl ));
206206 }
207207
208- /* Insert stackleak_track_stack () call after alloca() */
208+ /* Insert __sanitizer_cov_stack_depth () call after alloca() */
209209 add_stack_tracking (& gsi , true);
210210 if (bb == entry_bb )
211211 prologue_instrumented = true;
@@ -241,7 +241,7 @@ static unsigned int stackleak_instrument_execute(void)
241241 return 0 ;
242242 }
243243
244- /* Insert stackleak_track_stack () call at the function beginning */
244+ /* Insert __sanitizer_cov_stack_depth () call at the function beginning */
245245 bb = entry_bb ;
246246 if (!single_pred_p (bb )) {
247247 /* gcc_assert(bb_loop_depth(bb) ||
@@ -270,15 +270,15 @@ static void remove_stack_tracking_gcall(void)
270270 rtx_insn * insn , * next ;
271271
272272 /*
273- * Find stackleak_track_stack () calls. Loop through the chain of insns,
273+ * Find __sanitizer_cov_stack_depth () calls. Loop through the chain of insns,
274274 * which is an RTL representation of the code for a function.
275275 *
276276 * The example of a matching insn:
277- * (call_insn 8 4 10 2 (call (mem (symbol_ref ("stackleak_track_stack ")
278- * [flags 0x41] <function_decl 0x7f7cd3302a80 stackleak_track_stack >)
279- * [0 stackleak_track_stack S1 A8]) (0)) 675 {*call} (expr_list
280- * (symbol_ref ("stackleak_track_stack ") [flags 0x41] <function_decl
281- * 0x7f7cd3302a80 stackleak_track_stack >) (expr_list (0) (nil))) (nil))
277+ * (call_insn 8 4 10 2 (call (mem (symbol_ref ("__sanitizer_cov_stack_depth ")
278+ * [flags 0x41] <function_decl 0x7f7cd3302a80 __sanitizer_cov_stack_depth >)
279+ * [0 __sanitizer_cov_stack_depth S1 A8]) (0)) 675 {*call} (expr_list
280+ * (symbol_ref ("__sanitizer_cov_stack_depth ") [flags 0x41] <function_decl
281+ * 0x7f7cd3302a80 __sanitizer_cov_stack_depth >) (expr_list (0) (nil))) (nil))
282282 */
283283 for (insn = get_insns (); insn ; insn = next ) {
284284 rtx body ;
@@ -318,7 +318,7 @@ static void remove_stack_tracking_gcall(void)
318318 if (SYMBOL_REF_DECL (body ) != track_function_decl )
319319 continue ;
320320
321- /* Delete the stackleak_track_stack () call */
321+ /* Delete the __sanitizer_cov_stack_depth () call */
322322 delete_insn_and_edges (insn );
323323#if BUILDING_GCC_VERSION < 8000
324324 if (GET_CODE (next ) == NOTE &&
@@ -340,12 +340,12 @@ static bool remove_stack_tracking_gasm(void)
340340 gcc_assert (build_for_x86 );
341341
342342 /*
343- * Find stackleak_track_stack () asm calls. Loop through the chain of
343+ * Find __sanitizer_cov_stack_depth () asm calls. Loop through the chain of
344344 * insns, which is an RTL representation of the code for a function.
345345 *
346346 * The example of a matching insn:
347347 * (insn 11 5 12 2 (parallel [ (asm_operands/v
348- * ("call stackleak_track_stack ") ("") 0
348+ * ("call __sanitizer_cov_stack_depth ") ("") 0
349349 * [ (reg/v:DI 7 sp [ current_stack_pointer ]) ]
350350 * [ (asm_input:DI ("r")) ] [])
351351 * (clobber (reg:CC 17 flags)) ]) -1 (nil))
@@ -375,7 +375,7 @@ static bool remove_stack_tracking_gasm(void)
375375 continue ;
376376
377377 if (strcmp (ASM_OPERANDS_TEMPLATE (body ),
378- "call stackleak_track_stack " )) {
378+ "call __sanitizer_cov_stack_depth " )) {
379379 continue ;
380380 }
381381
@@ -389,7 +389,7 @@ static bool remove_stack_tracking_gasm(void)
389389
390390/*
391391 * Work with the RTL representation of the code.
392- * Remove the unneeded stackleak_track_stack () calls from the functions
392+ * Remove the unneeded __sanitizer_cov_stack_depth () calls from the functions
393393 * which don't call alloca() and don't have a large enough stack frame size.
394394 */
395395static unsigned int stackleak_cleanup_execute (void )
@@ -474,13 +474,13 @@ static bool stackleak_gate(void)
474474 return track_frame_size >= 0 ;
475475}
476476
477- /* Build the function declaration for stackleak_track_stack () */
477+ /* Build the function declaration for __sanitizer_cov_stack_depth () */
478478static void stackleak_start_unit (void * gcc_data __unused ,
479479 void * user_data __unused )
480480{
481481 tree fntype ;
482482
483- /* void stackleak_track_stack (void) */
483+ /* void __sanitizer_cov_stack_depth (void) */
484484 fntype = build_function_type_list (void_type_node , NULL_TREE );
485485 track_function_decl = build_fn_decl (track_function , fntype );
486486 DECL_ASSEMBLER_NAME (track_function_decl ); /* for LTO */
0 commit comments