-
Notifications
You must be signed in to change notification settings - Fork 599
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
uffd: Fix page fault address #2270
Conversation
279106e
to
5a31b86
Compare
@rppt PTAL |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## criu-dev #2270 +/- ##
============================================
+ Coverage 70.43% 70.53% +0.10%
============================================
Files 133 132 -1
Lines 33518 33507 -11
============================================
+ Hits 23607 23634 +27
+ Misses 9911 9873 -38
☔ View full report in Codecov by Sentry. |
It's a nice catch. page_size in defined in criu/include/common/arch/*/asm/page.h. Interestingly, on x86, s390, arm, it returns unsigned long which does not cause the above issue. However, on aarch64, mips, ppc64, it returns unsigned int. I wonder if changing the page_size to return unsigned long in all archs is a good solution. |
I think it is. Adding a cast in uffd.c is more of a band aid and making page_size() return unsigned long is the proper solution IMO. |
5a31b86
to
4c35305
Compare
Thanks for further investigations, I've made page_size() to return unsigned long in all the arches and couple of other places. |
It looks like you've missed loongarch64 :) |
Currently page_size() returns unsigned int value that is after "bitwise not" is promoted to unsigned long value e.g. in uffd.c handle_page_fault. Since the value is unsigned promotion is done with 0 MSB that results in lost of MSB pagefault address bits. So make page_size to return unsigned long to avoid such situation. Signed-off-by: Vladislav Khmelevsky <och95@yandex.ru>
4c35305
to
7d48757
Compare
True, done. Thanks!
|
I'm not authorized to merge this pull request, so please do it for me, thanks! |
The page_size() returns unsigned int value that is after "bitwise not"
is promoted to unsigned long (msg->arg.pagefault.address) value. Sinc
e the value is unsigned promotion is done with 0 MSB that results in
lost of MSB pagefault address bits. Cast page_size to unsigned long
first to avoid such situation.