Add TIF_FD_SLOTS and test it once the system call has stored its return value. A task that reserved descriptors uses the traced path. Signed-off-by: Christian Brauner (Amutable) --- arch/xtensa/include/asm/thread_info.h | 2 ++ arch/xtensa/kernel/entry.S | 5 +++++ arch/xtensa/kernel/ptrace.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h index 5b74dfc35ef9..0c8eb5dc8398 100644 --- a/arch/xtensa/include/asm/thread_info.h +++ b/arch/xtensa/include/asm/thread_info.h @@ -124,6 +124,7 @@ static __always_inline struct thread_info *current_thread_info(void) #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ #define TIF_SECCOMP 10 /* secure computing */ #define TIF_MEMDIE 11 /* is terminating due to OOM killer */ +#define TIF_FD_SLOTS 12 /* syscall prepared descriptors */ #define _TIF_SYSCALL_TRACE (1<areg[2] = return_value */ s32i abi_rv, abi_saved0, PT_AREG2 + + /* descriptors reserved by the syscall are committed in do_syscall_trace_leave */ + GET_THREAD_INFO(a4, a1) + l32i a4, a4, TI_FLAGS + bbsi.l a4, TIF_FD_SLOTS, 1f bnez abi_saved1, 1f .Lsyscall_exit: #if defined(__XTENSA_WINDOWED_ABI__) diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index 364e4fdabb00..d44d62a56b85 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -571,6 +572,9 @@ 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); if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) -- 2.53.0