SIGSYS: bad system call on OpenBSD

138 views
Skip to first unread message

John Jeffery

unread,
Feb 20, 2014, 9:51:43 PM2/20/14
to golan...@googlegroups.com
tl;dr summary: Is there a reason why sys_openbsd_386.s has a lot of "// crash" comments? My "hello world" application crashes at one of these lines. Is go on OpenBSD 386 broken?.

Longer version:

I would quite like to be able to run go programs on my Soekris net6501, which I use as a firewall appliance. It is running OpenBSD 5.1. I'm a bit new to cross-compiling, but have an environment setup on CentOS 6 which cross-compiles to OpenBSD 386. (I'm using tip).

When I attempt to run a simple Hello World app on the OpenBSD target I get the following:

  $ ./hello
  SIGSYS: bad system call
  PC=0x8065c17

  runtime.sigprocmask(0x3, 0x0)
          /home/go/src/pkg/runtime/sys_openbsd_386.s:163 +0x7 fp=0x                                                                                                 545cef44
  runtime.newosproc(0x1840f000, 0x545ecfcc)
          /home//go/src/pkg/runtime/os_openbsd.c:151 +0xb0 fp=0x545c                                                                                                 ef7c
  newm(0x805c0a0, 0x0)
          /home//go/src/pkg/runtime/proc.c:911 +0x9d fp=0x545cef98
  runtime.main()
          /home/go/src/pkg/runtime/proc.c:191 +0x38 fp=0x545cefcc
  runtime.goexit()
          /home/go/src/pkg/runtime/proc.c:1394 fp=0x545cefd0

  eax     0xfffefeff
  ebx     0x0
  ecx     0xffffffb2
  edx     0x184011e0
  edi     0x545ed000
  esi     0x80591d0
  ebp     0x0
  esp     0x545cef40
  eip     0x8065c17
  eflags  0x212
  cs      0x2b
  fs      0x5b
  gs      0x63
  $

OK, so I go and have a look at sys_openbsd_386.s at line 163 and see the following:

  160: TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
  161:        MOVL    $48, AX                 // sys_sigprocmask
  162:        INT     $0x80
  163:        JAE     2(PC)
  164:        MOVL    $0xf1, 0xf1             // crash
  165:        MOVL    AX, oset+0(FP)
  166:        RET

I have read that Go on OpenBSD requires version 5.4 and I'm running 5.1, but 5.1 does have the sigprocmask system call, so I thought I'd get a little further than this. I am a bit suspicious about the "// crash" comment on line 164, as that is exactly what is happening on my device.

Thanks in advance for any help on this.



Mikio Hara

unread,
Feb 20, 2014, 10:34:21 PM2/20/14
to John Jeffery, golang-nuts
On Fri, Feb 21, 2014 at 11:51 AM, John Jeffery <jjef...@sp.com.au> wrote:

> I would quite like to be able to run go programs on my Soekris net6501,
> which I use as a firewall appliance. It is running OpenBSD 5.1. I'm a bit
> new to cross-compiling, but have an environment setup on CentOS 6 which
> cross-compiles to OpenBSD 386. (I'm using tip).

FYI: https://code.google.com/p/go/source/detail?r=34a544cf1583

Both runtime and syscall packages hold platform, os+arch, adaptation
stuff but unfortunately it should be a continuous section of the
release, in this case from OpenBSD 5.4 to upcoming 5.x. I think you
have two options: use go1.0.x, or replacing tip's runtime/syscall
fragments with OpenBSD 5.1 suitable ones.

John Jeffery

unread,
Feb 20, 2014, 11:47:46 PM2/20/14
to golan...@googlegroups.com, John Jeffery
Upgrading to OpenBSD 5.4 is a bit problematic for me at the moment, but I took your advice and tried it with go1.0.3, and my "hello world" is working. (I did have to "syctl kern.rthreads=1" first).

Thanks for the advice Mikio. 
Reply all
Reply to author
Forward
0 new messages