Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
R
relibc
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 33
    • Issues 33
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 19
    • Merge Requests 19
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • redox-os
  • relibc
  • Merge Requests
  • !294

Merged
Opened Jul 18, 2020 by Ahmed Abd El Mawgood@oddcoderContributor

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch "https://gitlab.redox-os.org/oddcoder/relibc.git" "TLS"
git checkout -b "oddcoder/relibc-TLS" FETCH_HEAD

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "master"
git merge --no-ff "oddcoder/relibc-TLS"

Step 4. Push the result of the merge to GitLab

git push origin "master"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Fix wrong TLS resolving

  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 1

I attempted fixing this issue before at 43fbaf99. Although it did work, it worked wrong, and it was just consistently working (but in wrong way) until it didn't.

Since this is (hopefully) the real fix, I will try to explain exactly what is going on.

This is explanation by example:

our TLS is memory of size 0x1000 starting at 0x7ffff6c50000, but the real size is 0x000068 so we have padding stored at master.offset = 0xf98

Now our symbol looks as follows

Offset Type Sym. Value Name 000000432b20 R_X86_64_DTPOFF64 0000000000000058 errno

The old code did 0x7ffff6c50000 + 0xf98 + 000000432b20 which is obviosly overflowing the memory and wrong.

The right way 0x7ffff6c50000 + 0xf98 + 0000000000000058.

THe Tls base part and offset are added at __tls_get_addr function. What is left is storing the 0x58 at the relocation address. The problem is that we don't have 0x58, but we have (binary base + 0x58) in global symbol table and binary base so what we store is the (binarybase + 0x58

  • binary base).

I hope this does turn out to be wrong.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
Reference: redox-os/relibc!294
Source branch: TLS

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.