public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stefan Liebler <stli@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Fix __minimal_malloc segfaults in __mmap due to stack-protector
Date: Thu, 16 Dec 2021 14:19:46 +0000 (GMT)	[thread overview]
Message-ID: <20211216141946.0AB7F3858D28@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ff3cb03f38f851bbb066206573dc68914920be0a

commit ff3cb03f38f851bbb066206573dc68914920be0a
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Thu Dec 16 12:47:11 2021 +0100

    Fix __minimal_malloc segfaults in __mmap due to stack-protector
    
    Starting with commit b05fae4d8e34604a72ee36d2d3164391b76fcf0b
    "elf: Use the minimal malloc on tunables_strdup",
    I get lots of segfaults in static tests on s390x when also using, e.g.:
    export GLIBC_TUNABLES="glibc.elision.enable=1"
    
    tunables_strdup callls __minimal_malloc which tries to call __mmap
    due to insufficient space left. __mmap itself first setups a new
    stack frame and segfaults when copying the stack-protector canary
    from thread-pointer. The latter one is not yet setup.
    
    Thus this patch also turns off stack-protection for mmap.
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 misc/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 3b66cb9f6a..db40312ba9 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -149,6 +149,10 @@ CFLAGS-sbrk.o = $(no-stack-protector)
 CFLAGS-sbrk.op = $(no-stack-protector)
 CFLAGS-brk.o = $(no-stack-protector)
 CFLAGS-brk.op = $(no-stack-protector)
+CFLAGS-mmap.o = $(no-stack-protector)
+CFLAGS-mmap.op = $(no-stack-protector)
+CFLAGS-mmap64.o = $(no-stack-protector)
+CFLAGS-mmap64.op = $(no-stack-protector)
 
 include ../Rules


                 reply	other threads:[~2021-12-16 14:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216141946.0AB7F3858D28@sourceware.org \
    --to=stli@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).