From owner-freebsd-hackers@freebsd.org Mon Feb 13 21:37:47 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A289ECDDDAD for ; Mon, 13 Feb 2017 21:37:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from springbank.echomania.com (springbank.echomania.com [IPv6:2a01:7c8:aab2:81::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "springbank.echomania.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4088F11CA; Mon, 13 Feb 2017 21:37:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com Received: from [IPv6:2001:7b8:3a7::edc2:5bd4:2353:56e3] (unknown [IPv6:2001:7b8:3a7:0:edc2:5bd4:2353:56e3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by springbank.echomania.com (Postfix) with ESMTPSA id 308E358007C; Mon, 13 Feb 2017 22:37:45 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_3BCA08C2-3953-4D19-907F-58478BF23ED1"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: GELI BIOS weirdness Date: Mon, 13 Feb 2017 22:37:34 +0100 In-Reply-To: Cc: Eric McCorkle , "freebsd-hackers@freebsd.org" To: cem@freebsd.org References: <6874308d-8892-2f03-d125-418949fd472c@metricspace.net> <919F6E39-476C-44B5-93EA-447D855921DE@FreeBSD.org> X-Mailer: Apple Mail (2.3259) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 21:37:47 -0000 --Apple-Mail=_3BCA08C2-3953-4D19-907F-58478BF23ED1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Yeah, but I'm interested in the symbols, otherwise it becomes hard to follow. Also, I've looked at my own copy of gptboot.o, and it doesn't contain those bytes at all. That said, my gptboot sources also don't have the lines: if (!(sc->sc_flags & G_ELI_FLAG_AUTH)) sc->sc_mediasize -=3D (sc->sc_mediasize % sc->sc_sectorsize); else { The only use of G_ELI_FLAG_AUTH is in sys/boot/geli/geliboot.c: /* Store the keys */ bcopy(mkey, geli_e->sc.sc_mkey, = sizeof(geli_e->sc.sc_mkey)); bcopy(mkey, geli_e->sc.sc_ivkey, = sizeof(geli_e->sc.sc_ivkey)); mkp =3D mkey + sizeof(geli_e->sc.sc_ivkey); if ((geli_e->sc.sc_flags & G_ELI_FLAG_AUTH) =3D=3D 0) { bcopy(mkp, geli_e->sc.sc_ekey, = G_ELI_DATAKEYLEN); } else { but the assembly for the rest of the geli_attach() function looks pretty reasonable. -Dimitry > On 13 Feb 2017, at 22:32, Conrad Meyer wrote: > "objdump -D -b binary -Mx86-64 -mi386 foo.bin" should work fine (no > symbols, though...). >=20 > Best, > Conrad >=20 > On Mon, Feb 13, 2017 at 1:16 PM, Dimitry Andric = wrote: >> On 13 Feb 2017, at 21:58, Eric McCorkle wrote: >>>=20 >>> On 02/13/2017 15:36, Dimitry Andric wrote: >>>=20 >>>> This disassembles to: >>>>=20 >>>> 0: 66 0f 38 f6 f0 adcx %eax,%esi >>>> 5: 31 c6 xor %eax,%esi >>>> 7: 8b 4d 14 mov 0x14(%ebp),%ecx >>>> a: 89 cf mov %ecx,%edi >>>> c: c1 ff 1f sar $0x1f,%edi >>>> f: 8b .byte 0x8b >>>=20 >>> Note that this was truncated, so the sar and .byte are probably a >>> truncated instruction. >>>=20 >>> Also, when I had printfs in place, I could see the call = instructions. >>>=20 >>>> My first guess would be that the code simply jumped into garbage. = But >>>> can you post the complete .o file somewhere for inspection? >>>=20 >>> Attached. >>> >>=20 >> Can you please post the file before it's been stripped and objcopied >> from ELF to binary format? That makes it a lot easier to disassemble >> and analyze... :) >>=20 >> -Dimitry >>=20 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org" --Apple-Mail=_3BCA08C2-3953-4D19-907F-58478BF23ED1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAliiJygACgkQsF6jCi4glqOroQCdHgFq7cC/znJ5WGlmFh5ZzAzp wPcAoIxZoQVsX8zgSAlPfYCRznoXEbOt =gFwf -----END PGP SIGNATURE----- --Apple-Mail=_3BCA08C2-3953-4D19-907F-58478BF23ED1--