[PATCH RFC POC 10/50] microblaze: commit fds on syscall exit
From: Christian Brauner
Date: Tue Sep 15 2026 - 07:50:26 EST
Add TIF_FD_SLOTS to the syscall work mask. The return path rereads
the flags after the system call and calls do_syscall_trace_leave()
for any of them which commits the reservations before audit and the
ptrace exit stop.
Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
arch/microblaze/include/asm/thread_info.h | 5 ++++-
arch/microblaze/kernel/ptrace.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h
index 0153f7c2717c..ee2f76589696 100644
--- a/arch/microblaze/include/asm/thread_info.h
+++ b/arch/microblaze/include/asm/thread_info.h
@@ -103,6 +103,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SINGLESTEP 4
#define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */
#define TIF_MEMDIE 6 /* is terminating due to OOM killer */
+#define TIF_FD_SLOTS 7 /* syscall prepared descriptors */
#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
#define TIF_SECCOMP 10 /* secure computing */
@@ -118,10 +119,12 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
+#define _TIF_FD_SLOTS (1 << TIF_FD_SLOTS)
/* work to do in syscall trace */
#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
- _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
+ _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
+ _TIF_FD_SLOTS)
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK 0x0000FFFE
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index 236264e932d6..e6951fea8593 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -25,6 +25,7 @@
*/
#include <linux/kernel.h>
+#include <linux/file.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
@@ -156,6 +157,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;
+ if (test_thread_flag(TIF_FD_SLOTS))
+ fd_slots_commit(regs);
+
audit_syscall_exit(regs);
step = test_thread_flag(TIF_SINGLESTEP);
--
2.53.0