darfink / region-rs

A cross-platform virtual memory API written in Rust
https://darfink.github.io/region-rs/
MIT License
119 stars 23 forks source link

Support for AArch64- and Linux-specific protection attributes #21

Closed akirilov-arm closed 8 months ago

akirilov-arm commented 2 years ago

Since version 5.10 Linux defines a couple of AArch64-specific access flags - PROT_BTI for pages guarded by the Branch Target Identification technology and PROT_MTE for pages to which the Memory Tagging Extension applies. Currently (as of commit 5087445) there is no way to use these attributes with the Protection struct even via the Protection::from_bits_unchecked() method because the implementation ignores any unknown values right before the call to mprotect(), for example.

darfink commented 8 months ago

That's a very valid use case.

I've pushed a commit that aligns the protection constants to their UNIX counterparts (this was always the intention, but they had been accidentally unaligned) & maps Protection::to_native directly to an integer (commit: https://github.com/darfink/region-rs/commit/03fd93c3ae23e197775576a4fe170d29f4e06ffc).

Will be part of release 3.0.1