brk should not be implemented in purecap, return -ENOSYS when not in compat.
Co-authored-by: Tudor Cretu tudor.cretu@arm.com Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- Thanks Tudor for providing the code snippet, making it much more clear than my original ideas.
mm/mmap.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c index ce282f9d9f8e..1048c358b872 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -194,6 +194,11 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long struct list_head *uf); SYSCALL_DEFINE1(brk, unsigned long, brk) { +#ifdef CONFIG_CHERI_PURECAP_UABI + if (!in_compat_syscall()) { + return -ENOSYS; + } +#endif unsigned long newbrk, oldbrk, origbrk; struct mm_struct *mm = current->mm; struct vm_area_struct *next;