-
Notifications
You must be signed in to change notification settings - Fork 22
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
Reachable unwrap panic in sys_munmap()
at legacy.rs
#141
Comments
Currently RuxOS will panic when page fault happening. For example, program access an invalid memory region. I'm wondering is it a feature, or will RuxOS handle it in the future? |
Thanks for your bug report for RuxOS!
|
Thank you for your quick reply! And my question is actually about this: ruxos/modules/ruxhal/src/arch/x86_64/trap.rs Lines 54 to 57 in b1f880b
When RuxOS accesses an invalid memory and causes a page fault, it will panic. Will it be handled in the future? |
When accessing invalid memory, program behavior is undefined, so panic is a safe implementation. (I'm not sure whether it will be handled in the future.) |
And a similarly unwrap panic for
If we run following program which calls #include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
int main()
{
mmap(NULL, 0x7ffffffffffffffe, 0x3, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
return 0;
} With following features:
logs like
|
Describe the bug
There is a reachable unwrap panic in
sys_munmap()
caused by aligning largelen
(i.e., 0xffffffffffffffff) of amunmap
syscall.ruxos/api/ruxos_posix_api/src/imp/mmap/legacy.rs
Line 72 in b1f880b
To Reproduce
munmap
:With following features:
Expected behavior
RuxOS reports panic and is terminated.
Environment
Logs
The text was updated successfully, but these errors were encountered: