| Summary: | getSiginfo() libgo/runtime/go-signal.c missing Solaris specific code to get ret.sigpc | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Petr Sumbera <sumbera> |
| Component: | go | Assignee: | Ian Lance Taylor <ian> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | ebotcazou, marcel, ro |
| Priority: | P3 | ||
| Version: | 12.2.0 | ||
| Target Milestone: | --- | ||
| Host: | Target: | *-solaris | |
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2024-04-06 00:00:00 | |
| Attachments: |
Proposed patch file.
Alternative patch. |
||
FWIW I had a similar patch in my local tree for years, but neglected to submit it (among others because it lacked dumpregs support. While going over the remaining go.test failures recently, I noted some that might be related, so I completed the patch (attached). A few notes: * I've used the customary __sun__ && __svr4__ guard for Solaris-specific code, not __sun && __SVR4 which is only used in runtime/go-libmain.c. * I've reused the Linux/x86_64 code in dumpregs for Solaris. Only a few adjustments were necessary, but this still seemed better than replicating the whole section. * I've added SPARC support, too. Since gregs[] is almost identical between 32 and 64-bit, I've just used different formats for printing 32 and 64-bit registers, again to avoid massive duplication. * When testing on Debian/sparc64, the 64-bit version there reguired an ugly variation: the general-purpose member of mcontext_t is called mc_gregs instead of gregs, and the indices are named MC_* instead of REG_* (although the names are identical with one exception). I have no idea what rid them to do this, but at least my code does compile and run there. The patch has been tested on i386-pc-solaris2.11, sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and sparc64-unknown-linux-gnu (32 and 64-bit each). There were no regressions, but compared to a vanilla tree there where no new PASSes either. Created attachment 57848 [details]
Alternative patch.
The master branch has been updated by Ian Lance Taylor <ian@gcc.gnu.org>: https://gcc.gnu.org/g:a05efc8bf5ed329ea7d9b1740c326bdc6b04e37a commit r15-53-ga05efc8bf5ed329ea7d9b1740c326bdc6b04e37a Author: Ian Lance Taylor <iant@golang.org> Date: Sun Apr 28 13:30:39 2024 -0700 runtime: dump registers on Solaris Patch by Rainer Orth <ro@gcc.gnu.org>. Fixes PR go/106813 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/581724 Thanks. Patch committed. This should be fixed now. |
Created attachment 53531 [details] Proposed patch file. getSiginfo() in libgo/runtime/go-signal.c is missing Solaris specific code to get ret.sigpc and thus it calls runtime_callers(). It was observed that sometimes call to runtime_callers() ends with segmentation fault (because sparc64_is_sighandler() gets wrong pc - e.g. 0x8): ffffffff7ac13fe1 libgcc_s.so.1`uw_frame_state_for+0x434(ffffffff7ac14950, ffffffff7ac14d40, ffffffff6ab59e50, ffffffff6ab66a8d, 0, ffffffff6ab66a8d) ffffffff7ac140a1 libgcc_s.so.1`_Unwind_Backtrace+0x54(ffffffff6a9ce33c, ffffffff7ac154d0, 0, ffffffff7ac14d40, ffffffff7ac14950, 0) ffffffff7ac14c21 libgo.so.14`backtrace_full+0x70(ffffffff7f5c8000, 1, ffffffff6a4c1790, ffffffff6a4c1abc, ffffffff7ac155b8, ffffffff6b09d3b8) ffffffff7ac14d01 libgo.so.14`runtime_callers+0x78(6, ffffffff7ac156a0, ffffffff7f5c8000, 0, ffffffff6a4c1abc, ffffffff6b0c7d7c) ffffffff7ac14dd1 libgo.so.14`runtime.getSiginfo+0x1c(ffffffff7ac15ef0, ffffffff7ac15c10, 0, 0, 0, 61e000000000) ffffffff7ac14ed1 libgo.so.14`runtime.sigtrampgo+0x39c(12, ffffffff7ac15ef0, ffffffff7ac15c10, ffffffff6ad81b88, 36, c0010c6800) ffffffff7ac15101 libc.so.1`__sighndlr+0xc(12, ffffffff7ac15ef0, ffffffff7ac15c10, ffffffff6a4c2ebc, 0, ffffffff7ed24000) ffffffff7ac151b1 libc.so.1`call_user_handler+0x404(d, ffffffff7ac15ef0, ffbffeff, 0, 12, ff) ffffffff7ac152a1 libc.so.1`sigacthandler+0xe0(12, ffffffff7ac15ef0, ffffffff7ac15c10, 0, 0, ffffffff7ed24000) ffffffff21bff741 libgo.so.14`runtime.kickoff(0, 0, 0, 0, 0, 0) This can be avoided by setting ret.sigpc via platform specific code as it's done on other systems. See attached patch file.