From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>,
Stefan Liebler via Libc-alpha <libc-alpha@sourceware.org>
Cc: Stefan Liebler <stli@linux.ibm.com>
Subject: Re: [PATCH] S390: Enable static PIE
Date: Mon, 2 May 2022 12:38:35 -0300 [thread overview]
Message-ID: <760241d4-2f3e-7078-ad98-a4d8ed3fdc69@linaro.org> (raw)
In-Reply-To: <87y1zk70vk.fsf@oldenburg.str.redhat.com>
On 02/05/2022 06:13, Florian Weimer via Libc-alpha wrote:
> * Stefan Liebler via Libc-alpha:
>
>> This commit enables static PIE on 64bit. On 31bit, static PIE is
>> not supported.
>>
>> - kernel (the mentioned links to the commits belong to 5.19 merge window):
>> - "s390/mmap: increase stack/mmap gap to 128MB"
>> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=f2f47d0ef72c30622e62471903ea19446ea79ee2
>> - "s390/vdso: move vdso mapping to its own function"
>> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=57761da4dc5cd60bed2c81ba0edb7495c3c740b8
>> - "s390/vdso: map vdso above stack"
>> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=9e37a2e8546f9e48ea76c839116fa5174d14e033
>> - "s390/vdso: add vdso randomization"
>> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/commit/?h=features&id=41cd81abafdc4e58a93fcb677712a76885e3ca25
>> (We can't test the kernel of the target system)
>> Otherwise if /proc/sys/kernel/randomize_va_space is turned off (0),
>> static PIE executables like ldconfig will crash. While startup sbrk is
>> used to enlarge the HEAP. Unfortunately the underlying brk syscall fails
>> as there is not enough space after the HEAP. Then the address of the TLS
>> image is invalid and the following memcpy in __libc_setup_tls() leads
>> to a segfault.
>> If /proc/sys/kernel/randomize_va_space is activated (default: 2), there
>> is enough space after HEAP.
>
> I'll work an early allocator that does not use the TCB and which should
> avoid the sbrk crash. Will that be sufficient to enable static PIE
> binaries to run on unchanged kernels?
>
> Otherwise I fear that we end up in a world of pain if we turn ldconfig
> into a static PIE binary. 8-(
I agree that ideally it should not rely a patched kernel to overcome the
glibc issue of handling sbrk call failures and having a working loader
allocator that work regardless of kernel version is the best approach.
As I put on weekly call, I would prefer to make it only use mmap as
for simplicity.
next prev parent reply other threads:[~2022-05-02 15:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 14:15 Stefan Liebler
2022-05-02 9:13 ` Florian Weimer
2022-05-02 15:38 ` Adhemerval Zanella [this message]
2022-05-02 19:18 ` Florian Weimer
2022-05-03 12:56 ` Stefan Liebler
2022-05-03 15:36 ` Florian Weimer
2022-05-04 13:16 ` Stefan Liebler
2022-05-04 13:39 ` Florian Weimer
2022-05-19 7:49 ` [COMMITTED 2.35] " Stefan Liebler
2022-05-19 15:20 ` [COMMITTED 2.34] " Stefan Liebler
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=760241d4-2f3e-7078-ad98-a4d8ed3fdc69@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=stli@linux.ibm.com \
/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).