-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Describe the bug
There is a reachable unwrap panic in sys_munmap() caused by aligning large len (i.e., 0xffffffffffffffff) of a munmap syscall.
| let layout = Layout::from_size_align(len, 8).unwrap(); |
To Reproduce
- Compile a program which calls
munmap:
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
int main()
{
void *addr = mmap(NULL, 4096, 0x3, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
munmap(addr, 0xffffffffffffffff);
return 0;
}With following features:
alloc
irq
musl
multitask
fs
pipe
poll
rtc
signal
virtio-9p
- Run the compiled program in RuxOS.
Expected behavior
RuxOS reports panic and is terminated.
Environment
- RuxOS version: main b1f880b
- ubuntu:22.04 in Docker
- 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Logs
[1728388549.205894 0:2 ruxos_posix_api::imp::mmap::legacy:67] sys_munmap <= start: 0xffffff80003fe000, len: 18446744073709551615
[1728388549.206739 0:2 ruxruntime::lang_items:14] panicked at api/ruxos_posix_api/src/imp/mmap/legacy.rs:72:54:
called `Result::unwrap()` on an `Err` value: LayoutError
[1728388549.207796 0:2 ruxhal::platform::x86_pc::misc:16] Shutting down...
Metadata
Metadata
Assignees
Labels
No labels