Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasmps crashes when try to assemble cstrtlmp.asm #1260

Open
winspool opened this issue Mar 27, 2024 · 0 comments
Open

wasmps crashes when try to assemble cstrtlmp.asm #1260

winspool opened this issue Mar 27, 2024 · 0 comments

Comments

@winspool
Copy link
Contributor

cstrtlmp.asm has only 7 lines of code, but assembling does not work
In addition, binl/wasmps and binl64/wasmps produce a different backtrace:

The 32 bit wasmps has a Segmentation fault in ExpandNestedMacros_

gdb --args  <full_path_here>/binl/wasmps  cstrtlmp.asm 
...
Starting program:  <full_path_here>/binl/wasmps  cstrtlmp.asm
Reading symbols from <full_path_here>/binl/wasmps...
(No debugging symbols found in <full_path_here>/binl/wasmps)
(gdb) run
Starting program: <full_path_here>/binl/wasmps cstrtlmp.asm
Downloading separate debug info for system-supplied DSO at 0xf7ffc000
Open Watcom MIPS Assembler Version 2.0 beta Mar 26 2024 08:22:51 (32-bit)                                                                         
Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.

Program received signal SIGSEGV, Segmentation fault.
0x0805494e in ExpandNestedMacros_ ()
(gdb) bt
#0  0x0805494e in ExpandNestedMacros_ ()
#1  0x00002000 in ?? ()
#2  0x00000004 in ?? ()
#3  0x000002cc in ?? ()
#4  0x08055098 in DoMacroExpansion_ ()
#5  0x0805335b in PP_Char_ ()
#6  0x000001cc in ?? ()
#7  0x0804e2b5 in ppRead_ ()
#8  0x0804e61c in fill_ ()
#9  0x08050363 in yylex_ ()
#10 0x0804da04 in yyparse_ ()
#11 0x00000000 in ?? ()
(gdb)

When i try binl/wd and binl/wasmps from my current build tree,
wd stops in ppmacro.c (function: ExpandNestedMacros) at:

 rescanning = NestedMacros->rescanning;

See screenshoot: https://imgur.com/vO0BW5o.png

The 64 bit wasmps crashes with SIGABRT after a double free or corruption.

gdb --args  <full_path_here>/binl64/wasmps  cstrtlmp.asm 
...
Reading symbols from <full_path_here>/binl64/wasmps...
Reading symbols from <full_path_here>/binl64/wasmps.sym...
(gdb) run
Starting program: <full_path_here>/binl64/wasmps -bt=linux cstrtlmp.asm
Downloading separate debug info for system-supplied DSO at 0x7ffff7ffd000
Open Watcom MIPS Assembler Version 2.0 beta Mar 26 2024 08:22:52 (64-bit)                                                                         
Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
double free or corruption (out)

Program received signal SIGABRT, Aborted.
0x000000000042206b in raise ()
(gdb) bt
#0  0x000000000042206b in raise ()
#1  0x000000000040131f in abort ()
#2  0x000000000042d8f6 in __libc_message ()
#3  0x0000000000433e8c in malloc_printerr ()
#4  0x0000000000435ad8 in _int_free ()
#5  0x000000000040ee0a in PP_Free (p=<optimised out>) at ../../../../bld/cpp/c/ppmem.c:52
#6  0x000000000040c60d in PP_Char () at ../../../../bld/cpp/c/preproc.c:1345
#7  0x00000000004072f3 in ppRead (numchar=8192, 
    buffer=0x524c40 "#line 1 \"cstrtlmp.asm\"", '\n' <wiederholt 36 Mal>, ".globl          _cstart_\n\n.text", '\n' <wiederholt 25 Mal>, "_cstart_:\n\n\n        lw      $a0,($sp)       \n        li      $v0,4", ' ' <wiederholt 11 Mal>, "\n        "...) at scan_in.re:50
#8  fill () at scan_in.re:218
#9  0x00000000004075fe in yylex () at scan_in.re:263
#10 0x0000000000406a61 in yyparse () at asytab.c:456
#11 0x00000000004095aa in main (argc=2, argv=0x7fffffffd208) at ../../../../bld/as/c/main.c:99
(gdb)

with wine + winedbg using binnt/wasmps, a page fault on a memory read is visible:

Unhandled exception: page fault on read access to 0x0000000c in 32-bit code (0x0000000040d8ae).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:0040d8ae ESP:0052f95c EBP:003ff888 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:00000000 ECX:00000004 EDX:003ff888
 ESI:00000000 EDI:003f346e
Stack dump:
0x0000000052f95c:  003ff888 00000000 0040df00 00000000
0x0000000052f96c:  003f346e 00002000 00000004 000002cc
0x0000000052f97c:  0040dff8 003ff7d8 0040c2bb 00000041
0x0000000052f98c:  003fb6f8 000001cd 0000000a 000001cc
0x0000000052f99c:  004071b5 00000000 003fb6f8 00000000
0x0000000052f9ac:  00000000 0040751c 00000000 00000000
Backtrace:
=>0 0x0000000040d8ae in wasmps (+0xd8ae) (0x000000003ff888)
  1 0x0000002d5a0000 (0x000000003ff888)
  2 0x0000002d5a0000 (0x000000003ff888) (+ another 196 times..)

the crashed code:
0x0000000040d8ae wasmps+0xd8ae: movb    0xc(%eax),%al

with wine + winedbg using binnt64/wasmps, wasmps hangs in an endless lop
and consumes ~100% cpu time of a single core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant