Confirmed on multiple systems and also by kevans91 on IRC, who confirmed the issue is getopt(3) returning 1. This results in tpmd refusing to start under any conditions and only returning the usage error. Failure has 100% reproduction under -CURRENT. Root cause is use of signed char for getopt(3) return instead of int which is more correct for all platforms, so patch will need submitted upstream. Testing under 11.0-RELEASE showed no behavior change as expected. Code demonstrating the issue from kevans91 is available here: https://gist.github.com/anonymous/2cf21321e011cdf1555a8b174cc23bc4 On arm64: root@skyhorn ~ # uname -a FreeBSD skyhorn.SANITIZED 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r313109M: Thu Feb 2 16:16:39 MST 2017 raspberry@hive.raspbsd.org:/usr/home/brd/rpi3/crochet/work/obj/arm64.aarch64/usr/src/sys/GENERIC arm64 root@skyhorn ~ # cc test.c -o char_c test.c:8:54: warning: comparison of constant -1 with expression of type 'char' is always true [-Wtautological-constant-out-of-range-compare] while ((c = getopt(argc, argv, "dfs:u:o:g:c:h")) != -1) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~ 1 warning generated. root@skyhorn ~ # ./char_c 1 Handling option 255
Created attachment 182663 [details] Patch suitable for ${WRKSRC} and upstream submission
I have confirmed this patch resolves the issue. Port was built with patch added to files via qemu on poudriere system. tpm-emulator was reinstalled on test system and simple test performed. [root@ironhorn ~]# uname -a FreeBSD ironhorn.rootwyrm.pvt 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r313109M: Thu Feb 2 16:16:39 MST 2017 raspberry@hive.raspbsd.org:/usr/home/brd/rpi3/crochet/work/obj/arm64.aarch64/usr/src/sys/GENERIC arm64 [root@ironhorn ~]# service tpmd start Starting tpmd. tpmd.c:390: Info: starting TPM Emulator daemon (1.2.0.7-475) tpmd.c:93: Info: parsing options tpmd.c:164: Info: no startup mode was specified; asuming 'clear' tpmd.c:175: Info: switching effective group ID to 601 tpmd.c:182: Info: switching effective user ID to 601 tpmd.c:198: Info: installing signal handlers tpmd.c:220: Info: daemonizing process [root@ironhorn ~]# ps axuw | grep tpm _tss 3056 0.0 0.1 6800 1064 - Ss 13:33 0:00.42 /usr/local/bin/tpmd -o _tss -g _tss <trimmed 'pkg install trousers'> [root@ironhorn ~]# service tcsd start Starting tcsd. [root@ironhorn ~]# service tcsd status tcsd is running as pid 3084.
Further research reveals that the tpm-emulator project has moved to github. The version on github is significantly newer and has already addressed this issue fully. https://github.com/PeterHuewe/tpm-emulator
A commit references this bug: Author: ler Date: Sat Jun 3 21:56:26 UTC 2017 New revision: 442522 URL: https://svnweb.freebsd.org/changeset/ports/442522 Log: emulators/tpm-emulator: fail to run in arm64 due to improper getopt(3) use Add patch to fix it. PR: 219352 Submitted by: Phillip R. Jaenke <prj@rootwyrm.com> Approved by: maintainer timeout. Changes: head/emulators/tpm-emulator/Makefile head/emulators/tpm-emulator/files/patch-tpmd_unix_tpmd.c
Committed, thanks!