[Bug 272149] mc_trapno incorrectly reports 0xc instead of 0xe

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 22 Jun 2023 15:24:59 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272149

            Bug ID: 272149
           Summary: mc_trapno incorrectly reports 0xc instead of 0xe
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: doctorwhoguy@gmail.com

I'm filing this bug on behalf of someone else who understands the issue better
than I, so I'll try to give the relevant info but can get more if necessary. I
asked for a brief description:

"When SIGSEGV is delivered due to a page fault, freebsd sets mc_trapno
sigcontext member to 0xc, as if it was a stack fault. But mc_addr and mc_err
are the correct values corresponding to a page fault (for stack fault they'd be
entirely different), so simply changing mc_trapno from 0xc to 0xe by hands,
allows the JIT to work. This means the bug is very simple: freebsd just
corrupts the mc_trapno value somehow. If it be something more complex, like a
real stack fault in between, then simply fixing up the mc_trapno would not
help, but it does."

Here is a test case:
https://github.com/dosemu2/dosemu2/commit/180184d2efa8f80db60330f823cfa1bc9b9e40f2

-- 
You are receiving this mail because:
You are the assignee for the bug.