Skip to content

Dyninst fails to instrument libtensorflow_cc.so.2 #2613

Open

Description

@jordialcaraz

Intention
I wanted to instrument both entry and exit of functions inside libtensorflow_cc.so.2

Describe the bug
When writing the output .so file, this error appears:

code_coverage: /tmp/root/spack-stage/spack-stage-dyninst-master-rooqjdjhh54uwore55jelghq4o64fagf/spack-src/dyninstAPI/src/emit-x86.C:1160: virtual bool EmitterAMD64Stat::emitPLTCall(func_instance*, codeGen&): Assertion `numeric_limits<int32_t>::lowest() <= offset && offset <= numeric_limits<int32_t>::max() && "offset more than 32 bits"' failed.
Aborted (core dumped)

To Reproduce
Steps to reproduce the behavior:
I modified the codeCoverage example with a simple instrumentation that can be seen here:
jordialcaraz/examples@636fdc1

To reproduce the issue, apply the changes or download the modified files.

Then, run

mkdir inst
./code_coverage -s  ../../tensorflow/libtensorflow_cc.so.2 inst/tensorflow.inst

If you have tensorflow installed with python, you should be able to find the tensorflow libraries at
ls python3 -c "import os, tensorflow; print(os.path.dirname(tensorflow.__file__))"

If you have access to our machines at UOregon, I have a docker images in one of our machines with all the libraries, Dyninst installed and the modified example.

Also, it takes around 45-50 minutes until codeCoverage outputs the name of the functions it found.

Expected behavior
The instrumented library should be generated without crashing.

System (please complete the following information):

  • What platform?
    x86_64
  • What commit?
    spack install dyninst@master, the last commit at that moment was
    cbf3187

Additional context


spack spec dyninst@master
[+]  dyninst@master~ipo+openmp~stat_dysect~static build_system=cmake build_type=Release commit=cbf31878a8933191bc08a70bb03be46ac000dd09 generator=make platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]      ^boost@1.86.0+atomic~charconv+chrono~clanglibcpp~cobalt+container~context~contract~conversion+date_time~debug+exception~fiber+filesystem~graph~graph_parallel~icu~iostreams~json~locale~log~math+mpi+multithreaded~nowide~numpy~pic~process~program_options~python+random~regex~serialization+shared~singlethreaded~stacktrace+system~taggedlayout~test+thread+timer~type_erasure~url~versionedlayout~wave build_system=generic cxxstd=11 patches=a440f96 visibility=hidden platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[e]          ^mpich@5.0.1~argobots~cuda+fortran~hwloc+hydra~level_zero+libxml2~mpi5-abi+pci~rocm+romio~slurm~vci~verbs~wrapperrpath~xpmem build_system=autotools datatype-engine=auto device=ch4 netmod=ofi pmi=default platform=linux os=ubuntu24.04 target=x86_64_v3
[+]      ^cmake@3.31.12~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]          ^curl@8.22.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]              ^nghttp2@1.67.1 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]              ^openssl@3.6.1~docs+shared build_system=generic certs=mozilla platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]                  ^ca-certificates-mozilla@2026-05-14 build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3
[+]                  ^perl@5.42.2+cpanm+opcode+open+shared+threads build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]                      ^berkeley-db@18.1.40+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]                      ^gdbm@1.26 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]                          ^readline@8.3 build_system=autotools patches=21f0a03,72dee13,e273643 platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]                      ^less@710 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^ncurses@6.6~symlinks+termlib abi=none build_system=autotools patches=7a351bc platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]          ^zlib-ng@2.3.3+compat+new_strategies+opt+pic+shared build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]      ^compiler-wrapper@1.1.0 build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3
[+]      ^elfutils@0.194~debuginfod+exeprefix+nls build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]          ^bzip2@1.0.8~debug~pic+shared build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[b]              ^diffutils@3.12 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^gettext@1.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]              ^libxml2@2.15.3+pic~python+shared build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]              ^tar@1.35 build_system=autotools patches=85cb6b4 zip=pigz platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]                  ^pigz@2.8 build_system=makefile platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^libiconv@1.18 build_system=autotools libs:=shared,static platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[b]          ^m4@1.4.21+sigsegv build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]              ^libsigsegv@2.15 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^pkgconf@2.5.1 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^xz@5.8.3~pic build_system=autotools libs:=shared,static platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^zstd@1.5.7+programs build_system=makefile compression:=none libs:=shared,static platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[e]      ^gcc@13.3.0+binutils+bootstrap+futex~graphite+libsanitizer~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=Release languages:='c,c++,fortran' platform=linux os=ubuntu24.04 target=x86_64_v3
[+]      ^gcc-runtime@13.3.0 build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3
[e]      ^glibc@2.39 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3
[+]      ^gmake@4.4.1~guile build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]      ^intel-tbb@2023.1.0~ipo+shared+tm build_system=cmake build_type=Release cxxstd=default generator=make platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]          ^cmake@3.31.12~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]              ^curl@8.21.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs:=shared,static tls:=openssl platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]                  ^openssl@3.6.1~docs+shared build_system=generic certs=mozilla platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[b]                      ^perl@5.42.2+cpanm+opcode+open+shared+threads build_system=generic platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[b]                          ^less@692 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[+]          ^hwloc@2.13.0~cairo~cuda~gl~level_zero~libudev+libxml2~nvml~opencl+pci~rocm build_system=autotools libs:=shared,static patches=b4db98b platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0
[+]              ^libpciaccess@0.17 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c=gcc@13.3.0
[b]                  ^util-macros@1.20.2 build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3
[+]      ^libiberty@2.46.0+pic build_system=autotools platform=linux os=ubuntu24.04 target=x86_64_v3 %c,cxx=gcc@13.3.0

Activity

  1. bbiiggppiigg commented on Nov 13, 2026

    @bbiiggppiigg
    Member

    @jordialcaraz

    Can you give #2614 a try?
    After fixing it I'm able to finish intrumenting libtensforflow.
    But since my local machine does not have CUDA / NVIDIA device it throws exception, which is currently not supported by dynisntr instrumentation.

    We do have access to UOregon Machines so pleaset let me know which machine you are using (at ideally in future issues / communucation), so I can try to reproduce and debug on the same machine as you are experiencing issues at.

  2. jordialcaraz commented on Nov 16, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    I'm testing the commit, built with spack, and it was able to generate the instrumented file. But I'm seeing an error when importing tensorflow, maybe some initialization function is not correctly instrumented. I will try to disable the instrumentation of the initialization functions and report back.

    With the fix, is it expected that it needs so much memory?

    This is with top:
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    1734687 root 20 0 100.2g 94.7g 1.0g R 99.7 18.8 56:34.17 code_coverage

  3. bbiiggppiigg commented on Nov 16, 2026

    @bbiiggppiigg
    Member

    Hi @bbiiggppiigg ,

    I'm testing the commit, built with spack, and it was able to generate the instrumented file. But I'm seeing an error when importing tensorflow, maybe some initialization function is not correctly instrumented. I will try to disable the instrumentation of the initialization functions and report back.

    With the fix, is it expected that it needs so much memory?

    This is with top: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1734687 root 20 0 100.2g 94.7g 1.0g R 99.7 18.8 56:34.17 code_coverage

    I think the memory is expected since #2614 is not primarily designed to fix memory consumption, but to avoid data being too far way from the instrumentation code (so it is within range of the offset dyninst currently used).

    Can you tell me which machine you are running on so I can try to get tensorflow working from end to end and uncover any possible issues that you might run into (instead of communicating one bug after another).

    In the meantime I'll see if there is something I can do about the memory consumption.

  4. jordialcaraz commented on Nov 16, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    I'm using Gilgamesh.

    If you want to try to reproduce the issue, you can use our machines at oregon and, if you have docker permission:

    ssh gilgamesh
    docker run -it --rm --name dyninst-testing --gpus all jordi-dyninst-ai-tensorflow
    cd /root/examples/codeCoverage
    ./instrument.sh
    

    There is a "dyninst@14" installed, that version is just Dyninst pointing to the commit with your fix.

  5. bbiiggppiigg commented on Nov 16, 2026

    @bbiiggppiigg
    Member

    Here is where the memory goes. I added the current and peak RSS (VmRSS/VmHWM) to every DYNINST_DEBUG_PROGRESS line, plus a few markers inside parsing, and reran the rewrite of libtensorflow_cc.so.2 (TF 2.20.0) with your code_coverage and #2614 on an x86_64 machine. The run took 63 min and peaked at 95.3 GiB, which matches the 94.7g you saw.

    phase time RSS after growth
    open (symbol table) 14 s 4.0 G
    parse (40 min of it in parse_frames, +18.5 G) 40.5 min 27.9 G +23.9 G
    mutator: function lookups + insertSnippet 2 min 33.4 G +5.5 G
    commit, up to the reloc block build 38 s 35.1 G +1.7 G
    building reloc blocks (543,524 functions) 2 m 21 s 70.9 G +35.8 G
    instrumentation transforms 2 m 17 s 73.9 G +3.0 G
    reloc block code generation 26 s 84.3 G +10.4 G
    emit attempt 1 (9.05 M buffer elements) 8.5 min 88.6 G +4.3 G
    emit attempt 2 2.8 min 88.6 G ~0
    springboards + commit 1.3 min 93.3 G +4.7 G
    write (1.95 GB output) 1.4 min 93.6 G (peak 95.3) ~0

    libtensorflow_framework.so.2 shows the same shape at a smaller scale: peak 16.2 G, 4.3 G for parsing, 6.1 G for building the reloc blocks.

    What this shows:

    • Memory is almost never released between phases. With dyninstAPI: store each snippet string constant once per address space #2614 the emit retries no longer add anything.
    • The largest single step is building the reloc blocks: 36 GB in under 2.5 minutes, more than all of parsing. Relocation creates one widget per original instruction, and each widget keeps a full decoded InstructionAPI::Instruction by value (632 bytes, plus the decoded operands on the heap). That is consistent with the 329 MB of .text in this library, but it is an estimate from object sizes; we have not counted instructions yet.
    • Register liveness, whose results are never freed, accounts for at most about 4 GB here (the growth during the first emit pass, where it is first queried).

    The next step on our side is to confirm the per-instruction cost and see how much of it can be avoided, for example by not keeping a decoded copy of every instruction for the whole rewrite. That would be a separate change from #2614.

  6. bbiiggppiigg commented on Nov 16, 2026

    @bbiiggppiigg
    Member

    @jordialcaraz

    The problem is that certain avx instruction is currently not decoded correctly by dyninst.
    We expect this to be fixed when we moved to Zydis in the near (hopefully future).

  7. bbiiggppiigg commented on Nov 17, 2026

    @bbiiggppiigg
    Member

    @jordialcaraz

    Can you test this branch out?

    https://github.com/dyninst/dyninst/tree/bbiiggppiigg/tf-2613-jordi

    This is #2614 + #2620 .
    I've tested on gilgamesh with your mutator and it seems to be able to generate tracefiles correctly.
    Note that the memory consumption raised to 237 GB since more instructions and more blocks are discovered after the decoder fix in #2620

  8. jordialcaraz commented on Nov 18, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    I tried the branch and it works with the prints.

    Thank you for the fix.

  9. jordialcaraz commented on Nov 18, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    I was testing a bit more, and with the codeCoverage, with all functions instrumented, I run into an error:

    
    FEntryCoverage, function : llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >, llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >::insert_or_assign<llvm::ConstantRange>
    FEntryCoverage, function : llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >, llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >::lookupOrInsertIntoBucket<llvm::SCEV const* const&, llvm::ConstantRdouble free or corruption (out)
    Fatal Python error: Aborted
    
    Current thread 0x00007fe543866740 (most recent call first):
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4177 in floor_mod
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/weak_tensor_ops.py", line 142 in wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/random.py", line 19 in _cast_seed
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/random.py", line 33 in uniform
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/initializers/random_initializers.py", line 316 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 53 in <lambda>
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 2060 in _init_from_args
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1876 in __init__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 203 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/util/traceback_utils.py", line 164 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 359 in default_variable_creator_v2
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 51 in default_variable_creator_v2
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 1225 in <lambda>
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 1232 in _variable_call
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 200 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/util/traceback_utils.py", line 164 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 43 in _initialize
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 53 in _initialize_with_initializer
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/common/variables.py", line 210 in __init__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 622 in add_weight
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/convolutional/base_conv.py", line 202 in build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 232 in build_wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 1554 in _maybe_build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 927 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/utils/traceback_utils.py", line 117 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 195 in build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 232 in build_wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 149 in _maybe_rebuild
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 76 in __init__
      File "/root/tensorflow/./mnist.py", line 11 in build_model
      File "/root/tensorflow/./mnist.py", line 57 in main
      File "/root/tensorflow/./mnist.py", line 86 in <module>
    
    Extension modules: numpy._core._multiarray_umath, numpy.linalg._umath_linalg, google._upb._message, charset_normalizer.md, charset_normalizer.cd, requests.packages.charset_normalizer.md, requests.packages.chardet.md, requests.packages.charset_normalizer.cd, requests.packages.chardet.cd, h5py._errors, h5py.defs, h5py._objects, h5py.h5, h5py.utils, h5py.h5t, h5py.h5s, h5py.h5ac, h5py.h5p, h5py.h5r, h5py._npystrings, h5py._proxy, h5py._conv, h5py.h5z, h5py.h5a, h5py.h5d, h5py.h5ds, h5py.h5g, h5py.h5i, h5py.h5o, h5py.h5f, h5py.h5fd, h5py.h5pl, h5py.h5l, h5py._selector, _cyutility, scipy._cyutility, scipy._lib._ccallback_c, scipy.sparse._sparsetools, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._pcg64, numpy.random._mt19937, numpy.random._generator, numpy.random._philox, numpy.random._sfc64, numpy.random.mtrand, _csparsetools, scipy.sparse._csparsetools, jaxlib.cpu_feature_guard, zstandard.backend_c, PIL._imaging, psutil._psutil_linux, pyarrow.lib, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pyarrow._compute, pandas._libs.ops, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, kiwisolver._cext, sklearn.__check_build._check_build, scipy.special._ufuncs_cxx, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg._batched_linalg, scipy.linalg._cythonized_array_utils, scipy.linalg._solve_toeplitz, scipy.linalg._internal_matfuncs, scipy.linalg._linalg_pythran, scipy.linalg.cython_blas, scipy.linalg.cython_lapack, scipy.linalg._decomp_update, scipy.special._ellip_harm_2, scipy.special._special_ufuncs, scipy.special._gufuncs, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpacklib, scipy.sparse.linalg._propack, scipy.spatial._ckdtree, scipy.spatial._hausdorff, scipy.spatial._distance_wrap, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial.transform._rotation_cy, scipy.spatial.transform._rigid_transform_cy, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._slsqplib, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy._lib._uarray._uarray, scipy.linalg._decomp_interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap, scipy.optimize._direct, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.interpolate._fitpack, scipy.interpolate._dierckx, scipy.interpolate._ppoly, scipy.interpolate._interpnd, scipy.interpolate._rbfinterp_pythran, scipy.interpolate._rgi_cython, scipy.special.cython_special, scipy.stats._stats, scipy.stats._biasedurn, scipy.stats._levy_stable.levyst, scipy.stats._stats_pythran, scipy.stats._ansari_swilk_statistics, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._rcont.rcont, scipy.stats._qmvnt_cy, scipy.ndimage._nd_image, scipy.ndimage._rank_filter_1d, _ni_label, scipy.ndimage._ni_label, sklearn._cyutility, sklearn.utils._isfinite, sklearn.utils.sparsefuncs_fast, sklearn.utils.murmurhash, sklearn.utils._openmp_helpers (total: 175)
    
    

    Will see if I can fix it, it worked when I only testing with import tensorflow. However, with MNIST, it fails. Will keep you updated, maybe skipping the instrumentation of some calls can fix it.

  10. bbiiggppiigg commented on Nov 18, 2026

    @bbiiggppiigg
    Member

    Hi @bbiiggppiigg ,

    I was testing a bit more, and with the codeCoverage, with all functions instrumented, I run into an error:

    
    FEntryCoverage, function : llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >, llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >::insert_or_assign<llvm::ConstantRange>
    FEntryCoverage, function : llvm::DenseMapBase<llvm::DenseMap<llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >, llvm::SCEV const*, llvm::ConstantRange, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::ConstantRange> >::lookupOrInsertIntoBucket<llvm::SCEV const* const&, llvm::ConstantRdouble free or corruption (out)
    Fatal Python error: Aborted
    
    Current thread 0x00007fe543866740 (most recent call first):
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4177 in floor_mod
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/weak_tensor_ops.py", line 142 in wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/random.py", line 19 in _cast_seed
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/random.py", line 33 in uniform
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/initializers/random_initializers.py", line 316 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 53 in <lambda>
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 2060 in _init_from_args
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1876 in __init__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 203 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/util/traceback_utils.py", line 164 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 359 in default_variable_creator_v2
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 51 in default_variable_creator_v2
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 1225 in <lambda>
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 1232 in _variable_call
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/ops/variables.py", line 200 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/util/traceback_utils.py", line 164 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 43 in _initialize
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/tensorflow/core.py", line 53 in _initialize_with_initializer
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/backend/common/variables.py", line 210 in __init__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 622 in add_weight
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/convolutional/base_conv.py", line 202 in build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 232 in build_wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 1554 in _maybe_build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 927 in __call__
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/utils/traceback_utils.py", line 117 in error_handler
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 195 in build
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/layers/layer.py", line 232 in build_wrapper
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 149 in _maybe_rebuild
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/keras/src/models/sequential.py", line 76 in __init__
      File "/root/tensorflow/./mnist.py", line 11 in build_model
      File "/root/tensorflow/./mnist.py", line 57 in main
      File "/root/tensorflow/./mnist.py", line 86 in <module>
    
    Extension modules: numpy._core._multiarray_umath, numpy.linalg._umath_linalg, google._upb._message, charset_normalizer.md, charset_normalizer.cd, requests.packages.charset_normalizer.md, requests.packages.chardet.md, requests.packages.charset_normalizer.cd, requests.packages.chardet.cd, h5py._errors, h5py.defs, h5py._objects, h5py.h5, h5py.utils, h5py.h5t, h5py.h5s, h5py.h5ac, h5py.h5p, h5py.h5r, h5py._npystrings, h5py._proxy, h5py._conv, h5py.h5z, h5py.h5a, h5py.h5d, h5py.h5ds, h5py.h5g, h5py.h5i, h5py.h5o, h5py.h5f, h5py.h5fd, h5py.h5pl, h5py.h5l, h5py._selector, _cyutility, scipy._cyutility, scipy._lib._ccallback_c, scipy.sparse._sparsetools, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._pcg64, numpy.random._mt19937, numpy.random._generator, numpy.random._philox, numpy.random._sfc64, numpy.random.mtrand, _csparsetools, scipy.sparse._csparsetools, jaxlib.cpu_feature_guard, zstandard.backend_c, PIL._imaging, psutil._psutil_linux, pyarrow.lib, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pyarrow._compute, pandas._libs.ops, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, kiwisolver._cext, sklearn.__check_build._check_build, scipy.special._ufuncs_cxx, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg._batched_linalg, scipy.linalg._cythonized_array_utils, scipy.linalg._solve_toeplitz, scipy.linalg._internal_matfuncs, scipy.linalg._linalg_pythran, scipy.linalg.cython_blas, scipy.linalg.cython_lapack, scipy.linalg._decomp_update, scipy.special._ellip_harm_2, scipy.special._special_ufuncs, scipy.special._gufuncs, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpacklib, scipy.sparse.linalg._propack, scipy.spatial._ckdtree, scipy.spatial._hausdorff, scipy.spatial._distance_wrap, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial.transform._rotation_cy, scipy.spatial.transform._rigid_transform_cy, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._slsqplib, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy._lib._uarray._uarray, scipy.linalg._decomp_interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap, scipy.optimize._direct, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.interpolate._fitpack, scipy.interpolate._dierckx, scipy.interpolate._ppoly, scipy.interpolate._interpnd, scipy.interpolate._rbfinterp_pythran, scipy.interpolate._rgi_cython, scipy.special.cython_special, scipy.stats._stats, scipy.stats._biasedurn, scipy.stats._levy_stable.levyst, scipy.stats._stats_pythran, scipy.stats._ansari_swilk_statistics, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._rcont.rcont, scipy.stats._qmvnt_cy, scipy.ndimage._nd_image, scipy.ndimage._rank_filter_1d, _ni_label, scipy.ndimage._ni_label, sklearn._cyutility, sklearn.utils._isfinite, sklearn.utils.sparsefuncs_fast, sklearn.utils.murmurhash, sklearn.utils._openmp_helpers (total: 175)
    

    Will see if I can fix it, it worked when I only testing with import tensorflow. However, with MNIST, it fails. Will keep you updated, maybe skipping the instrumentation of some calls can fix it.

    You can also keep a branch for your reproducer so I can just try to reproduce whatever you are trying to .

  11. bbiiggppiigg commented on Nov 19, 2026

    @bbiiggppiigg
    Member

    The double free or corruption (out) in the full code-coverage run is a liveness bug, not something in the earlier fixes. llvm::ConstantRange::~ConstantRange ends in a conditional tail call:

    mov  (%rdi),%rdi
    test %rdi,%rdi
    jne  operator delete[]@plt
    ret
    

    Liveness did not treat the jne into operator delete[] as a call, so %rdi was dead there. The exit snippet put its string argument in %rdi without saving it, and operator delete[] freed that string.

    The fix is draft PR #2625. It is now also on bbiiggppiigg/tf-2613-jordi (head ae7af55 = the two earlier commits + #2625).

    With that branch, Keras MNIST (the keras.io simple convnet, 1 epoch, on the GPU) runs against the rewritten libtensorflow_cc.so.2, with every function instrumented by the code_coverage mutator:

    loss accuracy
    original library 0.0862 0.9747
    rewritten library 0.0933 0.9739

    The rewrite took 1 h 20 min with a peak RSS of 227 GiB. Training is much slower with the instrumentation: one epoch took 436 s.

  12. bbiiggppiigg commented on Nov 19, 2026

    @bbiiggppiigg
    Member

    @jordialcaraz

    There was a liveness bug on conditional tail call.
    I've added the fix to the branch as one additional commit, and with that fix MNIST now should be working on gilgamesh.

  13. jordialcaraz commented on Nov 19, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    Thanks, I'm trying to test the fix.

  14. jordialcaraz commented on Nov 19, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    Sorry for the late reply, I had some issues with docker.

    I tested the new commit and there are two cases, one that works and one that doesn't.

    What I'm using is this modified example from dyninst:
    https://github.com/jordialcaraz/examples/blob/master/codeCoverage/code_coverage.C

    Case one is using the code as is, and it fails with a segmentation fault.

    
    FExitCoverage, function : _GLOBAL__sub_I_dtensor_tpu_ops.cc
    FEntryCoverage, function : _GLOBAL__sub_I_mlir_passthrough_op.cc
    FExitCoverage, function : _GLOBAL__sub_I_mlir_passthrough_op.cc
    FEntryCoverage, function : _GLOBAL__sub_I_constant_fold.cc
    FExitCoverage, function : _GLOBAL__sub_I_constant_fold.cc
    FEntryCoverage, function : _GLOBAL__sub_I_decode_attributes_hook.cc
    FExitCoverage, function : _GLOBAL__sub_I_decode_attributes_hook.cc
    FEntryCoverage, function : _GLOBAL__sub_I_constant_fold_utils.cc
    FExitCoverage, function : _GLOBAL__sub_I_constant_fold_utils.cc
    FEntryCoverage, function : _GLOBAL__sub_I_fallback_state.cc
    FExitCoverage, function : _GLOBAL__sub_I_fallback_state.cc
    FEntryCoverage, function : _GLOBAL__sub_I_virtual_device.cc
    FExitCoverage, function : _GLOBAL__sub_I_virtual_device.cc
    FEntryCoverage, function : _GLOBAL__sub_I_op_kernel_runner.cc
    FExitCoverage, function : _GLOBAL__sub_I_op_kernel_runner.cc
    FEntryCoverage, function : _GLOBAL__sub_I_sobol_op.cc
    FExitCoverage, function : _GLOBAL__sub_I_sobol_op.cc
    FEntryCoverage, function : _GLOBAL__sub_I_bitcast_op.cc
    FExitCoverage, function : _GLOBAL__sub_I_bitcast_op.cc
    FEntryCoverage, function : RegisterBitcastOpKernel
    FExitCoverage, function : RegisterBitcastOpKernel
    FEntryCoverage, function : _GLOBAL__sub_I_batchtospace_op.cc
    FExitCoverage, function : _GLOBAL__sub_I_batchtospace_op.cc
    FEntryCoverage, function : _GLOBAL__sub_I_spacetobatch_functor.cc
    FExitCoverage, function : _GLOBAL__sub_I_spacetobatch_functor.cc
    FEntryCoverage, function : _GLOBAL__sub_I_spacetobatch_op.cc
    FExitCoverage, function : _GLOBAL__sub_I_spacetobatch_op.cc
    FEntryCoverage, function : _GLOBAL__sub_I_spacetobatch_functor_gpu.cu.cc
    FExitCoverage, function : _GLOBAL__sub_I_spacetobatch_functor_gpu.cu.cc
    FEntryCoverage, function : __cuda_module_ctor
    FExitCoverage, function : __cuda_module_ctor
    FEntryCoverage, function : atexit
    Fatal Python error: Segmentation fault
    
    Current thread 0x00007f805e97b740 (most recent call first):
      File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 1293 in create_module
      File "<frozen importlib._bootstrap>", line 813 in module_from_spec
      File "<frozen importlib._bootstrap>", line 921 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
      File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1415 in _handle_fromlist
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/platform/self_check.py", line 63 in preload_check
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/python/pywrap_tensorflow.py", line 38 in <module>
      File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 999 in exec_module
      File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
      File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1415 in _handle_fromlist
      File "/opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/__init__.py", line 40 in <module>
      File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 999 in exec_module
      File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
      File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
      File "/root/examples/codeCoverage/mnist.py", line 4 in <module>
    
    Extension modules: numpy._core._multiarray_umath, numpy.linalg._umath_linalg (total: 2)
    Segmentation fault (core dumped)
    
    

    The other case is removing the comments at lines 196, 224, 236 and 247, which instruments every function executed (except those at the list).
    Maybe this issue can be fixed, but as they are initialization functions, maybe it is not possible, and they are not that interesting to instrument.

    But the second case fails with a "Bus error".

    You can use image jordi-dyninst-ai-tensorflow-a1 with Gilgamesh, you can go to
    cd /root/examples/codeCoverage
    And the lines I execute are inside:
    cat instrument.sh

    spack load python
    spack load dyninst
    time ./code_coverage -s  to_inst/libtensorflow_cc.so.2 inst/libtensorflow_cc.so.2 2>&1 | tee tau_run.log
    cp inst/libtensorflow_cc.so.2 /opt/python/pkgs/python/lib/python3.12/site-packages/tensorflow/libtensorflow_cc.so.2
    export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
    python3 mnist.py
    

    I built Dyninst with spack and this modification to the package version("14", branch="bbiiggppiigg/tf-2613-jordi")

    I will see tomorrow if I can test with TAU, the example with the prints is just for testing, as instrumenting this library takes a while.

    Thank you.

  15. bbiiggppiigg commented on Nov 19, 2026

    @bbiiggppiigg
    Member

    Your case 1 runs the same mutator we used for the result above: with the skip list commented out, your code_coverage.C differs from ours only in one printf. With it, our build of ae7af5573c rewrote libtensorflow_cc.so.2 on gilgamesh and mnist.py trained to the original accuracy. So the difference is probably in the Dyninst build or the environment, not the mutator. We cannot look inside the container from our account, so two requests:

    1. Could you post the output of spack find -lv dyninst (and spack find -p dyninst) from inside the container? With version("14", branch=...), Spack fetches the branch when it builds, but it does not rebuild an already installed dyninst@14 when the branch moves. If the install predates ae7af5573c, spack uninstall dyninst (or spack install --overwrite dyninst@14) and a fresh rewrite should pick up the fix.
    2. Could you copy the rewritten inst/libtensorflow_cc.so.2 to a directory on gilgamesh that other users can read (outside the container), and tell us the path? Then we can inspect how atexit was instrumented without redoing the rewrite.

    In the meantime we are rewriting the library again with our build and keeping the coverage output, to check whether atexit runs in our case and how its tail call to __cxa_atexit is instrumented. The bus error with the skip list enabled may be a separate issue; we will look at it once case 1 is understood.

  16. 2 remaining items

  17. bbiiggppiigg commented on Nov 19, 2026

    @bbiiggppiigg
    Member

    @jordialcaraz

    Can you also put an uninstrumented copy under /tmp ?
    So I can try to instrument it and see what went wrong.

  18. jordialcaraz commented on Nov 19, 2026

    @jordialcaraz
    Author

    Done.
    Called the file original_libtensorflow_cc.so.2

  19. bbiiggppiigg commented on Nov 19, 2026

    @bbiiggppiigg
    Member

    Done. Called the file original_libtensorflow_cc.so.2

    I think I fonud the cause. I'll let you know when I push the fix for it.

  20. bbiiggppiigg commented on Nov 20, 2026

    @bbiiggppiigg
    Member

    We reproduced the error with tensorflow 2.21.0 and ported the fix to your branch: bbiiggppiigg/tf-2613-jordi is now at 5e19d55116. We verified it end to end on gilgamesh: with the fix, the rewritten libtensorflow_cc.so.2 imports and mnist.py trains (accuracy 0.9740, 0.9727 uninstrumented).

    Spack does not rebuild the installed dyninst@14 when the branch moves, so please reinstall it (spack install --overwrite dyninst@14) and check that spack find -lv dyninst shows commit=5e19d55116 before rewriting again.

  21. jordialcaraz commented on Nov 20, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg ,

    I tested the fix, but I'm still running into some issues. Now, it doesn't crash at that point, but at another.

    As you can't access docker with our machine, I will try to build everything outside docker so you can access it. That way it may be easier to debug. May modify the example a bit, with the prints, it takes too long.

  22. jordialcaraz commented on Nov 23, 2026

    @jordialcaraz
    Author

    Hi @bbiiggppiigg

    I looked a bit more and it is working now.

    The issue was that the library also includes call to GPU, so it fails when I enable the GPU, but works with MNIST when using only CPU.

  23. kupsch commented on Nov 24, 2026

    @kupsch
    Contributor

    Here is a small reproducer for the emitPLTCall assert that doesn't need TensorFlow: #2634 adds it as a regression test, dyninstAPI_far_plt_call. On master it asserts in about 2 seconds.

    The static rewriter puts a call's jump slot and the instrumentation that calls through it in the same new region, and emitPLTCall reaches the slot with a 32-bit displacement. The test puts them more than 2 GiB apart:

    1. Allocate 64 bytes, then a 2100 MiB gap, then free the 64 bytes.
    2. Insert a call to a function in another object at the entry of a function in the mutatee.
    3. Rewrite. The jump slot lands in the freed hole, and the call after the gap.

    With a 1900 MiB gap the rewrite works and the output runs.

    #2614 removes what made the gap in the TensorFlow rewrite (a new copy of each snippet string every time its code is generated). #2577 adds far forms for shared-variable loads and stores. Neither changes the 32-bit reach of emitPLTCall or emitPLTJump, so the reproducer still asserts with each of them and with both merged (#2614 at c3aba36, #2577 at 72fcd0f).

    A fix could load the slot's address into a scratch register and call through it when the slot is out of reach, or allocate each slot near the code that uses it. Only x86_64 has this limit: aarch64 and ppc64le build the full offset in a register.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions