mirror of
https://github.com/Fennix-Project/Userspace.git
synced 2025-05-28 07:24:25 +00:00
Add test_unaligned function to userspace_test.c
This commit is contained in:
parent
2bfdaaefd8
commit
1b36729461
@ -112,8 +112,20 @@ long __musl_syscall_ret(unsigned long r)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct passwd *p = NULL;
|
void test_unaligned()
|
||||||
|
{
|
||||||
|
printf("- Testing unaligned access\n");
|
||||||
|
|
||||||
|
int *ptr = (int *)malloc(sizeof(int));
|
||||||
|
uintptr_t unaligned_addr = (uintptr_t)ptr + 1;
|
||||||
|
*(int *)unaligned_addr = 42;
|
||||||
|
printf("%p->%p: %d\n", (void *)ptr,
|
||||||
|
(void *)unaligned_addr,
|
||||||
|
*(int *)unaligned_addr);
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct passwd *p = NULL;
|
||||||
void test_passwd()
|
void test_passwd()
|
||||||
{
|
{
|
||||||
printf("- Testing passwd\n");
|
printf("- Testing passwd\n");
|
||||||
@ -738,6 +750,7 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
// fork_bomb();
|
// fork_bomb();
|
||||||
// fork_bomb_syscall();
|
// fork_bomb_syscall();
|
||||||
|
|
||||||
|
test_unaligned();
|
||||||
test_passwd();
|
test_passwd();
|
||||||
test_brk();
|
test_brk();
|
||||||
test_time();
|
test_time();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user