←back to thread

944 points 6a74 | 6 comments | | HN request time: 1.293s | source | bottom
1. amoss ◴[] No.41806211[source]
I'm slightly confused after reading about page alignment. Why would a 16k page be less aligned than a 4k page causing assumptions about pointers within those pages to break? The 4k pages on x86 are aligned on 4k boundaries, are the 16k pages on M1 aligned on <4k boundaries?
replies(1): >>41806316 #
2. y1n0 ◴[] No.41806316[source]
There are more 4k boundaries than 16k boundaries. The issue is code compiled for 4k boundaries running on a 16k system.
replies(1): >>41806767 #
3. amoss ◴[] No.41806767[source]
I'm missing something here. Assuming there are pages at 0k, 16k, 32k etc - all of those pages are aligned on 4k boundaries as 4k > 16k. So code written with the assumption that its pages are 4k aligned should have that assumption met when running with 16k pages. It is still early here and I have only had one cup of coffee. Am I misunderstanding something really obvious?
replies(1): >>41806964 #
4. dezgeg ◴[] No.41806964{3}[source]
x86 app might mmap 8kb, then munmap the second 4kb and expect that to work. But not possible on 16k pages.
replies(1): >>41807158 #
5. amoss ◴[] No.41807158{4}[source]
ah ok, so it would not be pointer alignment inside the pages but instead the assumption that page +4k is a page.
replies(1): >>41810792 #
6. MBCook ◴[] No.41810792{5}[source]
I was a little confused by that in the article as well. It being a granularity issue makes more sense to me.