New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A couple ShmBacking.* tests failing on PowerPC #2774
Labels
Comments
I thought this could've been caused by |
bors bot
added a commit
that referenced
this issue
Jan 23, 2023
2806: tests/ShmBacking: Improve invalid access tests. r=Saviq a=RAOF So, `mmap` will provide a mapping *of pages*, which means its going to be a multiple of `PAGE_SIZE`, even if the backing file is not a-multiple-of-`PAGE_SIZE` big. It zero-pads the end up to the next page, *and accesses to this zero-initialised region do not fault*. Now, it turns out I picked `4000` as the backing size, which is close enough to the `PAGE_SIZE` of `4096` on *most* kernels Ubuntu builds that doubling it puts you in a separate page, so these tests pass on all systems with a 4K `PAGE_SIZE`. ppc64el has a 64K `PAGE_SIZE` 😠 Fix this by querying `sysconf(_SC_PAGE_SIZE)` and making our backing file *exactly* one page in size. Combined with `mmap` being specified to map on a page-aligned address (which is really the only thing it could do), that guarantees that *any* access outside the valid range is going to hit a different page, and hence fault. Fixes: #2774 Co-authored-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
bors bot
added a commit
that referenced
this issue
Jan 23, 2023
2806: tests/ShmBacking: Improve invalid access tests. r=Saviq a=RAOF So, `mmap` will provide a mapping *of pages*, which means its going to be a multiple of `PAGE_SIZE`, even if the backing file is not a-multiple-of-`PAGE_SIZE` big. It zero-pads the end up to the next page, *and accesses to this zero-initialised region do not fault*. Now, it turns out I picked `4000` as the backing size, which is close enough to the `PAGE_SIZE` of `4096` on *most* kernels Ubuntu builds that doubling it puts you in a separate page, so these tests pass on all systems with a 4K `PAGE_SIZE`. ppc64el has a 64K `PAGE_SIZE` 😠 Fix this by querying `sysconf(_SC_PAGE_SIZE)` and making our backing file *exactly* one page in size. Combined with `mmap` being specified to map on a page-aligned address (which is really the only thing it could do), that guarantees that *any* access outside the valid range is going to hit a different page, and hence fault. Fixes: #2774 Co-authored-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Saviq
pushed a commit
that referenced
this issue
Feb 23, 2023
2806: tests/ShmBacking: Improve invalid access tests. r=Saviq a=RAOF So, `mmap` will provide a mapping *of pages*, which means its going to be a multiple of `PAGE_SIZE`, even if the backing file is not a-multiple-of-`PAGE_SIZE` big. It zero-pads the end up to the next page, *and accesses to this zero-initialised region do not fault*. Now, it turns out I picked `4000` as the backing size, which is close enough to the `PAGE_SIZE` of `4096` on *most* kernels Ubuntu builds that doubling it puts you in a separate page, so these tests pass on all systems with a 4K `PAGE_SIZE`. ppc64el has a 64K `PAGE_SIZE` 😠 Fix this by querying `sysconf(_SC_PAGE_SIZE)` and making our backing file *exactly* one page in size. Combined with `mmap` being specified to map on a page-aligned address (which is really the only thing it could do), that guarantees that *any* access outside the valid range is going to hit a different page, and hence fault. Fixes: #2774 Co-authored-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seen e.g. in PPA:
These are new from #2744.
The text was updated successfully, but these errors were encountered: