Initial forward-edge CFI implementation (#3693)
* Initial forward-edge CFI implementation Give the user the option to start all basic blocks that are targets of indirect branches with the BTI instruction introduced by the Branch Target Identification extension to the Arm instruction set architecture. Copyright (c) 2022, Arm Limited. * Refactor `from_artifacts` to avoid second `make_executable` (#1) This involves "parsing" twice but this is parsing just the header of an ELF file so it's not a very intensive operation and should be ok to do twice. * Address the code review feedback Copyright (c) 2022, Arm Limited. Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
@@ -102,9 +102,15 @@ impl MmapVec {
|
||||
}
|
||||
|
||||
/// Makes the specified `range` within this `mmap` to be read/execute.
|
||||
pub unsafe fn make_executable(&self, range: Range<usize>) -> Result<()> {
|
||||
self.mmap
|
||||
.make_executable(range.start + self.range.start..range.end + self.range.start)
|
||||
pub unsafe fn make_executable(
|
||||
&self,
|
||||
range: Range<usize>,
|
||||
enable_branch_protection: bool,
|
||||
) -> Result<()> {
|
||||
self.mmap.make_executable(
|
||||
range.start + self.range.start..range.end + self.range.start,
|
||||
enable_branch_protection,
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the underlying file that this mmap is mapping, if present.
|
||||
|
||||
Reference in New Issue
Block a user