Bug 200615 - qemu-bsd-user fails to handle kinfo correctly for x11-toolkits/gnustep-gui
Summary: qemu-bsd-user fails to handle kinfo correctly for x11-toolkits/gnustep-gui
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Some People
Assignee: David Chisnall
Depends on:
Reported: 2015-06-03 15:32 UTC by Sean Bruno
Modified: 2015-06-19 19:03 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (theraven)


Note You need to log in before you can comment on or make changes to this bug.
Description Sean Bruno freebsd_committer 2015-06-03 15:32:44 UTC
There's a missing host to target arch conversion in qemu-bsd-user when handling kinifo:

 Linking service GSspell ...
 Creating GSspell.service/Resources...
 Creating GSspell.service/Resources/Info-gnustep.plist...
NSProcessInfo: kinfo_proc size mismatch (expected 816, got 1088)
Error: libkvm cannot find the current process
Abort trap (core dumped)
/usr/local/GNUstep/System/Library/Makefiles/Instance/service.make:144: recipe for target 'GSspell.service/Resources/Info-gnustep.plist' failed
gmake[4]: *** [GSspell.service/Resources/Info-gnustep.plist] Error 1
/usr/local/GNUstep/System/Library/Makefiles/Master/rules.make:298: recipe for target 'GSspell.all.service.variables' failed
gmake[3]: *** [GSspell.all.service.variables] Error 2
/usr/local/GNUstep/System/Library/Makefiles/Master/service.make:37: recipe for target 'internal-all' failed
gmake[2]: *** [internal-all] Error 2
/usr/local/GNUstep/System/Library/Makefiles/Master/serial-subdirectories.make:53: recipe for target 'internal-all' failed
gmake[1]: *** [internal-all] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/x11-toolkits/gnustep-gui/work/gnustep-gui-0.24.0'
*** Error code 1

make: stopped in /usr/ports/x11-toolkits/gnustep-gui
====>> Cleaning up wrkdir
Comment 1 David Chisnall freebsd_committer 2015-06-04 12:29:02 UTC
I don't remember exactly what gnustep uses libkvm for.  I think it's something fairly trivial, like getting the arguments to the running process.  We used to use /proc, but since the change to not mounting /proc by default we had to revert to this.  glibc provides a global variable that contains a copy of argv, which might be a sensible thing to consider adding.
Comment 2 Stacey Son freebsd_committer 2015-06-05 13:43:26 UTC
https://github.com/seanbruno/qemu-bsd-user/commit/f160a709984182f673a1887d37916b45a0d2a05f should fix this problem.

The kinfo_proc structure was not being properly sized and byte swapped by the sysctl() system handler.  The conversion is a bit messy given that kinfo_proc is a rather large and somewhat ugly structure.
Comment 3 Sean Bruno freebsd_committer 2015-06-05 16:27:28 UTC
The kinfo warning is now gone.  However, the build crashes qemu-arm:

 # lldb -c /usr/local/poudriere/data/.m/11armv6-default/ref/wrkdirs/usr/ports/x11-toolkits/gnustep-gui/work/gnustep-gui-0.24.0/Tools/qemu-arm.core /usr/local/bin/qemu-arm
(lldb) target create "/usr/local/bin/qemu-arm" --core "/usr/local/poudriere/data/.m/11armv6-default/ref/wrkdirs/usr/ports/x11-toolkits/gnustep-gui/work/gnustep-gui-0.24.0/Tools/qemu-arm.core"
Core file '/usr/local/poudriere/data/.m/11armv6-default/ref/wrkdirs/usr/ports/x11-toolkits/gnustep-gui/work/gnustep-gui-0.24.0/Tools/qemu-arm.core' (x86_64) was loaded.
Process 0 stopped
* thread #1: tid = 0, 0x00000000601634ca qemu-arm`_kill + 10, name = 'qemu-arm', stop reason = signal SIGSEGV
    frame #0: 0x00000000601634ca qemu-arm`_kill + 10
-> 0x601634ca <_kill+10>: jb     0x601979d4                ; .cerror
   0x601634d0 <_kill+16>: retq   
   0x601634d1: nop    
   0x601634d2: nop    
  thread #2: tid = 1, 0x000000006014830c qemu-arm`_umtx_op_err + 12, name = 'qemu-arm', stop reason = signal SIGSEGV
    frame #0: 0x000000006014830c qemu-arm`_umtx_op_err + 12
-> 0x6014830c <_umtx_op_err+12>: retq   
   0x6014830d <_umtx_op_err+13>: nop    
   0x6014830e <_umtx_op_err+14>: nop    
   0x6014830f <_umtx_op_err+15>: nop    
(lldb) bt
* thread #1: tid = 0, 0x00000000601634ca qemu-arm`_kill + 10, name = 'qemu-arm', stop reason = signal SIGSEGV
  * frame #0: 0x00000000601634ca qemu-arm`_kill + 10
    frame #1: 0x0000000060030568 qemu-arm`force_sig(target_sig=<unavailable>) + 280 at signal.c:352
    frame #2: 0x00000000600306c9 qemu-arm`queue_signal(env=<unavailable>, sig=11, info=<unavailable>) + 329 at signal.c:396
    frame #3: 0x000000006002c558 qemu-arm`cpu_loop [inlined] target_cpu_loop(env=<unavailable>) + 560 at target_arch_cpu.h:154
    frame #4: 0x000000006002c328 qemu-arm`cpu_loop(env=<unavailable>) + 1832 at main.c:207
    frame #5: 0x000000006002d10a qemu-arm`main(argc=-7432, argv=0x00007fffffffdab8) + 2490 at main.c:590
    frame #6: 0x000000006000030f qemu-arm`_start + 367
Comment 4 commit-hook freebsd_committer 2015-06-08 16:19:22 UTC
A commit references this bug:

Author: nox
Date: Mon Jun  8 16:18:22 UTC 2015
New revision: 388843
URL: https://svnweb.freebsd.org/changeset/ports/388843

  Catch up with github tree, adding translation of struct kinfo_proc -


  PR:		200615