From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16CD063B8 for ; Mon, 20 Feb 2023 13:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 934C4C433D2; Mon, 20 Feb 2023 13:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1676901358; bh=H6WClBhaOmnPGQ+namoQkb5VssSkQFJ8BD7wGkIhsBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L18IgpP5ymAFjrYLR4ZJD0KMXBdLf+eXKIL9CqSJ5CSIHemH2nct8Ljcp5GIa6vVC j5bfB1pUmM23edyFakQpPjhpV3I4sUEf5Nx85wjASOJsnRiGxtxJqFrnV5Fh4cXd2X ccXWFubK53Vp0PPx6yfLeMz9cn3eTLLcrsqZq3+I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heiko Carstens , Sven Schnelle , Sumanth Korikkar Subject: [PATCH 5.10 17/57] [PATCH v2 1/1] s390/signal: fix endless loop in do_signal Date: Mon, 20 Feb 2023 14:36:25 +0100 Message-Id: <20230220133549.972747392@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220133549.360169435@linuxfoundation.org> References: <20230220133549.360169435@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Sumanth Korikkar No upstream commit exists: the problem addressed here is that 'commit 75309018a24d ("s390: add support for TIF_NOTIFY_SIGNAL")' was backported to 5.10. This commit is broken, but nobody noticed upstream, since shortly after s390 converted to generic entry with 'commit 56e62a737028 ("s390: convert to generic entry")', which implicitly fixed the problem outlined below. Thread flag is set to TIF_NOTIFY_SIGNAL for io_uring work. The io work user or syscall calls do_signal when either one of the TIF_SIGPENDING or TIF_NOTIFY_SIGNAL flag is set. However, do_signal does consider only TIF_SIGPENDING signal and ignores TIF_NOTIFY_SIGNAL condition. This means get_signal is never invoked for TIF_NOTIFY_SIGNAL and hence the flag is not cleared, which results in an endless do_signal loop. Reference: 'commit 788d0824269b ("io_uring: import 5.15-stable io_uring")' Fixes: 75309018a24d ("s390: add support for TIF_NOTIFY_SIGNAL") Cc: stable@vger.kernel.org # 5.10.162 Acked-by: Heiko Carstens Acked-by: Sven Schnelle Signed-off-by: Sumanth Korikkar Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c @@ -472,7 +472,7 @@ void do_signal(struct pt_regs *regs) current->thread.system_call = test_pt_regs_flag(regs, PIF_SYSCALL) ? regs->int_code : 0; - if (test_thread_flag(TIF_SIGPENDING) && get_signal(&ksig)) { + if (get_signal(&ksig)) { /* Whee! Actually deliver the signal. */ if (current->thread.system_call) { regs->int_code = current->thread.system_call;