Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Oct 2022 09:18:00 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Kristof Provost <kp@FreeBSD.org>, dev-commits-src-main@freebsd.org, "kib@freebsd.org" <kib@FreeBSD.org>
Subject:   Re: git: 9cabef3d146e - main - ldd: use direct exec mode unconditionally
Message-ID:  <EFD1D713-69AF-41FE-BC3B-C356A3BCC935@yahoo.com>
References:  <EFD1D713-69AF-41FE-BC3B-C356A3BCC935.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Kristof Provost <kp_at_FreeBSD.org> wrote on
Date: Fri, 21 Oct 2022 12:18:04 UTC :

> On 6 Oct 2022, at 17:50, Konstantin Belousov wrote:
> > The branch main has been updated by kib:
> >
> > URL:=20
> > =
https://cgit.FreeBSD.org/src/commit/?id=3D9cabef3d146e9a844813b6bc8952d6cf=
2e9d45e5
> >
> > 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=20
> > non-FreeBSD
> >     ABI, or using a non-standard interpreter, might give unexpected=20=

> > 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).
>=20
> This manifests while building pfsense (for 3100 / armv7), which we do =
on=20
> an aarch64 vm (to avoid having to deal with qemu, and because it=E2=80=99=
s=20
> faster).

My context is a Cortex-A72 system (a HoneyComb), just
via use of poudriere-devel armv7 jails (no qemu use):

# poudriere jail -jmain-CA7 -i
Jail name:         main-CA7
Jail version:      14.0-CURRENT
Jail arch:         arm.armv7
Jail method:       null
Jail mount:        /usr/obj/DESTDIRs/main-CA7-poud
Jail fs:          =20
Jail updated:      2021-06-27 17:58:33
Jail pkgbase:      disabled

where /usr/obj/DESTDIRs/main-CA7-poud has an installed armv7
world, following poudriere's requirements for such.

> During that build a couple ports fail to build, including=20
> databases/sqlite3.
> It fails running `/usr/bin/ldd -a=20
> =
"/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sql=
ite3"=20
> =
"/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/lib/lib=
sqlite3.so=E2=80=9D`,=20
> which produces:
>=20
> 	ld-elf.so.1:=20
> =
/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sqli=
te3:=20
> mmap of entire address space failed: Cannot allocate memory
> 	=
/wrkdirs/usr/ports/databases/sqlite3/work-default/stage/usr/local/bin/sqli=
te3:=20
> exit status 1

Same here. So far, my ports update also got such for attempting
to build devel/gobject-introspection :

ld-elf.so.1: =
/wrkdirs/usr/ports/devel/gobject-introspection/work/gobject-introspection-=
1.74.0/_build/tmp-introspectjq90y07h/GLib-2.0: mmap of entire address =
space failed: Cannot allocate memory
=
/wrkdirs/usr/ports/devel/gobject-introspection/work/gobject-introspection-=
1.74.0/_build/tmp-introspectjq90y07h/GLib-2.0: exit status 1
. . .
subprocess.CalledProcessError: Command '['ldd', =
'/wrkdirs/usr/ports/devel/gobject-introspection/work/gobject-introspection=
-1.74.0/_build/tmp-introspectjq90y07h/GLib-2.0']' returned non-zero exit =
status 1.

> That fails doing the `mapbase =3D mmap(base_addr, mapsize, PROT_NONE,=20=

> base_flags, -1, 0);` call in rtld-elf=E2=80=99s map_object():217. That =
call=20
> does `mmap(0x10000, 0x1dc000, PROT_NONE, 0x6010, -1, 0) =3D> =
0xffffffff`.
>=20
> With this patch reverted we can build successfully.

For reference (long output line split for readability):

# uname -apKU
FreeBSD CA72_16Gp_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #63
main-n258610-ba7319e9091b-dirty: Fri Oct 14 14:29:14 PDT 2022
=
root@CA72_16Gp_ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm6=
4.aarch64/sys/GENERIC-NODBG-CA72
arm64 aarch64 1400072 1400072

/usr/obj/DESTDIRs/main-CA7-poud has the same FreeBSD vintage,
but for armv7. (poudriere is still running.)

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EFD1D713-69AF-41FE-BC3B-C356A3BCC935>