Vector35 / Vector35/binaryninja-api

Define `tcbhead_t` struct for GNU Linux programs and set `$fs` to be a pointer to it

Open
#4,747 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Platform Effort: Medium Impact: Medium
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

What is the feature you'd like to have?
I would like the struct tcbhead_t structure to be added to the system types for binaries that can be identifiedd as GNU Linux binaries, and for $fs to point to it.

This makes

void* fsbase
int64_t rax = *(fsbase + 0x28)
...
if (rax == *(fsbase + 0x28)) {
    return 0
}
...
__stack_chk_fail()

Into a slightly more readable

struct tcbhead_t* fsbase
int64_t stack_guard = fsbase->stack_guard
...
if (stack_guard == fsbase->stack_guard) {
    return 0
}
...
__stack_chk_fail()

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 the linked glibc sysdeps/x86_64/nptl/tls.h definition of tcbhead_t, then locate how GNU Linux system types and the $fs register are represented in Binary Ninja. Confirm how GNU Linux binaries are identified and how existing architecture-specific types are added. Done means $fs has the named structure type and stack_guard access decompiles readably for the shown pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems, reverse-engineering
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.