Skip to content

Commit 1e66b26

Browse files
Freax13phil-opp
andauthored
improve wording & add links to threads
Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
1 parent c62e8d7 commit 1e66b26

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/structures/paging/mapper/recursive_page_table.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ impl<'a> RecursivePageTable<'a> {
5050
///
5151
/// ## Safety
5252
///
53-
/// Creating a recursive page table with recursive index 511 is unsound
54-
/// because calculating the end ptr of the structure causes an overflow.
53+
/// Note that creating a `PageTable` with recursive index 511 is unsound
54+
/// because allocating the last byte of the address space can lead to pointer
55+
/// overflows and undefined behavior. For more details, see the discussions
56+
/// [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/end-of-address-space)
57+
/// and [in the `unsafe-code-guidelines ` repo]https://github.com/rust-lang/unsafe-code-guidelines/issues/420).
5558
#[inline]
5659
pub fn new(table: &'a mut PageTable) -> Result<Self, InvalidPageTable> {
5760
let page = Page::containing_address(VirtAddr::new(table as *const _ as u64));

0 commit comments

Comments
 (0)