-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Describe the bug
Invalid memory access in various functions.
What data setup do we need to do?
BemiDB(main) with PostgreSQL (REL_17_STABLE).
Valgrind-3.23.0.
To reproduce valgrind warnings follow these steps:
- Install Valgrind-3.23.0.
sudo apt-install valgrind
- Apply the patch to pg_regress.c. This patch allows make installcheck-world tests to run and be redirected for use with BemiDB. (attached to this tread). Gist with patch.
git apply pg_regressc.patch
- Run BemiDB under Valgrind.
valgrind --quiet --exit-on-first-error=no --error-exitcode=1 --leak-check=no --time-stamp=yes --gen-suppressions=all --trace-children=yes --suppressions=/home/gudwlin/postgres/src/tools/valgrind.supp ./bemidb -log-level DEBUG start > bemidbvg.log 2>&1
- Running tests
make installcheck-world EXTRA_REGRESS_OPTS="--host=localhost --port=54321 --dbname=bemidb"
- Observe the Valgrind output.
Examples of incorrect memory access
- Invalid write of size 32
==00:00:48:32.017 406916== Thread 3:
==00:00:48:32.017 406916== Invalid read of size 32
==00:00:48:32.022 406916== at 0x6C6640: indexbytebody (indexbyte_amd64.s:131)
==00:00:48:32.022 406916== Address 0x4f1a6830 is 0 bytes inside a block of size 21 alloc'd
==00:00:48:32.026 406916== at 0x4848858: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:48:32.028 406916== by 0x4CC0D7E: strdup (strdup.c:42)
==00:00:48:32.030 406916== by 0x1040231: pg_query_deparse_protobuf (pg_query_deparse.c:28)
==00:00:48:32.031 406916== by 0x102959F: _cgo_04d7a251dcb7_Cfunc_pg_query_deparse_protobuf_direct_args (cgo-gcc-prolog:68)
==00:00:48:32.032 406916== by 0x737B03: runtime.asmcgocall.abi0 (asm_amd64.s:923)
==00:00:48:32.032 406916== by 0xC0004868BF: ???
==00:00:48:32.032 406916==
{
<insert_a_suppression_name_here>
Memcheck:Addr32
fun:indexbytebody
}
- Invalid write of size 8
==00:00:53:17.792 406916== Invalid read of size 8
==00:00:53:17.792 406916== at 0x7B32E9: fmt.(*pp).doPrintln (print.go:1216)
==00:00:53:17.792 406916== Address 0xc0007a47e0 is in a rw- anonymous segment
==00:00:53:17.792 406916==
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:fmt.(*pp).doPrintln
}
==00:00:53:17.776 406916== Invalid read of size 8
==00:00:53:17.777 406916== at 0x760A74: reflect.packEface (value.go:140)
==00:00:53:17.777 406916== Address 0xc0007a2000 is in a rw- anonymous segment
==00:00:53:17.777 406916==
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:reflect.packEface
}
==00:00:53:17.737 406916== Invalid read of size 8
==00:00:53:17.737 406916== at 0x73CDAE: internal/reflectlite.Swapper.func9 (swapper.go:68)
==00:00:53:17.737 406916== Address 0xc0007a40d0 is in a rw- anonymous segment
==00:00:53:17.737 406916==
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:internal/reflectlite.Swapper.func9
}
==00:00:53:17.690 406916== Invalid read of size 8
==00:00:53:17.691 406916== at 0x1007C32: main.(*QueryHandler).remapQuery (query_handler.go:378)
==00:00:53:17.691 406916== Address 0xc0007a2058 is in a rw- anonymous segment
==00:00:53:17.691 406916==
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:main.(*QueryHandler).remapQuery
}
- Conditional jump or move depends on uninitialized values
==00:00:00:02.647 406401== Conditional jump or move depends on uninitialised value(s)
==00:00:00:02.647 406401== at 0x713943: runtime.adjustctxt (stack.go:585)
==00:00:00:02.647 406401== by 0x713D31: runtime.copystack (stack.go:929)
==00:00:00:02.647 406401== by 0x714408: runtime.newstack (stack.go:1126)
...
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:runtime.adjustctxt
fun:runtime.copystack
fun:runtime.newstack
obj:*
}
Expected behavior
Under Valgrind, the application should run without critical warnings.
Best regards,
Artyom Zarubin
Postgres Professional: https://postgrespro.com/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels