https://bugs.kde.org/show_bug.cgi?id=453084
Bug ID: 453084 Summary: Misleading error with memmove: Source and destination overlap in memcpy_chk Product: valgrind Version: 3.18.1 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: memcheck Assignee: jsew...@acm.org Reporter: mli...@suse.cz Target Milestone: --- Created attachment 148408 --> https://bugs.kde.org/attachment.cgi?id=148408&action=edit Fedora dockerfile The following fails for me, __memcpy_chk is used instead of __memmove_chk: $ cat drpm.c #define SIZE 32 int size = SIZE; char data[SIZE]; int zero = 0; int main() { __builtin___memmove_chk(data + zero, data, size, size); return 0; } $ gcc drpm.c -g -fuse-ld=gold -lrpm && valgrind ./a.out ... ==2468== Source and destination overlap in memcpy_chk(0x204060, 0x204060, 32) ==2468== at 0x4850ED2: __memcpy_chk (vg_replace_strmem.c:1617) ==2468== by 0x20117A: main (drpm.c:8) Can be reproduce with Fedora dockerfile as well: $ podman build -t test -f Dockerfile-fedora STEP 1/4: FROM fedora:latest STEP 2/4: RUN dnf --nogpgcheck -y install rpm-devel gcc wget valgrind binutils-gold --> Using cache 27002ecd458a78d4860b4b774a3474868fafd2f49f50822e28b94878792cc2aa --> 27002ecd458 STEP 3/4: RUN wget https://gist.github.com/marxin/b5041eb13da32cfd4b4b701a54e8c165/raw/1c993107b290fa4af9780953f394c3e5e5b8b656/drpm.c --> Using cache fdafad79d772f8e9c8f31f1037ef779505c8ce9d03a72f271d1f6b88ebe90f19 --> fdafad79d77 STEP 4/4: RUN gcc drpm.c -g -fuse-ld=gold -lrpm && valgrind --error-exitcode=123 ./a.out ==1== Memcheck, a memory error detector ==1== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==1== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info ==1== Command: ./a.out ==1== ==1== Source and destination overlap in memcpy_chk(0x402040, 0x402040, 32) ==1== at 0x484F292: __memcpy_chk (vg_replace_strmem.c:1723) ==1== by 0x40062A: main (drpm.c:8) ==1== ==1== ==1== HEAP SUMMARY: ==1== in use at exit: 0 bytes in 0 blocks ==1== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==1== ==1== All heap blocks were freed -- no leaks are possible ==1== ==1== For lists of detected and suppressed errors, rerun with: -s ==1== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Error: error building at STEP "RUN gcc drpm.c -g -fuse-ld=gold -lrpm && valgrind --error-exitcode=123 ./a.out": error while running runtime: exit status 123 -- You are receiving this mail because: You are watching all bug changes.