From nobody Tue Apr 29 18:51:10 2025 X-Original-To: freebsd-current@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 4Zn8Xy2LB0z5vPlG for ; Tue, 29 Apr 2025 18:51:14 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Zn8Xx5kffz3JrM for ; Tue, 29 Apr 2025 18:51:13 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3cfce97a3d9so28409275ab.2 for ; Tue, 29 Apr 2025 11:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; t=1745952672; x=1746557472; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wqE2MlW4rYrwK2zzfBZ3NJ+5D083vAbxZdh+rRu+UGk=; b=eSkOFzZIs2qK3xo7TQb00IMPEbryNF/8cNGaNDXPk2wBjhV7sMjtk0F1ftiuoPHcMi vbgkKvRL2Rvwvk2/bx/Qgp+zezD3yR+USa+0umfYxrXCsBKx8+JX/7kp9Wam0m/NDdKY 6DbRyw5dhydUBNJU3Csw1VFbt3OF3NxA8DhoIMT4S4MaCjgdiGLUSSEDWalWQj2OC15Q BGXl9p7T6SJIIxMYokdKmSJdLTFFBfbfb0qzzbdXyvQ2Xe9Tgmx0rCYbSxLNFojcO3Gd bJCY7zZSZjavrUBRNdbnqE2uFLZXGiyOsrmQBk+iXlYTytDgmT5PIo5+akToBOqzavT7 tb5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745952672; x=1746557472; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wqE2MlW4rYrwK2zzfBZ3NJ+5D083vAbxZdh+rRu+UGk=; b=fDh/5rvy7Uhp9CCZNL2u/roFMVTL4FqRu31ippF5zvrT1lWwMeLgtdJvrh7KEho8wc ZRGRs/rltX+5LKDWHCkCI/9SywfcNH4UaavnWZsf2UIof8fZtRKlam7p3kifPJXvivgd bzX2HFPijovpSsQHz54ghAs8OYa4LBeASGI0kDaz1N0KNBBPhuQtbsHSSlrW05nDz6FK fL1CyXmIUxQxwuBomYiLYcf84DIrUAr0N3i2MiUj6xgJRut9XrCnvbZ2mR68LpHJf4Tp 4ybPgt4B/VzsLmDXO1IZgSVUnFoePHe131X69iuY2unUmhjofQD3DWGeT3jKnMsxZLag dLzw== X-Gm-Message-State: AOJu0YyrRBCUNcV+ggkVw7Uu0Eemue724pte82SZLYt9ZE1cx6c72Uss h66tdJg8wm/I+GC8da4dErlaixd+U7Vm7sl14ykxa9Sjvd2kmTRKXh7c1mlSrEMBKzhk36Iqo39 Ks3g= X-Gm-Gg: ASbGncvZ+d13i3C08oOsxOXM5DOqBhRKjV1oIOzXScl9h6ECsJ5nIEIgZ1hi2eamPfz UWaYvKHPCSgL1fnZmVdeqesGqPyHOTfEl0mkHPjB46a7y4mkcRERH4x8R7s+x4MiqKqDbA5MEYo qxlbrWbn9P3hEBKto/i3ZxDWcomlyh50tDA4KONI/o8Gp8hhsTzjinJ4CzyipqYbcT149NKwY2Z bgTmvpbPupYhNjojnzhbWjQ5NwDfVFGjat6v+wcxc4M0wQqHw2rjLbCtd2DbMQcYDSMheefQ/2X 4Py+jh9Nf+zcL3ioqHt0i50= X-Google-Smtp-Source: AGHT+IF2T2I1U11qtyxjglrxQK7Q5NciDYBZZ+dZA3c9nbEGj/g70lzA14TwEE4OAIdPY8eXlq/MJw== X-Received: by 2002:a92:c24e:0:b0:3d0:47cf:869c with SMTP id e9e14a558f8ab-3d967721fcemr2910185ab.19.1745952672358; Tue, 29 Apr 2025 11:51:12 -0700 (PDT) Received: from mutt-hbsd ([2001:470:4001:1::95]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d95f48778fsm4403865ab.72.2025.04.29.11.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Apr 2025 11:51:11 -0700 (PDT) Date: Tue, 29 Apr 2025 18:51:10 +0000 From: Shawn Webb To: Dimitry Andric Cc: FreeBSD CURRENT Subject: Re: HEADS UP: libllvm, libclang, and liblldb converted into shared libraries Message-ID: <2pfbqyakovgznwj7yhnhzhbkygfpaeczx3jrufyuregxzfhfk6@v5o5qtg3vydr> X-Operating-System: FreeBSD mutt-hbsd 14.2-STABLE-HBSD FreeBSD 14.2-STABLE-HBSD HARDENEDBSD-14-STABLE amd64 X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <8173C7D9-F95A-4440-82DA-6CF160AAD6C2@FreeBSD.org> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="u4scxznso7yjpobv" Content-Disposition: inline In-Reply-To: X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4Zn8Xx5kffz3JrM X-Spamd-Bar: ---- --u4scxznso7yjpobv Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: HEADS UP: libllvm, libclang, and liblldb converted into shared libraries MIME-Version: 1.0 On Tue, Apr 29, 2025 at 08:44:50PM +0200, Dimitry Andric wrote: > On 29 Apr 2025, at 19:43, Shawn Webb wrote: > >=20 > > On Sun, Apr 27, 2025 at 07:42:44PM +0200, Dimitry Andric wrote: > >> On 27 Apr 2025, at 17:04, Shawn Webb wrot= e: > >>>=20 > >>> On Sat, Apr 26, 2025 at 06:06:54PM +0200, Dimitry Andric wrote: > >> ... > >>>> Please let me know if you encounter any problems resulting due to th= is > >>>> change, as I intend to MFC it. For example, I tried covering all > >>>> incremental build scenarios, but I may have missed some corner case. > >>>=20 > >>> Hey Dimitry, > >>>=20 > >>> I suspect this may be a problem specific to HardenedBSD, but it looks > >>> like cc occasionally crashes. It hits an assert at > >>> /usr/src/contrib/llvm-project/clang/lib/Driver/Driver.cpp:2702. > >>>=20 > >>> I can reproduce this by running `env SHELL=3D/bin/sh make buildenv` at > >>> the top of /usr/src. Though, it doesn't reproduce 100%, but perhaps > >>> around 60%. > >>=20 > >> It's asserting on this line: > >>=20 > >> assert(!CCGenDiagnostics && "stdin produces no crash reprod= ucer"); > >>=20 > >> I think during make buildenv the make framework will run cc --version > >> and ld --version to get at the compiler and linker version, but it cou= ld > >> be that it's doing some weird combination that hasn't been thought of. > >> Can you get the exact command line out of the debugger? > >=20 > > For some reason, I'm failing to figure out how to view the program's > > invocation using lldb or gdb. But, running `strings > > /usr/obj/usr/src/amd64.amd64/cc.core`, I see this, which may or may > > not be the arguments passed to cc: > >=20 > > =3D=3D=3D=3D BEGIN OUTPUT =3D=3D=3D=3D > > "-cc1" "-ferror-limit" "19" "-o" "-" "-disable-free" "-E" "-x" "c" "-" = "-tune-cpu" "generic" "-target-cpu" "x86-64" "-triple" > > "x86_64-unknown-freebsd15.0" "-resource-dir" "/usr/lib/clang/19" "-isys= tem" "/usr/lib/clang/19/include" "-internal-externc-i > > system" "/usr/include" "-std=3Dgnu17" "-fskip-odr-check-in-gmf" "-ftriv= ial-auto-var-init=3Dzero" "-fgnuc-version=3D4.2.1" "-ffp-con > > tract=3Don" "-fno-experimental-relative-c++-abi-vtables" "-fno-file-rep= roducible" "-O0" "-fdebug-compilation-dir=3D/usr/obj/usr/s > > rc/amd64.amd64" "-fcoverage-compilation-dir=3D/usr/obj/usr/src/amd64.am= d64" "-faddrsig" "-mrelocation-model" "static" "-debugge > > r-tuning=3Dgdb" "-funwind-tables=3D2" "-mconstructor-aliases" "-clear-a= st-before-backend" "-main-file-name" "-" "-mframe-pointer=3D > > all" "-fdiagnostics-hotness-threshold=3D0" "-fdiagnostics-misexpect-tol= erance=3D0" "-D" "__GCC_HAVE_DWARF2_CFI_ASM=3D1" > > =3D=3D=3D=3D END OUTPUT =3D=3D=3D=3D > >=20 > > I hope that helps. Otherwise, can you provide me a hint as to how to > > get lldb/gdb to show the arguments passed to cc? >=20 > "settings show target.run-args", but I just checked buildenv, and it real= ly only runs "cc --version" twice. If you do that in a loop, does it someti= mes crash? I think that `settings show...` command only pertains to actually executing the application: =3D=3D=3D=3D BEGIN OUTPUT =3D=3D=3D=3D $ lldb /usr/bin/cc -c /usr/obj/usr/src/amd64.amd64/cc.core (lldb) target create "/usr/bin/cc" --core "/usr/obj/usr/src/amd64.amd64/cc.= core" Core file '/usr/obj/usr/src/amd64.amd64/cc.core' (x86_64) was loaded. (lldb) settings show target.run-args target.run-args (arguments) =3D =3D=3D=3D=3D END OUTPUT =3D=3D=3D=3D Running `cc --version` does not reproduce the crash. I ran that in a loop over 200 iterations with zero crashes. I can reproduce it somewhat reliably with `env SHELL=3D/bin/sh make buildenv` at the top of the src tree. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Signal Username: shawn_webb.74 Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50 https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --u4scxznso7yjpobv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmgRH5cACgkQ/y5nonf4 4fplBA/+KXcZKHfOHIlH12omfK0MIRF6U14OR/HaEAAiHd7GiC43wkppavO1NiTo LZesYZVHCXB2FfJhN/1+YlcYvFyojpZxFqmp34ySKiEfqvZEqTFbLnLn7lMPZmJA X74zrprAFDo6j50Kh6g3cSXtveUk+jCZTk7QwnSGF4yTHMaB69b7GsKmZePEQHpF DglNCDk9fo5U2de8tRFIg9gc2FslKTwiF/BY767IIWJXkQ8R+6kAVV/ThCxIkGGt vZqswmAU9N6/nQRE4hCz7zT/t79ozA0ZigVs6WHIYIqwO173JpCGDRe+kIVNJup+ CVkB2/PNq1RCNlD9SCTJvclUue2DvfGeQzcWNJsLMjVhd9ghh4fIfvoj8RBdekmn 22xR1cpoSoiiSTE5aKe/kQutYhZ4Rb/cRFM+TQFEwAkC0L3Vq15Jn1M2HVKjPdn4 pbUG3jkNwFrBPmnPMQ4KzTNRq9+ZwUyut5HN07kjN5kfFcT7OV3ESLbKTLrSrLL6 XtcD4lPf4LquSGgw4M/CtyjlFHRFgA6e5RmtYHR8vkvw0nb3/desXhVTqsJtniIH NuU9tNJoUnwCg1rDZF2rwdoB713huYE7QC8ap54Np+ABLWxLAgdrccAGO9zx9PoK kA2ObZ9FWNl2G2/lMnfZk3+2bYRzUjgXkioJNA3HjStNen/YArs= =frXn -----END PGP SIGNATURE----- --u4scxznso7yjpobv--