[MDEV-18269] Off-by-one bug in Created: 2019-01-16  Updated: 2019-04-02  Resolved: 2019-01-16

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4.2, 10.1.38, 5.5.63, 10.0.38, 10.2.22, 10.3.13

Type: Bug Priority: Major
Reporter: Natanael Copa Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None
Environment:

Alpine Linux


Issue Links:
Duplicate
is duplicated by MDEV-18416 unit.lf fails in buildbot on Mac with... Closed
is duplicated by MDEV-18472 unit.my_atomic failed in buildbot on ... Closed
is duplicated by MDEV-18633 ASAN heap-buffer-overflow in test_con... Closed

 Description   

commit b0fd06a6f27212cee770961171439a44626d8f14 (MDEV-15670 - unit.my_atomic failed in buildbot with Signal 11 thrown) introduces an off-by-one overflow in unittest/mysys/thr_template.c.

This causes tests to fail:

$ ./unittest/mysys/m
y_atomic-t
# N CPUs: 20
1..5
# Testing my_atomic_add32 with 30 threads, 3000 iterations... 
Bail out! Signal 4 thrown
# 5 tests planned,  0 failed,  0 was last executed

Backtrace:

Thread 1 "my_atomic-t" received signal SIGILL, Illegal instruction.
__bin_chunk (self=0x10035a230) at src/malloc/malloc.c:452
452     src/malloc/malloc.c: No such file or directory.
(gdb) bt
#0  __bin_chunk (self=0x10035a230) at src/malloc/malloc.c:452
#1  0x000000010001a728 in test_concurrently (
    test=0x1000434e0 "my_atomic_add32", handler=0x10001a354 <test_atomic_add>, 
    n=<optimized out>, m=<optimized out>)
    at /home/ncopa/aports/main/mariadb/src/mariadb-10.3.12/unittest/mysys/thr_template.c:50
#2  0x000000010001a83c in do_tests ()
    at /home/ncopa/aports/main/mariadb/src/mariadb-10.3.12/unittest/mysys/my_atomic-t.c:108
#3  0x000000010001a068 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/ncopa/aports/main/mariadb/src/mariadb-10.3.12/unittest/mysys/thr_template.c:68
(gdb) 


Generated at Thu Feb 08 08:42:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.