• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン13fcd46ea7d2d93858061748d6428b900150f6ad (tree)
日時2018-08-10 23:02:45
作者Christophe Lyon <christophe.lyon@st.c...>
コミッターWaldemar Brodkorb

ログメッセージ

nptl: Clear TLS area for static binaries.

busybox init checks it has pid 1, but getpid() returns another value
when building busybox statically. This is because the corresponding
area is not cleared when allocated (it is allocated with
MAP_UNINITIALIZED, whose behavior depends on the Linux kernel's
CONFIG_MMAP_ALLOW_UNINITIALIZED).

This patch fixes the problem by explicitly clearing the memory area.

* libpthread/nptl/sysdeps/generic/libc-tls.c (libc_tls_setup):
Clear tlsblock.

Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>

変更サマリ

差分

--- a/libpthread/nptl/sysdeps/generic/libc-tls.c
+++ b/libpthread/nptl/sysdeps/generic/libc-tls.c
@@ -162,6 +162,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
162162 tcb_offset = roundup (tcbsize, align ?: 1);
163163 tlsblock = sbrk (tcb_offset + memsz + max_align
164164 + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
165+ memset(tlsblock, '\0', tcb_offset + memsz + max_align + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
165166 tlsblock += TLS_PRE_TCB_SIZE;
166167 # else
167168 /* In case a model with a different layout for the TCB and DTV