From nobody Fri Oct 21 12:50:07 2022 X-Original-To: dev-commits-src-all@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 4Mv47j3V2xz4gTp8; Fri, 21 Oct 2022 12:50:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mv47c43W1z3gtc; Fri, 21 Oct 2022 12:50:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 29LCo7aD069377 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 21 Oct 2022 15:50:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 29LCo7c4069376; Fri, 21 Oct 2022 15:50:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 21 Oct 2022 15:50:07 +0300 From: Konstantin Belousov To: Kristof Provost Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9cabef3d146e - main - ldd: use direct exec mode unconditionally Message-ID: References: <202210061550.296FoVrm088661@gitrepo.freebsd.org> <7F982005-246F-4607-A17B-08C81CE65E0B@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7F982005-246F-4607-A17B-08C81CE65E0B@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on tom.home X-Rspamd-Queue-Id: 4Mv47c43W1z3gtc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.36 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.36)[-0.356]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_XAW(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, Oct 21, 2022 at 02:18:04PM +0200, Kristof Provost wrote: > On 6 Oct 2022, at 17:50, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=9cabef3d146e9a844813b6bc8952d6cf2e9d45e5 > > > > commit 9cabef3d146e9a844813b6bc8952d6cf2e9d45e5 > > Author: Konstantin Belousov > > AuthorDate: 2022-09-21 13:55:44 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2022-10-06 15:50:26 +0000 > > > > ldd: use direct exec mode unconditionally > > > > Trying to exec malformed or unusual binary, for instance, a > > non-FreeBSD > > ABI, or using a non-standard interpreter, might give unexpected > > outcome. > > > > Reported by: The UK's National Cyber Security Centre (NCSC) > > Reviewed by: emaste, markj, philip > > Discussed with: jhb > > Sponsored by: The FreeBSD Foundation > > admbug: 991 > > PR: 127276, 175339, 231926 > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D36650 > > > This appears to break things for armv7 (running on aarch64). > > This manifests while building pfsense (for 3100 / armv7), which we do on an > aarch64 vm (to avoid having to deal with qemu, and because it’s faster). > > During that build a couple ports fail to build, including databases/sqlite3. > It fails running `/usr/bin/ldd -a "/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sqlite3" "/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/lib/libsqlite3.so”`, > which produces: > > ld-elf.so.1: /wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sqlite3: > mmap of entire address space failed: Cannot allocate memory > /wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sqlite3: > exit status 1 > > That fails doing the `mapbase = mmap(base_addr, mapsize, PROT_NONE, > base_flags, -1, 0);` call in rtld-elf’s map_object():217. That call does > `mmap(0x10000, 0x1dc000, PROT_NONE, 0x6010, -1, 0) => 0xffffffff`. > > With this patch reverted we can build successfully. Can you manually invoke ldd on the binary under ktrace -i, and show me the kdump output? Thanks.