Skip to content

Conversation

@lebr0nli
Copy link
Contributor

fsbase() and gsbase() in pwndbg/regs.py will use ptrace by ourself to find segment base, but it doesn't work on remote debugging.

But GDB >= 8 can use fs_base and gs_base register to get the same result for x86-64 processes, and this feature works when remote debugging.

So by checking these two registers, even if we are using gdbserver to debug a x86-64 process, we can still use fsbase/gsbase without any problems if our GDB version >= 8

@codecov-commenter
Copy link

Codecov Report

Merging #1030 (82c95cd) into dev (e9b9ebe) will decrease coverage by 0.02%.
The diff coverage is 17.64%.

@@            Coverage Diff             @@
##              dev    #1030      +/-   ##
==========================================
- Coverage   49.88%   49.85%   -0.03%     
==========================================
  Files         157      157              
  Lines       18551    18564      +13     
  Branches     1498     1499       +1     
==========================================
+ Hits         9255     9256       +1     
- Misses       8998     9010      +12     
  Partials      298      298              
Impacted Files Coverage Δ
pwndbg/commands/context.py 31.25% <0.00%> (-0.15%) ⬇️
pwndbg/regs.py 64.03% <0.00%> (-3.32%) ⬇️
pwndbg/color/disasm.py 80.39% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2fcc95...82c95cd. Read the comment docs.

@disconnect3d disconnect3d merged commit afbe6f0 into pwndbg:dev Jul 16, 2022
@disconnect3d
Copy link
Member

@lebr0nli Thanks! Fyi I have refactored this a little bit in 7121936

@lebr0nli lebr0nli deleted the fs-gs-base-patch branch October 6, 2022 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants