Rename RzBinMap->paddr and RzBinSection->paddr to offset.#5018
Closed
Rot127 wants to merge 2 commits intorizinorg:devfrom
Closed
Rename RzBinMap->paddr and RzBinSection->paddr to offset.#5018Rot127 wants to merge 2 commits intorizinorg:devfrom
RzBinMap->paddr and RzBinSection->paddr to offset.#5018Rot127 wants to merge 2 commits intorizinorg:devfrom
Conversation
…mon binary formats. This name change is an attempt to be more precise what the member actually does. The paddr member was effectively used as an offset into the binary file. It holds the offset where the map starts. The name "paddr" is commonly used for "physical address" though. But a file offset is not the same as a physical address in most contexts. A physical address commonly refers to a memory space which has some kind of address translation unit, which manages the memory space by giving out virtual addresses to memory users. The physical address refers then to the actual offset into the memory space (while the virtual addresses don't need fixed to the same physical memory location). In the context of RzBinMap the paddr is an offset into the binary file. Not into a memory space. One could argue that the binary file itself is a "physical memory space", but this is a rather uncommon interpretation. More so, if RzBinMap is used in context of binary formats which have the concept of mapping (ELF, PE etc) this naming can be a source of confusion. Because physical address in those binary formats refers to actual physical addresses as described above. And offsets into files are referred as offset. For example ELF has for program headers: p_paddr, p_vaddr and p_offset. For sections only: sh_offset, sh_addr (sh_addr is virtual or physical depending what the machine supports). The name change from paddr to offset attempts to fix this potential source of confusion.
… common binary formats. The reason for this change is the same as in a87f37a (see commit messsage for details). TLDR justification: The most common binary formats make a distinction between physical addresses and file offsets. For sections specifically there are no physical addresses defined. Only file offsets ad addresses (if those are virtual or physical depend on the MMU of the machine, if it has any). Naming the member nonetheless paddr (short for physical address) can easily lead to confusion about its usage.
Contributor
|
Not sure about it. |
Member
Author
Would wait for the comment from @thestr4ng3r and then probably close this. As @wargio already said in Mattermost, it is a general design flaw of the IO not being specific on what address abstraction level it works (OS, MMU, file offsets). |
Member
Author
|
Superseded by #5024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not squash
Your checklist for this pull request
RZ_APIfunction and struct this PR changes.RZ_API).Detailed description
This name change is an attempt to be more precise what the member actually does.
The paddr member was effectively used as an offset into the binary file.
It holds the offset where the map starts.
The name "paddr" is commonly used for "physical address" though.
But a file offset is not the same as a physical address in most contexts.
A physical address commonly refers to a memory space which has some kind of address
translation unit, which manages the memory space by giving out virtual addresses to
memory users.
The physical address refers then to the actual offset into the memory space
(while the virtual addresses don't need fixed to the same physical memory location).
In the context of RzBinMap the paddr is an offset into the binary file.
Not into a memory space. One could argue that the binary file itself is a "physical memory space",
but this is a rather uncommon interpretation.
More so, if RzBinMap is used in context of binary formats which have the concept of mapping (ELF, PE etc)
this naming can be a source of confusion. Because physical address in those binary formats refers to
actual physical addresses as described above. And offsets into files are referred as offset.
For example ELF has for program headers: p_paddr, p_vaddr and p_offset.
For sections only: sh_offset, sh_addr (sh_addr is virtual or physical depending what the machine supports).
The name change from paddr to offset attempts to fix this potential source of confusion.
Test plan
All green
Closing issues
...