Skip to content

Commit 72c9e24

Browse files
[libc][startup] fix main thread TLS unmapped with wrong value (#102009)
We have been unmapping a wrong address all the time. ```c munmap(0x704cffebb000, 41048) = 0 munmap(0x704cffec6000, 69632) = 0 munmap(0x704cffe9f000, 41048) = 0 munmap(0x704cffeaa000, 69632) = 0 munmap(0x704cffe83000, 41048) = 0 munmap(0x704cffe8e000, 69632) = 0 munmap(0x704cffe67000, 41048) = 0 munmap(0x704cffe72000, 69632) = 0 munmap(0x704cffe4b000, 41048) = 0 munmap(0x704cffe56000, 69632) = 0 munmap(0x704cffe2f000, 41048) = 0 munmap(0x704cffe3a000, 69632) = 0 munmap(0x704cfff51028, 41048) = -1 EINVAL (Invalid argument) ```
1 parent a113b4e commit 72c9e24

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/startup/linux/do_start.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static ThreadAttributes main_thread_attrib;
133133
// We register the cleanup_tls function to be the last atexit callback to be
134134
// invoked. It will tear down the TLS. Other callbacks may depend on TLS (such
135135
// as the stack protector canary).
136-
atexit([]() { cleanup_tls(tls.tp, tls.size); });
136+
atexit([]() { cleanup_tls(tls.addr, tls.size); });
137137
// We want the fini array callbacks to be run after other atexit
138138
// callbacks are run. So, we register them before running the init
139139
// array callbacks as they can potentially register their own atexit

0 commit comments

Comments
 (0)