Merge branch 'fix_aarch64' into 'master'

Add a workaround for UB on arm64

See merge request redox-os/relibc!643
This commit is contained in:
Jeremy Soller
2025-04-12 12:05:41 +00:00
+7 -3
View File
@@ -277,7 +277,7 @@ where
{
page
} else if let Some(ref mut stack_page) = stack_page {
stack_page.remap(new_page_no * PAGE_SIZE, PROT_WRITE)?;
stack_page.remap(new_page_no * PAGE_SIZE, PROT_READ | PROT_WRITE)?;
stack_page
} else {
let new = MmapGuard::map(
@@ -285,7 +285,7 @@ where
&Map {
offset: new_page_no * PAGE_SIZE,
size: PAGE_SIZE,
flags: PROT_WRITE,
flags: PROT_READ | PROT_WRITE,
address: 0, // let kernel decide
},
)?;
@@ -647,6 +647,10 @@ impl MmapGuard {
Ok(())
}
// Without this inline(never), UB somewhere causes the flags to be set to 0 on arm64.
// FIXME Find the UB and fix it
#[inline(never)]
pub unsafe fn map_mut_anywhere<'a>(
fd: usize,
offset: usize,
@@ -658,7 +662,7 @@ impl MmapGuard {
size,
offset,
address: 0,
flags: PROT_WRITE,
flags: PROT_READ | PROT_WRITE,
},
)?;
let slice = &mut *this.as_mut_ptr_slice();