https://bugs.kde.org/show_bug.cgi?id=507188

            Bug ID: 507188
           Summary: memcheck with track-fds=yes on x86 with popen:
                    Assertion 'n_ips >= 1 && n_ips <=
                    VG_(clo_backtrace_size)' failed.
    Classification: Developer tools
           Product: valgrind
      Version First 3.25 GIT
       Reported In:
          Platform: Debian stable
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 183319
  --> https://bugs.kde.org/attachment.cgi?id=183319&action=edit
Verbose debug output when reproducing the problem

I'm seeing an assertion failure inside Memcheck when running v3.25.1 and master
at 4ecf8d2832530de0904803c772126aabcf8fb075 on Debian 12 i686:

 valgrind: m_execontext.c:471 (record_ExeContext_wrk2): Assertion 'n_ips >= 1
&& n_ips <= VG_(clo_backtrace_size)' failed.

when running a test program that uses `popen`:

 int main()
 {
     FILE *fp = popen("du -s .\n", "r");
     assert(fp);
     uint64_t result;
     assert(fscanf(fp, "%" PRIu64, &result) == 1);
     pclose(fp);
 }

with:
 valgrind --tool=memcheck --track-fds=yes ./reproduce

Tweaking the assert showed that n_ips == 0.

After the assertion failure execution continues and the assert in the test
program fails too because fscanf returns -1.  This doesn't happen when the
program is run outside Valgrind so I think that the failing Valgrind assert has
lasting effects.

The similar https://bugs.kde.org/show_bug.cgi?id=391861 suggests that I should
run with lots of verbosity and debugging. The result of that is attached along
with the full reproduction case.

Debian 12's Valgrind 3.19.0 runs the test case successfully. I can try to
bisect if that would be useful.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to