Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Oct 2022 15:29:18 +0000
From:      Pau Amma <pauamma@gundo.com>
To:        Paul Floyd <paulf2718@gmail.com>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: AMD64 14.0-CURRENT memory layout changes
Message-ID:  <18733815c5cf1af1e313168629916ee5@gundo.com>
In-Reply-To: <bcfa260b-7a94-1414-a5ae-c281e96c76ec@gmail.com>
References:  <bcfa260b-7a94-1414-a5ae-c281e96c76ec@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2022-10-16 15:08, Paul Floyd wrote:
> Hi
> 
> I just noticed that the memory layout has changed for elf binaries
> running on amd64 (my last attempt to setup an i386 VM failed so I
> can't confirm if that also changed, and I'm not yet concerned by other
> platforms).
> 
> Here's a procstat -v for ksh93 on 13.1 on the host machine
> 
>> [snipped]
> 
> Here the stack starts at 0x7ffffffdf000
> 
> And the same on 14.0 running on a 4Gbyte VirtualBox VM
> 
>> [snipped]
> 
> ldrt is now mapped up at 0xeeeecc15000 and the user stack looks like
> it starts at 0x82073d000.
> 
> This is causing me problems with Valgrind, which creates the guest
> stack at 0x7ffffffdf000.
> 
> I haven't yet done any debugging of the problem but this causes
> 
> Fatal error 'Cannot allocate red zone for initial thread' at line 395
> in file /usr/src/lib/libthr/thread/thr_init.c (errno = 22)
> 
> for elf binaries linked with libthr.so
> 
> Can anyone point me to more information on this change? Phabricator
> for instance.
> 
> Are there any syscalls that control where rtld gets loaded and/or
> where the stack base is located?
> 
> Also is there a sysctl to disable this changed mapping, as a temporary
> workaround?

Jumoing in with some quarterly reports I saw pass that may be related to 
either/both:
- 
https://www.freebsd.org/status/report-2022-04-2022-06/#_shared_page_address_randomization 
(not sure this is about rtld)
- 
https://www.freebsd.org/status/report-2021-07-2021-09/#_stack_gap_handling_improvements 
(this one mentions a switch-off sysctl).

-- 
#BlackLivesMatter #TransWomenAreWomen #AccessibilityMatters 
#StandWithUkrainians
English: he/him/his (singular they/them/their/theirs OK)
French: il/le/lui (iel/iel and ielle/ielle OK)
Tagalog: siya/niya/kaniya (please avoid sila/nila/kanila)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18733815c5cf1af1e313168629916ee5>