Bug 240763 - emulators/qemu-user-static: fails to run ports-mgmt/pkg on armv7 with clang9 base
Summary: emulators/qemu-user-static: fails to run ports-mgmt/pkg on armv7 with clang9 ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kyle Evans
URL:
Keywords: needs-qa
Depends on:
Blocks: 240629
  Show dependency treegraph
 
Reported: 2019-09-23 09:19 UTC by Jan Beich
Modified: 2019-11-01 14:38 UTC (History)
9 users (show)

See Also:


Attachments
Force sysctlbyname library call (workaround) (542 bytes, patch)
2019-10-02 19:07 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2019-09-23 09:19:42 UTC
$ poudriere jail -cj head-armv7 -x -a arm.armv7 -v projects/clang900-import -m svn+https
$ poudriere testport -j head-armv7 security/ca_root_nss
[...]
=======================<phase: pkg-depends    >============================
===>   ca_root_nss-3.46 depends on file: /usr/local/sbin/pkg - not found
===>   Installing existing package /packages/All/pkg-1.12.0.txz
qemu: unsupported syscall: 570 (calling anyway)
qemu: unsupported syscall: 570 (calling anyway)
Child process pid=467 terminated abnormally: Abort trap
*** Error code 134
Comment 1 Dimitry Andric freebsd_committer 2019-09-23 20:33:29 UTC
Hm, syscall 570 is __sysctlbyname, which was very recently added in base r351729 by mjg.  Maybe there is a kernel-jail version mismatch?
Comment 2 Sean Bruno freebsd_committer 2019-09-23 20:36:15 UTC
(In reply to Dimitry Andric from comment #1)
Oooo, yeah.  That's something we probably need to add to qemu-user if its going to be a problem.

Jan:

Can you see if the clang branch you are using works without the referenced syscall that was added?
Comment 3 Jan Beich freebsd_committer 2019-10-02 19:07:15 UTC
Created attachment 208046 [details]
Force sysctlbyname library call (workaround)

Disabling sysctlbyname syscall helps but only partially. poudriere still fails to build anything. Tested on /head@352951 + /projects/clang900-import@352764 + attached workaround.

$ poudriere testport -j head-armv7 security/ca_root_nss
[..]
=======================<phase: pkg-depends    >============================
===>   ca_root_nss-3.46 depends on file: /usr/local/sbin/pkg - not found
===>   Installing existing package /packages/All/pkg-1.12.0.txz
Installing pkg-1.12.0...
Extracting pkg-1.12.0: .......... done
*** Error code 127
Comment 4 Colin Percival freebsd_committer 2019-10-26 07:47:46 UTC
I'm seeing this same error ("qemu: unsupported syscall: 570 (calling anyway)") when trying to build ARM64 EC2 images.

root@freebsd:/usr/src/release # uname -a
FreeBSD freebsd 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r354057: Fri Oct 25 05:24:01 UTC 2019     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

root@freebsd:/usr/src/release # pkg info | grep qemu
qemu-user-static-2.11.50.g20190730 QEMU CPU Emulator github bsd-user branch - static user targets

The chroot in question was built from r354110 TARGET=arm64 TARGET_ARCH=aarch64.

Among other things, `/bin/ps` triggers this error.

Please let me know if there's anything I can do to help debug this; it's currently breaking ARM64 EC2 AMI builds on HEAD.
Comment 5 Kyle Evans freebsd_committer 2019-10-26 23:13:43 UTC
Take; committing fix soon.
Comment 6 commit-hook freebsd_committer 2019-10-27 00:08:57 UTC
A commit references this bug:

Author: kevans
Date: Sun Oct 27 00:08:04 UTC 2019
New revision: 515732
URL: https://svnweb.freebsd.org/changeset/ports/515732

Log:
  qemu-user-static: pull in fixes for the 2.x branch

  Short list:
  - __sysctlbyname(2) implemented
  - posix_spawn breakage due to RFSPAWN averted
  - some _umtx_op misbehavior fixed*

  Some _umtx_op operations were processing a timeout, but failed to pass in
  the size of the timespec/_umtx_time to the kernel, passing in '0' instead.
  This would cause unbounded sleep until interrupted, rather than timeout
  expected by the caller.

  PR:		240763
  Approved by:	ler (ports), sbruno (maintainer, implicit)
  MFH:		2019Q4 (runtime fix)

Changes:
  head/emulators/qemu-sbruno/Makefile
  head/emulators/qemu-sbruno/distinfo
Comment 7 Kyle Evans freebsd_committer 2019-11-01 14:38:51 UTC
Should be good as of latest qemu-sbruno update.