[PATCH] microblaze: implement syscall_rollback

Dongjun Kim posted 1 patch 1 month, 4 weeks ago
arch/microblaze/include/asm/syscall.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] microblaze: implement syscall_rollback
Posted by Dongjun Kim 1 month, 4 weeks ago
Added the implementation of syscall_rollback() in
arch/microblaze/include/asm/syscall.h, which was previously a TODO
stub. This implementation makes seccomp and syscall user dispatch
rollback paths report the original syscall number consistently.

Signed-off-by: Dongjun Kim <aurorasphere@o.cnu.ac.kr>
---
 arch/microblaze/include/asm/syscall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h
index b5b6b91fae3e..b9143b5e01f2 100644
--- a/arch/microblaze/include/asm/syscall.h
+++ b/arch/microblaze/include/asm/syscall.h
@@ -24,7 +24,7 @@ static inline void syscall_set_nr(struct task_struct *task,
 static inline void syscall_rollback(struct task_struct *task,
 				    struct pt_regs *regs)
 {
-	/* TODO.  */
+	regs->r12 = regs->r0;
 }
 
 static inline long syscall_get_error(struct task_struct *task,
-- 
2.53.0
Re: [PATCH] microblaze: implement syscall_rollback
Posted by Michal Simek 1 month, 3 weeks ago
Hi,

On 4/17/26 14:03, Dongjun Kim wrote:
> Added the implementation of syscall_rollback() in
> arch/microblaze/include/asm/syscall.h, which was previously a TODO
> stub. This implementation makes seccomp and syscall user dispatch
> rollback paths report the original syscall number consistently.


The patch itself is correct but description should be improved to have more details.

Something like

The syscall entry code in entry.S saves the original syscall number 

(r12) into the pt_regs r0 slot (swi r12, r1, PT_R0), which is
otherwise unused since hardware r0 is hardwired to zero. 

syscall_rollback() restores r12 from this saved copy, undoing any
modification made to the syscall number after entry. 

  

This is needed by the SECCOMP_RET_TRAP and SECCOMP_RET_KILL paths in 

__seccomp_filter(), which call syscall_rollback() before delivering 

SIGSYS so that the signal handler or coredump sees the original 

register state.


Anyway. How did you test this?

Thanks,
Michal