When Morello support is enabled, the size of struct pt_regs
increases drastically (to make space for capability registers).
As a result, PT_REGS_SIZE can unfortunately no longer be used as an
immediate for LDP/STP. Use an explicit ADD instead.
This fixes the build when CONFIG_ARM64_MORELLO and
CONFIG_FUNCTION_TRACER are both selected.
Reported-by: Ruben Ayrapetyan <ruben.ayrapetyan(a)arm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky(a)arm.com>
---
arch/arm64/kernel/entry-ftrace.S | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index e535480a4069..66f75e2b2637 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -68,8 +68,9 @@
str x30, [sp, #S_PC]
/* Create a frame record for the callsite above pt_regs */
- stp x29, x9, [sp, #PT_REGS_SIZE]
- add x29, sp, #PT_REGS_SIZE
+ add x10, sp, #PT_REGS_SIZE
+ stp x29, x9, [x10]
+ mov x29, x10
/* Create our frame record within pt_regs. */
stp x29, x30, [sp, #S_STACKFRAME]
--
2.34.1
brk should not be implemented in purecap, return -ENOSYS when not in compat.
Co-authored-by: Tudor Cretu <tudor.cretu(a)arm.com>
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.
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;
--
2.25.1
This series updates the brk LTP tests to use direct syscalls which makes
the compat tests pass on our musl-based distribution.
Add a simple sanity check for purecap that will fail if brk is not disabled.
Depends on merging the corresponding Linux patch disabling brk :
https://op-lists.linaro.org/archives/list/linux-morello@op-lists.linaro.org…
Teo Couprie Diaz (2):
syscalls/brk: use direct syscall
syscalls/brk: add a sanity check for purecap
testcases/kernel/syscalls/brk/brk01.c | 35 ++++++++++++++++++++++++---
testcases/kernel/syscalls/brk/brk02.c | 17 +++++++------
2 files changed, 41 insertions(+), 11 deletions(-)
--
2.25.1
If a signal handler is installed using the sigaction(2) SA_SIGINFO flag,
then the signal-related context is accessible to the userspace via the
ucontext_t object.
This object contains:
+ the program counter register (i.e., the address of the next
instruction in the main program that should be executed when the
signal handler returns);
+ architecture-specific register state required for resuming the
interrupted program;
+ the thread's current signal mask;
+ the thread's alternate signal stack settings.
Therefore, the signal handler can alter the PC and PSTATE. If Morello is
supported, ensure that PC's LSB is cleared and PSTATE.C64 is set if the
PC was set using C64 ISA.
Cc: Harry Ramsey <harry.ramsey(a)arm.com>
Signed-off-by: Tudor Cretu <tudor.cretu(a)arm.com>
---
Many thanks to Harry (CC'ed) for finding an use case where sigreturn didn't
behave as expected. Tested with Musl signal tests. Unfortunetaly, these is no
LTP test that touches this functionality.
Review branch:
https://git.morello-project.org/tudcre01/linux/-/commits/sigreturn_fix_v1
---
arch/arm64/kernel/signal.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 1dd040c72630..e2527df334a9 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -669,6 +669,9 @@ COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
if (restore_altstack(&frame->uc.uc_stack))
goto badframe;
+ if (system_supports_morello())
+ morello_setup_signal_return(regs);
+
#if defined(CONFIG_CHERI_PURECAP_UABI) && !defined(SIGNAL_COMPAT64)
return regs->cregs[0];
#else
--
2.25.1
Playing around with syscall framework macros broke the syscall tracing
badly, see:
commit bb3fbc44e783 ("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.
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 (4):
tracing/syscalls: Reshape arch_syscall_addr
tracing/syscalls: Allow amending metadata macro arguments
arm64:morello: Get a grip on syscall tracing
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 | 9 ++++++---
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(+), 16 deletions(-)
--
2.25.1
Playing around with syscall framework macros broke the syscall tracing
badly, see:
commit bb3fbc44e783 ("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.
Review branch:
https://git.morello-project.org/Bea/linux/-/commits/morello/ftrace_syscalls/
---
BR
B.
Beata Michalska (3):
tracing/syscalls: Reshape arch_syscall_addr
arm64:morello:tracing/syscalls: Get a grip on syscall tracing
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 | 9 ++++++---
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 | 24 +++++++++++++++---------
include/trace/events/signal.h | 4 ++--
kernel/trace/trace_syscalls.c | 4 +++-
10 files changed, 53 insertions(+), 21 deletions(-)
--
2.25.1
Hi,
This series adapts semctl/msgctl for compat64. This depends on Teo's
work on shmctl.
These patches can also be found on this location [1].
Changes in v2:
* Addressed few minor comments from Kevin.
Thanks,
Amit
[1]: https://git.morello-project.org/amitdaniel/linux.git review/semctl_msgctl_v2
Amit Daniel Kachhap (3):
ipc/sem: Adapt semctl syscall for compat64
ipc/msg: Adapt msgctl syscall for compat64
arm64: compat: Fix structs compat_semid64_ds/compat_msqid64_ds
arch/arm64/include/asm/compat.h | 11 +++++++++++
ipc/msg.c | 6 ++++++
ipc/sem.c | 9 +++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
--
2.17.1
This patch series fixes shmctl, shmat and structs they use for compat64.
Update the arm64/Kconfig as we only use ipc_parse_version in compat32.
You can also find the patches at https://git.morello-project.org/Teo-CD/linux/-/tree/review/teo/shm-compat
---
v1: Initial shmctl patch
v2: Split patch between generic and arm64, shmat fix and Kconfig update
v3: Small nits
Teo Couprie Diaz (4):
ipc/shm: Adapt shmctl for compat64
arm64: compat: Fix structs for compat64
arm64: compat: Only use legacy SHMLBA in compat32
arm64: Kconfig: ipc_parse_version depends on COMPAT32
arch/arm64/Kconfig | 2 +-
arch/arm64/include/asm/compat.h | 10 ++++++++++
arch/arm64/include/asm/shmparam.h | 2 ++
ipc/shm.c | 8 ++++++++
4 files changed, 21 insertions(+), 1 deletion(-)
--
2.25.1
Hi,
This series adapts semctl/msgctl for compat64. This depends on Teo's
work on shmctl.
These patches can also be found on this location [1].
Thanks,
Amit
[1]: https://git.morello-project.org/amitdaniel/linux.git review/semctl_msgctl_v1
Amit Daniel Kachhap (3):
ipc/sem: Adapt semctl syscall for compat64
ipc/msg: Adapt msgctl syscall for compat64
arm64: compat: Fix structs compat_semid64_ds/compat_msqid64_ds
arch/arm64/include/asm/compat.h | 11 +++++++++++
ipc/msg.c | 6 ++++++
ipc/sem.c | 9 +++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
--
2.17.1