From: ron minnich <rminnich@gmail.com>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] go floating point exception
Date: Sat, 3 Jan 2026 10:24:50 -0800 [thread overview]
Message-ID: <CAP6exYKZ1jm_BWXwwSiMifcZE6v_pzMuguYgWhX87x6Jr9TeMg@mail.gmail.com> (raw)
In-Reply-To: <3746EE9319D07AD91D8874CFAC7AEC94@eigenstate.org>
[-- Attachment #1: Type: text/plain, Size: 7287 bytes --]
Go will print a stack backtrace on Plan 9 (I just tried it) if given half a
chance.
I wonder if that suicide is sending a note or not, or it's just getting
peremptorily killed.
On Fri, Jan 2, 2026 at 8:59 PM <ori@eigenstate.org> wrote:
>
> Quoth hahahahacker2009@gmail.com:
> > > btw, cdid you get a stack trace from the go runtime? or just that one
> > > l ine diagnostic?
> >
> > I only get that line. The program was cross-compiled on arm, with
> > Geoff's userland (a bit different from 9legacy's userland), but it
> > doesn't matter, right?
> >
> > Currently I can't lstk() in acid, it says ``no stack frame''
>
> I don't think Go generates Plan 9 debug information, so you'd have
> to poke around by hand, with an understanding of the ABI. For example,
>
> asm(0x215443)
>
> will tell you the faulting instruction, for example. The caller's PC
> will be at the top of the stack frame, and I don't recall the register
> locations.
>
> Outside of that, looking at the code for 9legacy, it seems that the
> default FPU settings are set up in sys/src/9k/k10/fpu.c:489:
>
> m->fcw = RCn|PCd|P|U|D;
>
> where the flags have the following meanings:
>
> enum { /* FCW, FSW and
> MXCSR */
> I = 0x00000001, /*
> Invalid-Operation */
> D = 0x00000002, /*
> Denormalized-Operand */
> Z = 0x00000004, /* Zero-Divide */
> O = 0x00000008, /* Overflow */
> U = 0x00000010, /* Underflow */
> P = 0x00000020, /* Precision */
> };
>
> that said, Go seems to be setting the masks it expencts, in:
>
> src/runtime/os_plan9.go:215: setfpmasks()
> src/runtime/sys_plan9_amd64.s:220: TEXT
> runtime·setfpmasks(SB),NOSPLIT,$8
>
> Which t calls with the comment:
>
> // Mask all SSE floating-point exceptions
> // when running on the 64-bit kernel.
> setfpmasks()
>
> Interestingly, the setfpmasks() function seems to be
> a no-op on 32 bit kernels, but that shouldn't be an
> issue here. Go seems to be setting this correctly,
> though I have only skimmed the docs for the
> LDMXCSR/STMXCSR instructions.
>
> When testing locally (9front), I ran:
>
> for(i in `{seq 1000}){ {
> ./https; echo killed $i} &
> sleep 0.1; kill https | rc
> }
>
> and could not reproduce; assuming that this is what
> I'd normally need to reproduce your issue, it seems
> that Go is likely doing the right thing here?
>
> > >
> > > On Fri, Jan 2, 2026 at 8:19 AM ron minnich <rminnich@gmail.com> wrote:
> > >>
> > >> I wonder why that exception is enabled? I wonder what is enabling it?
> > >> Does the go runtime turn it on?
> > >>
> > >> on linux, mxcsr is 0x1f80, all exceptions masked, and in particular,
> 0x20 is not set -- no precision exceptions.
> > >>
> > >> On Fri, Jan 2, 2026 at 6:23 AM <hahahahacker2009@gmail.com> wrote:
> > >>>
> > >>> Hello,
> > >>> I don't know go, just have it to compile some programs.
> > >>> I cross-compiled this http server from arm for amd64:
> > >>> https://mkws.sh/https/https.go
> > >>>
> > >>> Running it on 9legacy/amd64 (under qemu) will raise this error 50% of
> > >>> the time (otherwise it works pretty well):
> > >>> gohttp 177: suicide: sys: fp: Precision Exception mxcsr=0x20
> pc=0x215443
> > >>>
> > >>> Plan 9
> > >>> mmuinit: vmstart 0xfffffffff0000000 vmunused 0xfffffffff03cc000
> vmunmapped 0xfffffffff0400000 vmend 0xfffffffffe000000
> > >>> sys->pd 0x108003 0x108023
> > >>> l 3 0xffffff7fbfdfeff8 107023
> > >>> l 2 0xffffff7fbfdffff8 108023
> > >>> l 1 0xffffff7fbffffc00 e3
> > >>> l 1 0xffffff7fbffffc00 e3
> > >>> base 0xfffffffff03d0000 ptr 0xfffffffff03d0000 nunits 14430208
> > >>> physalloc color=0 base=0xe000000 size=0x71fe0000
> > >>> apic0: hz 998949300 max 9989493 min 99894 div 3
> > >>> intrenable: nil handler for 11, tbdf 0xc001800 for ether0
> > >>> #l0: virtio10: 1Gbps port 0xfe000000 irq 11: 525400123456
> > >>> 2044M memory: 2800K+220M kernel, 1822M user, 0M lost
> > >>> pickmethod...read #e/nobootprompt...pickmethod done
> > >>> bind #æ...bind #S...partinit...part plan9 63 67103505
> > >>> p9part /dev/sdC0/data plan9
> > >>> part 9fat 63 204863
> > >>> part nvram 204863 204864
> > >>> part fossil 204864 10573102
> > >>> part arenas 10573102 62414293
> > >>> part isect 62414293 65006353
> > >>> part bloom 65006353 65530641
> > >>> auth...mount usbd...can't open /srv/usbtime...
> > >>> venti...2026/0102 11:36:29 venti: conf.../boot/venti: mem 2,236,962
> bcmem 4,473,924 icmem 6,710,886...httpd tcp!127.1!8000...init...icache
> 6,710,886 bytes = 66,728 entries; 4 scache
> > >>> sync...announce tcp!127.1!17034...serving.
> > >>> fossil(#S/sdC0/fossil)...fsys: dialing venti at tcp!127.1!17034
> > >>> version...can't stat /srv/partfs.sdXX: '/srv/partfs.sdXX' file does
> not exist
> > >>>
> > >>> init: starting /bin/rc
> > >>> secstore
> > >>> mkvbe: '/dev/realmode' file does not exist
> > >>> aux/vga: controller not in /lib/vgadb, not vesa
> > >>> 0xC0000 55 AA 4D E9 90 55 CC 00 00 00 00 00 00 00 00 00
> U.M..U..........
> > >>> 0xC0010 00 00 00 00 00 00 00 00 5C 98 00 00 00 00 49 42
> ........\.....IB
> > >>> 0xC0020 4D 00 2E 8B 16 E8 98 85 D2 74 01 EE C2 02 00 84
> M........t......
> > >>> 0xC0030 C0 74 34 66 55 66 89 E5 66 53 66 89 C3 66 B8 00
> .t4fUf..fSf..f..
> > >>> 0xC0040 40 00 00 FE CB 74 37 66 0F B7 D2 66 0F B7 C9 66
> @....t7f...f...f
> > >>> 0xC0050 0F AF D1 66 C1 FA 03 66 89 D0 9C 66 05 FF 1F 00
> ...f...f...f....
> > >>> 0xC0060 00 9D 25 00 E0 EB 17 0F AF CA 66 89 C8 9C 66 D1
> ..%.......f...f.
> > >>> 0xC0070 E0 66 05 FF 07 00 00 9D 25 00 F8 C2 02 00 66 5B
> .f......%.....f[
> > >>> 0xC0080 66 5D C2 02 00 66 55 66 89 E5 66 56 66 53 66 89
> f]...fUf..fVfSf.
> > >>> 0xC0090 C6 66 89 D3 66 89 CA 67 66 8B 4D 08 67 8A 45 0C
> .f..f..gf.M.g.E.
> > >>> 0xC00A0 66 C1 E6 10 66 0F B7 DB 66 09 F3 66 31 F6 8E C6
> f...f...f..f1...
> > >>> 0xC00B0 26 66 89 1E 0C 01 80 F9 01 74 0D 80 F9 03 74 0C
> &f.......t....t.
> > >>> 0xC00C0 84 C9 74 0A B0 19 EB 06 B0 0E EB 02 B0 2B 66 B9
> ..t..........+f.
> > >>> 0xC00D0 40 00 00 00 8E C1 66 48 26 A2 84 00 8E C1 66 0F
> @.....fH&.....f.
> > >>> 0xC00E0 B6 D2 26 89 16 85 00 66 5B 66 5E 66 5D C2 02 00
> ..&....f[f^f]...
> > >>> 0xC00F0 66 55 66 89 E5 66 57 66 56 66 53 66 53 66 89 C3
> fUf..fWfVfSfSf..
> > >>> aux/vga: main: vga@1024x768x1 not in /lib/vgadb
> > >>> rio: can't open display: initdisplay: /dev/draw/new: no frame buffer
> > >>> init: rc exit status: rio 41: display open
> > >>>
> > >>> init: starting /bin/rc
> > >>> term%
> > >>>
> > >>
> > >> 9fans / 9fans / see discussions + participants + delivery options
> Permalink
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T29cfe27ef87ed9d8-M52f51a88344dccee612becb3
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 11541 bytes --]
next prev parent reply other threads:[~2026-01-03 18:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-03 4:14 [9fans] go floating point exception hahahahacker2009
2026-01-03 4:57 ` ori
2026-01-03 18:24 ` ron minnich [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-01-05 6:55 hahahahacker2009
2026-01-05 18:44 ` ron minnich
2026-01-02 12:22 hahahahacker2009
2026-01-02 16:15 ` ron minnich
2026-01-02 16:57 ` Ron Minnich
2026-01-02 17:20 ` ron minnich
2026-01-04 2:37 ` Skip Tavakkolian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP6exYKZ1jm_BWXwwSiMifcZE6v_pzMuguYgWhX87x6Jr9TeMg@mail.gmail.com \
--to=rminnich@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).