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

Stack buffer overflow in tpcc_wl::init_tab_item() #35

Open
pramalhe opened this issue Feb 15, 2022 · 0 comments
Open

Stack buffer overflow in tpcc_wl::init_tab_item() #35

pramalhe opened this issue Feb 15, 2022 · 0 comments

Comments

@pramalhe
Copy link

row->set_primary_key(i);

I believe instead of
row->set_value(I_ID, i);
we can do:
uint64_t i_id = i;
row->set_value(I_ID, &i_id);

=================================================================
==122100==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd6d837bf4 at pc 0x7f157087169a bp 0x7ffd6d837b70 sp 0x7ffd6d837318
READ of size 8 at 0x7ffd6d837bf4 thread T0
#0 0x7f1570871699 in __interceptor_memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:823
#1 0x55bec5e1998d in row_t::set_value(int, void*) storage/row.cpp:91
#2 0x55bec5e19e6a in row_t::set_value(int, unsigned int) storage/row.cpp:107
#3 0x55bec5def6a1 in tpcc_wl::init_tab_item() benchmarks/tpcc_wl.cpp:94
#4 0x55bec5df369e in tpcc_wl::threadInitWarehouse(void*) benchmarks/tpcc_wl.cpp:397
#5 0x55bec5def240 in tpcc_wl::init_table() benchmarks/tpcc_wl.cpp:72
#6 0x55bec5ded689 in tpcc_wl::init() benchmarks/tpcc_wl.cpp:27
#7 0x55bec5e2fa14 in main system/main.cpp:44
#8 0x7f15702f00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#9 0x55bec5de6f2d in _start (/workspace/concurrency/code/2plsf/DBx1000/rundb+0x17f2d)

Address 0x7ffd6d837bf4 is located in stack of thread T0 at offset 36 in frame
#0 0x55bec5e19dc1 in row_t::set_value(int, unsigned int) storage/row.cpp:107

This frame has 1 object(s):
[32, 36) 'value' (line 107) <== Memory access at offset 36 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions are supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:823 in __interceptor_memcpy
Shadow bytes around the buggy address:
0x10002dafef20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafef30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafef40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafef50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafef60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x10002dafef70: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1[04]f3
0x10002dafef80: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafef90: f1 f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 00 f2
0x10002dafefa0: f2 f2 f2 f2 00 00 00 00 00 00 02 f3 f3 f3 f3 f3
0x10002dafefb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x10002dafefc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==122100==ABORTING

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