brk is not implemented in purecap, return -ENOSYS when not in compat.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
Thanks Tudor for providing the code snippet, making it much more clear than
my original ideas.
v2: Fix style and format issues.
mm/mmap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/mmap.c b/mm/mmap.c
index ce282f9d9f8e..5de8e48b66b7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -202,6 +202,11 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
bool downgraded = false;
LIST_HEAD(uf);
+#ifdef CONFIG_CHERI_PURECAP_UABI
+ if (!in_compat_syscall())
+ return -ENOSYS;
+#endif
+
if (mmap_write_lock_killable(mm))
return -EINTR;
base-commit: 3deb26714719d5068f5ef5d0fa9bc457c3cef6c1
--
2.25.1
Hi,
I think this is a good mailing list to share Cheri linux for risc-v project.
-Dmitry
----------------------------------------------------------------------------------------------------------------------------------------
From: Dmitry Kasatkin
Sent: Wednesday, September 28, 2022 4:23 PM
To: cl-cheribsd-discuss(a)lists.cam.ac.uk; cl-cheri-discuss(a)lists.cam.ac.uk; linux-riscv(a)lists.infradead.org
Cc: Wang Kui; Jan Erik Ekberg; Horsch, Julian; Ahlrichs, Vincent; Auer, Lukas
Subject: Linux support for RISC-V CHERI
Hi,
I would like to inform that our work on Linux support for RISC-V CHERI has been open sourced on GitHub:
https://github.com/cheri-linux
CHERI is an experimental ISA exention providing architectural capabilities for different ISAs including RISC-V and ARM.
CHERI is not available in mainstream CPUs and available on certain experimental cores for FPGAs.
Information about CHERI can be found here:
https://www.cl.cam.ac.uk/research/security/ctsrd/cheri
This work dedicated to RISC-V and has been done by Huawei and Fraunhofer with the great support from Cambridge University.
BR,
Dmitry
Hi,
I think this is a good mailing list to share Cheri linux for risc-v project.
-Dmitry
________________________________
From: Dmitry Kasatkin
Sent: Wednesday, September 28, 2022 4:23 PM
To: cl-cheribsd-discuss(a)lists.cam.ac.uk; cl-cheri-discuss(a)lists.cam.ac.uk; linux-riscv(a)lists.infradead.org
Cc: Wang Kui; Jan Erik Ekberg; Horsch, Julian; Ahlrichs, Vincent; Auer, Lukas
Subject: Linux support for RISC-V CHERI
Hi,
I would like to inform that our work on Linux support for RISC-V CHERI has been open sourced on GitHub:
https://github.com/cheri-linux
CHERI is an experimental ISA exention providing architectural capabilities for different ISAs including RISC-V and ARM.
CHERI is not available in mainstream CPUs and available on certain experimental cores for FPGAs.
Information about CHERI can be found here:
https://www.cl.cam.ac.uk/research/security/ctsrd/cheri
This work dedicated to RISC-V and has been done by Huawei and Fraunhofer with the great support from Cambridge University.
BR,
Dmitry
Currently, the PCuABI kernel from the "morello/next" branch doesn't set bounds for the elements of argv and envp.
I suppose the bounds should be equal to `round_representable(strlen+1)` and currently they appear as 2^64 - 1.
Could this be fixed? Thank you!
Kind regards,
Yury
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
currently a capability store to shared memory (MAP_SHARED)
segfaults, but process shared robust mutex requires this to
work.
the linux design for robust mutex is that each thread has
a list of shared robust mutex objects (see set_robust_list
system call) that the kernel can walk on thread exit and
wake all other waiters of that mutex (with FUTEX_OWNER_DIED).
the list pointer is stored in the mutex object itself which
is in shared memory in case of a process shared robust mutex.
not sure if we can make this to work on morello.
example posix code:
#include <pthread.h>
#include <sys/mman.h>
int main()
{
pthread_mutex_t *m = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0);
pthread_mutexattr_t a;
pthread_mutexattr_init(&a);
pthread_mutexattr_setrobust(&a, PTHREAD_MUTEX_ROBUST);
pthread_mutex_init(m, &a);
pthread_mutexattr_destroy(&a);
pthread_mutex_lock(m); // segfaults in libc
return 0;
}
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Playing around with syscall framework macros broke the syscall tracing
badly, see:
commit ("arm64/syscalls: Allow syscalls to return
capabilities")
and:
https://git.morello-project.org/morello/kernel/linux/-/issues/35
for the corresponding bug report.
This series in an attempt to remedy that.
The first patch does some rather controversial thing, but there is already a
precedent for that (as of ARCH_HAS_SYSCALL_MATCH_SYM_NAME), so one could say
it can be somehow exonerated.
The second one tries to get the SYSCALL_METADATA macro aligned with the
changes that caused the issue in the first place and, sadly, it is touching
other archs code, though the changes are minimal and safe.
Note: checkpatch will complain about few things but those are to be ignored.
Tracing selftests seem to be happy with the changes.
Also verified with some random syscall events.
v3:
- further splitting of patches ([PATCH 3/4] from v2)
- aligning the order of #ifdef defines
v2:
- split [PATCH 2/3] into generic and Morello specific changes
- added dependency on CONFIG_FTRACE_SYSCALLS for ARCH_HAS_SYSCALL_ADDR
- improved (hopefully) commit message for previous PATCH 2-3
- small formatting clean-up
Review branch:
https://git.morello-project.org/Bea/linux/-/commits/morello/ftrace_syscalls…
Beata Michalska (5):
tracing/syscalls: Reshape arch_syscall_addr
tracing/syscalls: Allow amending metadata macro arguments
arm64/syscalls: Fix syscalls tracing
arm64: morello: ftrace: Use dedicated arch_syscall_addr
tracing/signal: Use explicit conversion instead of vague downcast
Documentation/trace/ftrace-design.rst | 5 +++--
arch/arm64/include/asm/ftrace.h | 4 ++++
arch/arm64/include/asm/syscall_wrapper.h | 8 ++++++--
arch/arm64/kernel/syscall.c | 12 ++++++++++++
arch/mips/include/asm/ftrace.h | 4 ++++
arch/s390/include/asm/syscall_wrapper.h | 6 +++---
arch/x86/include/asm/syscall_wrapper.h | 2 +-
include/linux/syscalls.h | 13 +++++++++----
include/trace/events/signal.h | 4 ++--
kernel/trace/trace_syscalls.c | 4 +++-
10 files changed, 47 insertions(+), 15 deletions(-)
--
2.25.1