Bug fixed that could cause abnormal process termination when compiling M code
Final Release Note
A stack use after return bug that could cause abnormal process termination when compiling M code has been fixed. It is not feasible to characterize what sort of M code would trip the bug in normal use. The bug could not cause structural damage to the database. This issue was encountered during stress testing in the YottaDB development environment, and was never reported by a user. [#948 (closed)]
Description
See YDBTest!1510 (comment 1167703716) for details.
Enabling the detect_stack_use_after_return
option (by setting ASAN_OPTIONS
env var to detect_stack_use_after_return=1
showed a longstanding failure.
Below is a simple test case.
$ export ydb_side_effects=1
$ $ydb_dist/yottadb -direct
YDB>write $text(@x+@y)
=================================================================
==65481==ERROR: AddressSanitizer: stack-use-after-return on address 0x7fc2d9712088 at pc 0x7fc2d7fc25ae bp 0x7fff3bed5970 sp 0x7fff3bed5968
WRITE of size 8 at 0x7fc2d9712088 thread T0
#0 0x7fc2d7fc25ad in resolve_tref sr_port/resolve_ref.c:323:2
#1 0x7fc2d7fc1e7b in resolve_ref sr_port/resolve_ref.c:287:6
#2 0x7fc2d7c13bdc in comp_fini sr_port/comp_fini.c:70:4
#3 0x7fc2d6fa025e in op_commarg sr_port/op_commarg.c:99:20
#4 0x7fc2d7ec2758 in op_dmode sr_port/op_dmode.c:159:3
#5 0x7fc2d737de50 in stkok3 sr_x86_64/opp_dmode.s:30
Address 0x7fc2d9712088 is located in stack of thread T0 at offset 136 in frame
#0 0x7fc2d6ac3a1f in expritem sr_port/expritem.c:495
This frame has 13 object(s):
[32, 64) 'v' (line 498)
[96, 112) 'x1' (line 499)
[128, 152) 'argbp' (line 500) <== Memory access at offset 136 is inside this variable
[192, 208) 'tmp' (line 531)
.
.
Draft Release Note
A stack-use-after-return
error from the Address Sanitizer (ASAN), while compiling an M program, has been fixed. It is not clear what user-visible consequences this has for the YottaDB user but since this class of error usually implies memory corruption it is best to upgrade to a release of YottaDB that has this fix.