I have extracted a section of code from openjpeg which seems to be driving valgrind/exp-sgcheck nuts. See attached demo.c file. Steps (dwarf-4 and stack-protector are important): $ gcc -gdwarf-4 -fstack-protector demo.c $ valgrind --tool=exp-sgcheck ./a.out ==17451== exp-sgcheck, a stack and global array overrun detector ==17451== NOTE: This is an Experimental-Class Valgrind Tool ==17451== Copyright (C) 2003-2013, and GNU GPL'd, by OpenWorks Ltd et al. ==17451== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==17451== Command: ./a.out ==17451== exp-sgcheck: sg_main.c:560 (add_blocks_to_StackTree): Assertion '!already_present' failed. ==17451== at 0x380278CC: report_and_quit (m_libcassert.c:260) ==17451== by 0x38027A26: vgPlain_assert_fail (m_libcassert.c:340) ==17451== by 0x3801EE00: add_blocks_to_StackTree (sg_main.c:560) ==17451== by 0x38020321: shadowStack_new_frame.isra.12 (sg_main.c:1875) ==17451== by 0x806427FDC: ??? ==17451== by 0x8034DBECF: ??? sched status: running_tid=1 Thread 1: status = VgTs_Runnable ==17451== at 0x4005B7: main (demo.c:39) Note: see also the FAQ in the source distribution. It contains workarounds to several common problems. In particular, if Valgrind aborted or crashed after identifying problems in your program, there's a good chance that fixing those problems will prevent Valgrind aborting or crashing, especially if it happened in m_mallocfree.c. If that doesn't help, please report this bug to: www.valgrind.org In the bug report, send all the above text, the valgrind version, and what OS and version you are using. Thanks. Where: $ gcc --version gcc (Debian 4.7.2-5) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ uname -a Linux larcenet 3.12-0.bpo.1-amd64 #1 SMP Debian 3.12.6-2~bpo70+1 (2014-01-07) x86_64 GNU/Linux Reproducible: Always Steps to Reproduce: Where: $ cat demo.c #include <stdint.h> #include <string.h> typedef uint32_t OPJ_UINT32; typedef int OPJ_COLOR_SPACE; typedef void opj_image_comp_t; typedef uint8_t OPJ_BYTE; typedef struct opj_image_comptparm { OPJ_UINT32 dx; OPJ_UINT32 dy; OPJ_UINT32 w; OPJ_UINT32 h; OPJ_UINT32 x0; OPJ_UINT32 y0; OPJ_UINT32 prec; OPJ_UINT32 bpp; OPJ_UINT32 sgnd; } opj_image_cmptparm_t; typedef struct opj_image { OPJ_UINT32 x0; OPJ_UINT32 y0; OPJ_UINT32 x1; OPJ_UINT32 y1; OPJ_UINT32 numcomps; OPJ_COLOR_SPACE color_space; opj_image_comp_t *comps; OPJ_BYTE *icc_profile_buf; OPJ_UINT32 icc_profile_len; } opj_image_t; int main(int argc, char *argv[]) { opj_image_t *image; opj_image_cmptparm_t cmptparm[4]; unsigned char sigbuf[8]; memset(cmptparm, 0, sizeof(cmptparm)); return 0; }
Same problem here.
is this a duplicate of #255603 ?
Same problem. Ubuntu 15.04, GCC 4.9.2.
This problem manifests even on simple programs such as /bin/true on my Ubuntu 17.04, amd64/Linux. This means that sgcheck is unusable for me. $ ./vg-in-place --version -v valgrind-3.14.0.SVN-16458-vex-3398 $ gcc --version gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406 $ /lib/x86_64-linux-gnu/libc.so.6 GNU C Library (Ubuntu GLIBC 2.24-9ubuntu2.2) stable release version 2.24, by Roland McGrath et al.
*** This bug has been marked as a duplicate of bug 255603 ***