From ebc26c8259160193dde5b0baecf7230c8388fd29 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 20 Sep 2025 21:32:01 -0400 Subject: kern: proc: Add address checking routine Add routine to check if an address is valid within a process's address space. More work will need to be done with this but this introduces a great starting point Signed-off-by: Ian Moffett --- src/sys/include/sys/proc.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sys/include') diff --git a/src/sys/include/sys/proc.h b/src/sys/include/sys/proc.h index 2ff2876..6a356ef 100644 --- a/src/sys/include/sys/proc.h +++ b/src/sys/include/sys/proc.h @@ -146,6 +146,19 @@ int md_proc_kill(struct proc *procp, int flags); */ int md_set_ip(struct proc *procp, uintptr_t ip); +/* + * Check that a virtual address is within the bounds of + * a process. + * + * @proc: Process the address should be within + * @addr: Virtual address to check + * @len: Length of memory referenced by 'addr' + * + * Returns zero if the address is within the process bounds, + * otherwise a less than zero value on failure. + */ +int proc_check_addr(struct proc *proc, uintptr_t addr, size_t len); + /* * Put the current process into a halt loop * until the next one runs. -- cgit v1.2.3