DReichLab / DReichLab/AdmixTools

qpGraph: free(): invalid next size (fast)

Open
#17 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
235
Forks
76
PR merge metrics
No merged PRs in 30d

Description

During a run of qpGraph, we got the following error:

...
starting analysis
number of initial random trials: 10792
*** glibc detected *** qpGraph: free(): invalid next size (fast): 0x00000000152d14d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7da26)[0x2b0949deda26]
qpGraph[0x40a684]
qpGraph[0x404f51]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x2b0949d917ed]
qpGraph[0x4023a9]
======= Memory map: ========
00400000-00462000 r-xp 00000000 00:14 18410012                           /software/hgi/pkglocal/admixtools-5.0/bin/qpGraph
00661000-00662000 rw-p 00061000 00:14 18410012                           /software/hgi/pkglocal/admixtools-5.0/bin/qpGraph
00662000-00665000 rw-p 00000000 00:00 0 
011a0000-35a9f000 rw-p 00000000 00:00 0                                  [heap]
2b0948720000-2b0948742000 r-xp 00000000 08:06 251870234                  /lib/x86_64-linux-gnu/ld-2.15.so
2b0948742000-2b0948744000 rw-p 00000000 00:00 0 
2b0948942000-2b0948943000 r--p 00022000 08:06 251870234                  /lib/x86_64-linux-gnu/ld-2.15.so
2b0948943000-2b0948945000 rw-p 00023000 08:06 251870234                  /lib/x86_64-linux-gnu/ld-2.15.so
2b0948948000-2b0948f35000 r-xp 00000000 00:14 32105401                   /software/hgi/pkglocal/lapack-3.6.1/lib/liblapack.so.3.6.1
2b0948f35000-2b0949135000 ---p 005ed000 00:14 32105401                   /software/hgi/pkglocal/lapack-3.6.1/lib/liblapack.so.3.6.1
2b0949135000-2b0949138000 rw-p 005ed000 00:14 32105401                   /software/hgi/pkglocal/lapack-3.6.1/lib/liblapack.so.3.6.1
2b0949138000-2b0949184000 rw-p 00000000 00:00 0 
2b0949188000-2b09491df000 r-xp 00000000 00:14 32105398                   /software/hgi/pkglocal/lapack-3.6.1/lib/libblas.so.3.6.1
2b09491df000-2b09493de000 ---p 00057000 00:14 32105398                   /software/hgi/pkglocal/lapack-3.6.1/lib/libblas.so.3.6.1
2b09493de000-2b09493df000 rw-p 00056000 00:14 32105398                   /software/hgi/pkglocal/lapack-3.6.1/lib/libblas.so.3.6.1
2b09493e0000-2b09495f8000 r-xp 00000000 00:14 33164881                   /software/hgi/pkglocal/gsl-1.16/lib/libgsl.so.0.17.0
2b09495f8000-2b09497f7000 ---p 00218000 00:14 33164881                   /software/hgi/pkglocal/gsl-1.16/lib/libgsl.so.0.17.0
2b09497f7000-2b09497fa000 r--p 00217000 00:14 33164881                   /software/hgi/pkglocal/gsl-1.16/lib/libgsl.so.0.17.0
2b09497fa000-2b094980a000 rw-p 0021a000 00:14 33164881                   /software/hgi/pkglocal/gsl-1.16/lib/libgsl.so.0.17.0
2b094980a000-2b094980b000 rw-p 00000000 00:00 0 
2b0949810000-2b0949849000 r-xp 00000000 00:14 7763642                    /software/hgi/pkglocal/gsl-1.16/lib/libgslcblas.so.0.0.0
2b0949849000-2b0949a48000 ---p 00039000 00:14 7763642                    /software/hgi/pkglocal/gsl-1.16/lib/libgslcblas.so.0.0.0
2b0949a48000-2b0949a49000 r--p 00038000 00:14 7763642                    /software/hgi/pkglocal/gsl-1.16/lib/libgslcblas.so.0.0.0
2b0949a49000-2b0949a4a000 rw-p 00039000 00:14 7763642                    /software/hgi/pkglocal/gsl-1.16/lib/libgslcblas.so.0.0.0
2b0949a6a000-2b0949a6b000 rw-p 00000000 00:00 0 
2b0949a70000-2b0949b6b000 r-xp 00000000 08:06 251870238                  /lib/x86_64-linux-gnu/libm-2.15.so
2b0949b6b000-2b0949d6a000 ---p 000fb000 08:06 251870238                  /lib/x86_64-linux-gnu/libm-2.15.so
2b0949d6a000-2b0949d6b000 r--p 000fa000 08:06 251870238                  /lib/x86_64-linux-gnu/libm-2.15.so
2b0949d6b000-2b0949d6c000 rw-p 000fb000 08:06 251870238                  /lib/x86_64-linux-gnu/libm-2.15.so
2b0949d70000-2b0949f24000 r-xp 00000000 08:06 251870225                  /lib/x86_64-linux-gnu/libc-2.15.so
2b0949f24000-2b094a123000 ---p 001b4000 08:06 251870225                  /lib/x86_64-linux-gnu/libc-2.15.so
2b094a123000-2b094a127000 r--p 001b3000 08:06 251870225                  /lib/x86_64-linux-gnu/libc-2.15.so
2b094a127000-2b094a129000 rw-p 001b7000 08:06 251870225                  /lib/x86_64-linux-gnu/libc-2.15.so
2b094a129000-2b094a12e000 rw-p 00000000 00:00 0 
2b094a130000-2b094a24b000 r-xp 00000000 00:14 2038973                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libgfortran.so.3.0.0
2b094a24b000-2b094a44a000 ---p 0011b000 00:14 2038973                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libgfortran.so.3.0.0
2b094a44a000-2b094a44c000 rw-p 0011a000 00:14 2038973                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libgfortran.so.3.0.0
2b094a44c000-2b094a44d000 rw-p 00000000 00:00 0 
2b094a450000-2b094a466000 r-xp 00000000 00:14 31989922                   /software/hgi/pkglocal/gcc-4.9.1/lib64/libgcc_s.so.1
2b094a466000-2b094a665000 ---p 00016000 00:14 31989922                   /software/hgi/pkglocal/gcc-4.9.1/lib64/libgcc_s.so.1
2b094a665000-2b094a666000 rw-p 00015000 00:14 31989922                   /software/hgi/pkglocal/gcc-4.9.1/lib64/libgcc_s.so.1
2b094a668000-2b094a6a5000 r-xp 00000000 00:14 2038965                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libquadmath.so.0.0.0
2b094a6a5000-2b094a8a4000 ---p 0003d000 00:14 2038965                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libquadmath.so.0.0.0
2b094a8a4000-2b094a8a5000 rw-p 0003c000 00:14 2038965                    /software/hgi/pkglocal/gcc-4.9.1/lib64/libquadmath.so.0.0.0
2b094a8a5000-2b094b0a8000 rw-p 00000000 00:00 0 
7ffdf588c000-7ffdf58ae000 rw-p 00000000 00:00 0                          [stack]
7ffdf58e0000-7ffdf58e1000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Using gdb, I've tracked this down to the free (ww2) call at the end of initvmix:
https://github.com/DReichLab/AdmixTools/blob/master/src/qpGraph.c#L2183

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/qpGraph.c at the initvmix function and inspect the free(ww2) call identified through gdb. Reproduce the qpGraph run that reaches the reported allocation failure, then trace the memory ownership and writes affecting ww2. Done means the invalid free no longer aborts qpGraph under the reported run.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
bioinformatics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.