Change type of uspace pointers in kernel from pointer type to numeric (#170)
commit5a5269df4bb8693ab8e38af0622b7fa6365b9535
authorJiří Zárevúcky <zarevucky.jiri@gmail.com>
Tue, 2 Jul 2019 12:03:55 +0000 (2 14:03 +0200)
committerGitHub <noreply@github.com>
Tue, 2 Jul 2019 12:03:55 +0000 (2 14:03 +0200)
tree08e0cd78c36e001b657e289bf0f82e41911ca7dc
parentaca975825e8c22b4a416e1dff9b0ac2e7672efdb
Change type of uspace pointers in kernel from pointer type to numeric (#170)

From kernel's perspective, userspace addresses are not valid pointers,
and can only be used in calls to `copy_to/from_uspace()`.
Therefore, we change the type of those arguments and variables to
`uspace_addr_t` which is an alias for `sysarg_t`.

This allows the compiler to catch accidental direct accesses to
userspace addresses.

Additionally, to avoid losing the type information in code,
a macro `uspace_ptr(type)` is used that translates to `uspace_addr_t`.
I makes no functional difference, but allows keeping the type information
in code in case we implement some sort of static checking for it in the future.

However, ccheck doesn't like that, so instead of using `uspace_ptr(char)`,
we use `uspace_ptr_char` which is defined as
`#define uspace_ptr_char uspace_ptr(char)`.
55 files changed:
.gitignore
abi/include/_bits/native.h
abi/include/abi/proc/uarg.h
kernel/arch/abs32le/src/abs32le.c
kernel/arch/amd64/src/debug/stacktrace.c
kernel/arch/amd64/src/userspace.c
kernel/arch/arm32/src/debug/stacktrace.c
kernel/arch/arm32/src/userspace.c
kernel/arch/arm64/src/arm64.c
kernel/arch/arm64/src/debug/stacktrace.c
kernel/arch/ia32/src/debug/stacktrace.c
kernel/arch/ia32/src/userspace.c
kernel/arch/ia64/src/ia64.c
kernel/arch/mips32/src/mips32.c
kernel/arch/ppc32/src/debug/stacktrace.c
kernel/arch/ppc32/src/ppc32.c
kernel/arch/riscv64/src/riscv64.c
kernel/arch/sparc64/src/sun4u/sparc64.c
kernel/arch/sparc64/src/sun4v/sparc64.c
kernel/generic/include/console/console.h
kernel/generic/include/ddi/ddi.h
kernel/generic/include/ipc/irq.h
kernel/generic/include/ipc/sysipc.h
kernel/generic/include/log.h
kernel/generic/include/mm/as.h
kernel/generic/include/mm/page.h
kernel/generic/include/proc/program.h
kernel/generic/include/proc/task.h
kernel/generic/include/proc/thread.h
kernel/generic/include/security/perm.h
kernel/generic/include/synch/syswaitq.h
kernel/generic/include/syscall/copy.h
kernel/generic/include/sysinfo/sysinfo.h
kernel/generic/include/udebug/udebug_ops.h
kernel/generic/src/console/console.c
kernel/generic/src/ddi/ddi.c
kernel/generic/src/ipc/irq.c
kernel/generic/src/ipc/ops/dataread.c
kernel/generic/src/ipc/ops/datawrite.c
kernel/generic/src/ipc/ops/debug.c
kernel/generic/src/ipc/ops/shareout.c
kernel/generic/src/ipc/sysipc.c
kernel/generic/src/log/log.c
kernel/generic/src/main/uinit.c
kernel/generic/src/mm/as.c
kernel/generic/src/mm/page.c
kernel/generic/src/proc/program.c
kernel/generic/src/proc/task.c
kernel/generic/src/proc/thread.c
kernel/generic/src/security/perm.c
kernel/generic/src/synch/syswaitq.c
kernel/generic/src/syscall/copy.c
kernel/generic/src/sysinfo/sysinfo.c
kernel/generic/src/udebug/udebug_ipc.c
kernel/generic/src/udebug/udebug_ops.c