Date: Fri, 21 Oct 2022 14:18:04 +0200 From: Kristof Provost <kp@FreeBSD.org> To: Konstantin Belousov <kib@FreeBSD.org> 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: <7F982005-246F-4607-A17B-08C81CE65E0B@FreeBSD.org> In-Reply-To: <202210061550.296FoVrm088661@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 <kib@FreeBSD.org> > AuthorDate: 2022-09-21 13:55:44 +0000 > Commit: Konstantin Belousov <kib@FreeBSD.org> > 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. Best regards, Kristof [-- Attachment #2 --] <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8"> </head> <body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;"> <p dir="auto">On 6 Oct 2022, at 17:50, Konstantin Belousov wrote:</p> </div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #136BCE; color: #136BCE;"><p dir="auto">The branch main has been updated by kib:</p> <p dir="auto">URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=9cabef3d146e9a844813b6bc8952d6cf2e9d45e5">https://cgit.FreeBSD.org/src/commit/?id=9cabef3d146e9a844813b6bc8952d6cf2e9d45e5</a></p> <p dir="auto">commit 9cabef3d146e9a844813b6bc8952d6cf2e9d45e5 <br> Author: Konstantin Belousov <kib@FreeBSD.org> <br> AuthorDate: 2022-09-21 13:55:44 +0000 <br> Commit: Konstantin Belousov <kib@FreeBSD.org> <br> CommitDate: 2022-10-06 15:50:26 +0000</p> <p dir="auto"> ldd: use direct exec mode unconditionally</p> <p dir="auto"> Trying to exec malformed or unusual binary, for instance, a non-FreeBSD <br> ABI, or using a non-standard interpreter, might give unexpected outcome.</p> <p dir="auto"> Reported by: The UK's National Cyber Security Centre (NCSC) <br> Reviewed by: emaste, markj, philip <br> Discussed with: jhb <br> Sponsored by: The FreeBSD Foundation <br> admbug: 991 <br> PR: 127276, 175339, 231926 <br> MFC after: 1 week <br> Differential revision: <a href="https://reviews.freebsd.org/D36650">https://reviews.freebsd.org/D36650</a></p> <br></blockquote></div> <div class="markdown" style="white-space: normal;"> <p dir="auto">This appears to break things for armv7 (running on aarch64).</p> <p dir="auto">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).</p> <p dir="auto">During that build a couple ports fail to build, including databases/sqlite3.<br> It fails running <code style="padding: 0 0.25em; background-color: #E4E4E4;">/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”</code>, which produces:</p> <pre style="margin-left: 15px; margin-right: 15px; padding: 5px; border: thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #E4E4E4;"><code style="padding: 0 0.25em; background-color: #E4E4E4;">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 </code></pre> <p dir="auto">That fails doing the <code style="padding: 0 0.25em; background-color: #E4E4E4;">mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0);</code> call in rtld-elf’s map_object():217. That call does <code style="padding: 0 0.25em; background-color: #E4E4E4;">mmap(0x10000, 0x1dc000, PROT_NONE, 0x6010, -1, 0) => 0xffffffff</code>.</p> <p dir="auto">With this patch reverted we can build successfully.</p> <p dir="auto">Best regards,<br> Kristof</p> </div> </div> </body> </html>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7F982005-246F-4607-A17B-08C81CE65E0B>
