Message ID | 20220315155507.1410297-1-sundeep.kokkonda@gmail.com |
---|---|
State | New |
Headers | show |
Series | [honister] gcc: sanitizer: Fix tsan against glibc 2.34 | expand |
> -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded- > core@lists.openembedded.org> On Behalf Of Sundeep KOKKONDA > Sent: Tuesday, March 15, 2022 11:55 PM > To: openembedded-core@lists.openembedded.org > Cc: rwmacleod@gmail.com; umesh.kalappa0@gmail.com; Sundeep KOKKONDA > <sundeep.kokkonda@gmail.com> > Subject: [OE-core] [honister][PATCH] gcc: sanitizer: Fix tsan against glibc 2.34 > > sanitizer: cherry pick 414482751452e54710f16bae58458c66298aaf69 > > The patch is needed in order to support recent glibc (2.34). > > libsanitizer/ChangeLog: > PR sanitizer/101749 > * sanitizer_common/sanitizer_posix_libcdep.cpp: Prevent > generation of dependency on _cxa_guard for static > initialization. > > Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com> > --- > meta/recipes-devtools/gcc/gcc-11.2.inc | 1 + > .../gcc/0042-Fix-thread-stack-size-init.patch | 18 ++++++++++++++++++ > 2 files changed, 19 insertions(+) > create mode 100644 meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size- > init.patch > > diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc- > 11.2.inc > index 40d2b59354..47575dba40 100644 > --- a/meta/recipes-devtools/gcc/gcc-11.2.inc > +++ b/meta/recipes-devtools/gcc/gcc-11.2.inc > @@ -77,6 +77,7 @@ SRC_URI = "\ > file://0003-CVE-2021-42574.patch \ > file://0004-CVE-2021-42574.patch \ > file://0001-CVE-2021-46195.patch \ > + file://0042-Fix-thread-stack-size-init.patch \ > " > SRC_URI[sha256sum] = > "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b" > > diff --git a/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch > b/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch > new file mode 100644 > index 0000000000..02ba2401bb > --- /dev/null > +++ b/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patc > +++ h > @@ -0,0 +1,18 @@ > +Upstream-Status: Backport > +[https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=90e46074e6b3561ae7d8ebd2 > +05127f286cc0c6b6] I think this link should be: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=91f8a7a34cf29ae7c465603a801326767f1cc7e9 This patch itself is missing your Signed-off-by. Please send a v2. Thanks, Anuj > +--- > +--- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp 2022-03-15 > 07:59:54.515325204 -0700 > ++++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp 2022-03-15 > 08:01:45.919405931 -0700 > +@@ -166,9 +166,10 @@ > + #if !SANITIZER_GO > + // TODO(glider): different tools may require different altstack size. > + static uptr GetAltStackSize() { > +- // SIGSTKSZ is not enough. > +- static const uptr kAltStackSize = SIGSTKSZ * 4; > +- return kAltStackSize; > ++ // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this > ++ may be // more costly that you think. However GetAltStackSize is > ++ only call 2-3 times // per thread so don't cache the evaluation. > ++ return SIGSTKSZ * 4; > + } > + > + void SetAlternateSignalStack() { > -- > 2.25.1
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc index 40d2b59354..47575dba40 100644 --- a/meta/recipes-devtools/gcc/gcc-11.2.inc +++ b/meta/recipes-devtools/gcc/gcc-11.2.inc @@ -77,6 +77,7 @@ SRC_URI = "\ file://0003-CVE-2021-42574.patch \ file://0004-CVE-2021-42574.patch \ file://0001-CVE-2021-46195.patch \ + file://0042-Fix-thread-stack-size-init.patch \ " SRC_URI[sha256sum] = "d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b" diff --git a/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch b/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch new file mode 100644 index 0000000000..02ba2401bb --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch @@ -0,0 +1,18 @@ +Upstream-Status: Backport [https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=90e46074e6b3561ae7d8ebd205127f286cc0c6b6] +--- +--- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp 2022-03-15 07:59:54.515325204 -0700 ++++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp 2022-03-15 08:01:45.919405931 -0700 +@@ -166,9 +166,10 @@ + #if !SANITIZER_GO + // TODO(glider): different tools may require different altstack size. + static uptr GetAltStackSize() { +- // SIGSTKSZ is not enough. +- static const uptr kAltStackSize = SIGSTKSZ * 4; +- return kAltStackSize; ++ // Note: since GLIBC_2.31, SIGSTKSZ may be a function call, so this may be ++ // more costly that you think. However GetAltStackSize is only call 2-3 times ++ // per thread so don't cache the evaluation. ++ return SIGSTKSZ * 4; + } + + void SetAlternateSignalStack() {
sanitizer: cherry pick 414482751452e54710f16bae58458c66298aaf69 The patch is needed in order to support recent glibc (2.34). libsanitizer/ChangeLog: PR sanitizer/101749 * sanitizer_common/sanitizer_posix_libcdep.cpp: Prevent generation of dependency on _cxa_guard for static initialization. Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@gmail.com> --- meta/recipes-devtools/gcc/gcc-11.2.inc | 1 + .../gcc/0042-Fix-thread-stack-size-init.patch | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc/0042-Fix-thread-stack-size-init.patch