From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 316C9C982C5 for ; Tue, 15 Sep 2026 11:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ieBZ+PGa/U2dHjvXYIOcBUNNdmn+mkwIOuOFCXOxPNU=; b=gLDxhO52Jv54QkCqDBAjNyKUkb qCT/hEjWWEZy68ymoiC2Zk6GEg6tgc1BXjEWm16OaZDzUZ32TwX+RKtt8d1voW0Nw4s+hGVOts9xS u44itR8qTMShf9rfy3VjamAdlGMd+IZGkePZAKlRJfbEoA5nQ/8tPHw7zRWdCVPVFNBu9RsJ8fxOT BtFcXIcz1qUj86eQZnE27wgqJpZDV/9FuXOdPETH9G8tIBUOVwmp9qBmpfHLCfHsB6wOD2UUVQgzT +vOlstRSA1wZVAO5kxkH2G3cRLlkjmvKsPkyknbXFGCDAwv7zcZ05Cg29+h9NoC6uK752Db6D/jNf cSeCDL/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6RPk-000000069KA-2Zex; Tue, 15 Sep 2026 11:33:28 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x6RPJ-000000068vh-0eKt; Tue, 15 Sep 2026 11:33:01 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D4555415D0; Tue, 15 Sep 2026 11:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C55A1F000FF; Tue, 15 Sep 2026 11:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789471980; bh=ieBZ+PGa/U2dHjvXYIOcBUNNdmn+mkwIOuOFCXOxPNU=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=lW4XDrSSE4zqGk0C0CruQFmX6so8N2FOL23Fl09c5bnPSxQl0BFCz51k8cI+0dFfJ dXQThH7z1OdW1butHdlIf/Qob4isTZGHfU/nhc+unhvj37uVwPwqTZHeYk/FuGa0RN aDMtnc4VxYzhvYriaex23gOScyvu/sWWOUrxEFEJ+nQmrms5SkE4/CUmg2GfphSCuj JXVFYRknoQ6WmHDbHxR3xnX/Fm8hP0qkS8zTMO9w9Kxgckeg/VeZIeJThmFkiQBpT6 FVu61jYIIv6ceWPTvf1QMFe5gj978J8MMjetxPLjPfZjoZhoGLBPKY5OnkDnZixiDS 91SUSK7z6ECBg== From: Christian Brauner Date: Tue, 15 Sep 2026 13:30:59 +0200 Subject: [PATCH RFC POC 13/50] openrisc: commit fds on syscall exit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260915-work-fd-reserve-unify-folded-v1-13-4d5217d6b246@kernel.org> References: <20260915-work-fd-reserve-unify-folded-v1-0-4d5217d6b246@kernel.org> In-Reply-To: <20260915-work-fd-reserve-unify-folded-v1-0-4d5217d6b246@kernel.org> To: Linus Torvalds Cc: Alexander Viro , Jann Horn , Jan Kara , Ingo Molnar , Peter Zijlstra , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oleg Nesterov , linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, Jens Axboe , io-uring@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, bpf@vger.kernel.org, David Airlie , virtualization@lists.linux.dev, kvm@vger.kernel.org, kexec@lists.infradead.org, linux-hyperv@vger.kernel.org, "Christian Brauner (Amutable)" X-Mailer: b4 0.17-dev-db0b7 X-Developer-Signature: v=1; a=openpgp-sha256; l=3299; i=brauner@kernel.org; h=from:subject:message-id; bh=WIP/DigF70AMhhxkwNBY6vdiLcTH+iv+tPMUDAZ9Ays=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWSt1Kn9GjAhwFHx+sY/XeefqrdOfq2R3HC8f2v+1Q5lg UcXTzCZdZSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAEzkAiMjw2k/PoanKkdD5bZf KxfaVXVqje/CGY+/+MbO+vL4QxvPmgRGhoe1GR3WZn18c8xOi7JUnRHY2W96ZGnXoxWdvoqFr4M SOQE= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add TIF_FD_SLOTS and test it together with TIF_SYSCALL_TRACE on the way out of a system call. The check used to rely on the flags r30 had been loaded with before the call. Reload them. The syscall may have set the new bit. A task that reserved descriptors calls do_syscall_trace_leave() which commits them before audit and the ptrace exit stop. Signed-off-by: Christian Brauner (Amutable) --- arch/openrisc/include/asm/thread_info.h | 5 ++++- arch/openrisc/kernel/entry.S | 5 +++-- arch/openrisc/kernel/ptrace.c | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/include/asm/thread_info.h b/arch/openrisc/include/asm/thread_info.h index e338fff7efb0..3d8a710a809d 100644 --- a/arch/openrisc/include/asm/thread_info.h +++ b/arch/openrisc/include/asm/thread_info.h @@ -92,6 +92,7 @@ register struct thread_info *current_thread_info_reg asm("r10"); * mode */ #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */ +#define TIF_FD_SLOTS 6 /* syscall prepared descriptors */ #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */ #define TIF_RESTORE_SIGMASK 9 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling * TIF_NEED_RESCHED @@ -104,12 +105,14 @@ register struct thread_info *current_thread_info_reg asm("r10"); #define _TIF_NEED_RESCHED (1<r11. */ + l.lwz r30,TI_FLAGS(r10) + l.andi r30,r30,(_TIF_SYSCALL_TRACE|_TIF_FD_SLOTS) l.sfne r30,r0 l.bf _syscall_trace_leave l.nop diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c index 287a9718f0c6..71614b36e516 100644 --- a/arch/openrisc/kernel/ptrace.c +++ b/arch/openrisc/kernel/ptrace.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -311,6 +312,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