Add read-only data support for x86 of ELF#242
Conversation
…' is given to ADD_IBT_RULE
|
This is great! Thank you for not only providing the foundation but also validating that it works well in practice. I only noticed one small thing, a build failure on Mac OS for I suspect we just need to guard the |
|
Hi John, the compilation error can be resolved, but I think there is one more slightly complicated issue about discrepancy between Linux x86 assembler vs. Apple x86 assembler. The failure comes from the fact that Specifically, in rodata.S: Since But on x86: We can have two tutorials on x86 MacOS vs. x86 Linux, but then a question is how to deal with x86 subroutines that will have rodata + calls in general. Luckily curve25519 and edwards25519 assembly subroutines don't seem to have function calls, but they can exist in other operations in the future. |
jargh
left a comment
There was a problem hiding this comment.
Excellent, thank you! It's great to have all the machinery for .rodata sections set up on both architectures now, and to have clear validation that it works well in practice.
Issue #, if available:
This pull request adds the read-only data section support for the ELF format in the x86-64 architecture.
The overall patch structure is similar to #207 (ELF, Arm64) and #226 (Mach-O, Arm64). However, the high-level structure is slightly simpler than Arm64 patches because one relocation type is necessary whereas the arm case needed 3. What made it even simpler is that the unique relocation type was already implemented in s2n-bignum :)
As the previous Arm64 patches, this adds a tutorial file that illustrates (1) how read-only data can be read and (2) a function that uses the read-only data can be called.
As the Arm64 implementation had
adrp_within_bounds, this patch also hasriprel32_within_boundswhich states that the distance between symbol and RIP must fit within 2^31.Another small issue is that, the rodata tutorial is not runnable on MacOS (x86-64). This is because Mac's clang thinks that when a static function is called, its destination can be updated after dynamic linking. In Linux, a call to a static function cannot be relocated after dynamic linking (making the tutorial work), whereas call to a global function can be relocated after it.
This implies that proofs may change depending on whether the OS is Linux x86-64 or MacOS x86-64. However, I believe that users of s2n-bignum mainly uses Linux(x86-64), Linux(arm64) or MacOS(arm64) but not MacUS(x86-64) now. :)
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.