diff mbox series

[Ada] Fix possible uninitialized ATCB component use

Message ID 20201216131535.GA69860@adacore.com
State New
Headers show
Series [Ada] Fix possible uninitialized ATCB component use | expand

Commit Message

Pierre-Marie de Rodat Dec. 16, 2020, 1:15 p.m. UTC
When System.Memory implementation is using Debug_Pools, Common ATCB's
uninitialized Global_Task_Lock_Nesting component may be used.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* libgnarl/s-tporft.adb (Register_Foreign_Thread): Set
	Global_Task_Lock_Nesting before using allocator.
diff mbox series

Patch

diff --git a/gcc/ada/libgnarl/s-tporft.adb b/gcc/ada/libgnarl/s-tporft.adb
--- a/gcc/ada/libgnarl/s-tporft.adb
+++ b/gcc/ada/libgnarl/s-tporft.adb
@@ -53,6 +53,7 @@  begin
 
    Local_ATCB.Common.LL.Thread := Thread;
    Local_ATCB.Common.Current_Priority := System.Priority'First;
+   Local_ATCB.Common.Global_Task_Lock_Nesting := 0;
    Specific.Set (Local_ATCB'Unchecked_Access);
 
    --  It is now safe to use an allocator