[Bug] Preserve and classify RIP-relative data and code references

Aperta
#7 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, linux

Direzione di ricerca

Start in src/analysis/analysis.cpp around lines 292-300, where every RIP-relative memory operand is tagged as data, then read src/decompiler/project.cpp lines 174-232 and 282-299 to see how referenced objects are emitted. Add regression coverage for a code pointer to main, an initialized scalar like int g = 42, and a short non-printable object, and check that none becomes a zeroed global or an undefined extern. Done means the three cases classify and render correctly, or emit an explicit unsupported marker.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Summary

RIP-relative references are all classified as data xrefs, and the project renderer only preserves a narrow subset of data as strings. This misclassifies code pointers and loses scalar/raw data contents in the generated source.

Evidence

src/analysis/analysis.cpp:292-300 labels every RIP-relative memory operand as "data" without checking whether the target is executable or a discovered function. src/decompiler/project.cpp:174-232 only extracts printable NUL-terminated strings; other data is emitted as zero-initialized storage or an external byte array at :282-299.

Observed cases:

  1. Normal ELF startup code contains a RIP-relative address of main. The recovered project declares a synthetic object such as global_<main-address> in the .text range instead of representing a code/function-pointer reference.
  2. For int g = 42;, the generated data section contains static uintptr_t g = 0, so the initialized value is lost.
  3. Referenced non-printable data is emitted as extern unsigned char name[] without embedding the bytes, despite the output header describing the file as self-contained.

Impact

Generated code can point at fabricated globals, discard initialized state, fail to link because referenced data is undefined, or behave differently when a code address is passed through a register. These failures are independent of instruction-level expression recovery.

Expected behavior

The analysis should distinguish data, code addresses, and function-pointer references. The project renderer should preserve referenced bytes or typed values when it claims to generate self-contained output; if exact reconstruction is impossible, it should emit an explicit unsupported artifact rather than silently zeroing or inventing storage.

Acceptance criteria

  • RIP-relative targets in executable sections or discovered functions are not emitted as data objects.
  • Initialized scalar and raw referenced data are represented without silently replacing their contents with zero.
  • Generated code does not contain undefined extern data solely because a referenced object was non-printable.
  • Add regression coverage for a code pointer, an initialized scalar, and a short/non-printable object.
Lingua principale
C++
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TiElixir/caraxes

Tutte le issue di TiElixir/caraxes

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.