You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried allocating 4K on userspace stack and noticed that the kernel crashes hard. You can see the issue if you update the new user/utils/pwd.c to look like this:
Hi, penberg
It only allocs one page(just 4KB) as userspace stack in
sys_execute()->task_execute()->execute_argument()
and the page is mapped on userspace address USER_STACK(3GB - 4KB - 4KB),
so if we alloc 4KB or larger on userspace stack, it will trigger pagefault.
Here is userspace memory map:
kernel space
---------------------- 0xc000 0000
4KB hole
---------------------- 0xbfff f000
user stack
---------------------- 0xbfff e000
other parts
---------------------- 0x000 0000
I think there are two solutions:
alloc enough user space stack in sys_execute()
I am now busy at college final exam, so I may not submit new patch in time :"(
just use global defined data: 'static char buf[..]' or 'char buf[..]'
Because tinyos doesnt provide brk/sbrk and malloc() now,
we need manage the memory manually.)
When I use global defined 'static char buf[4MB]', it triggers a pagefault panic.
The new patch 'Fix bug: map wrong userspace virtual address in map_userspace()' for
this panic has been commited.
I tried allocating 4K on userspace stack and noticed that the kernel crashes hard. You can see the issue if you update the new user/utils/pwd.c to look like this:
penberg@jaguar:~/src/tinyos$ git diff
diff --git a/user/utils/pwd.c b/user/utils/pwd.c
index 53aee22..3c46b49 100644
--- a/user/utils/pwd.c
+++ b/user/utils/pwd.c
@@ -1,10 +1,10 @@
#include <ulib.h>
#define BUF_SIZE 4096
-static char buf[BUF_SIZE];
int main(int argc, char **argv)
{
The text was updated successfully, but these errors were encountered: