From nobody Sun Oct 16 15:29:18 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mr3vP0VsCz4fSBM for ; Sun, 16 Oct 2022 15:29:21 +0000 (UTC) (envelope-from pauamma@gundo.com) Received: from mail.gundo.com (gibson.gundo.com [75.145.166.65]) by mx1.freebsd.org (Postfix) with ESMTP id 4Mr3vN2wXYz3YhJ for ; Sun, 16 Oct 2022 15:29:20 +0000 (UTC) (envelope-from pauamma@gundo.com) Received: from webmail.gundo.com (variax.gundo.com [75.145.166.70]) by mail.gundo.com (Postfix) with ESMTP id A684F4C0366; Sun, 16 Oct 2022 10:29:18 -0500 (CDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Date: Sun, 16 Oct 2022 15:29:18 +0000 From: Pau Amma To: Paul Floyd Cc: freebsd-hackers Subject: Re: AMD64 14.0-CURRENT memory layout changes In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.8 Message-ID: <18733815c5cf1af1e313168629916ee5@gundo.com> X-Sender: pauamma@gundo.com Organization: The Cabal (TINC) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Mr3vN2wXYz3YhJ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=gundo.com; spf=pass (mx1.freebsd.org: domain of pauamma@gundo.com designates 75.145.166.65 as permitted sender) smtp.mailfrom=pauamma@gundo.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gundo.com,none]; R_SPF_ALLOW(-0.20)[+ip4:75.145.166.64/28:c]; RCVD_IN_DNSWL_MED(-0.20)[75.145.166.65:from]; MIME_GOOD(-0.10)[text/plain]; RWL_MAILSPIKE_GOOD(-0.10)[75.145.166.65:from]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; R_DKIM_NA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; ASN(0.00)[asn:7922, ipnet:75.144.0.0/13, country:US]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[pauamma]; RCPT_COUNT_TWO(0.00)[2]; HAS_ORG_HEADER(0.00)[]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 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)