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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC46FECAAD3 for ; Fri, 2 Sep 2022 00:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234064AbiIBANx (ORCPT ); Thu, 1 Sep 2022 20:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbiIBANv (ORCPT ); Thu, 1 Sep 2022 20:13:51 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 653BA76778 for ; Thu, 1 Sep 2022 17:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EsucP7zXtT1s2puFStADOK+ntllkhPbc1VqqCw1HoIk=; b=mjAWJamtj0wrpSi6hSFAzefcbd JrsaWUi151GxKTxNiHzJ74AZGaLaKzPaIw1mH7Y2usj1l82lrbddX78G7fSDgAsBjIYchAWmrMrhT xL5hwE/lUsxNq/XZRkGNiI4Jx8+Gs7V3674C6B6abfGOgfuU3wdQ1EA+gg1PGHwqD9qSGh9F+9bnK 5nlXTTiQyrXCkQTbDYqgwFikReCuG7UMnFro69AkDbe4PP+CGfJ+rV4kcnLdUyyJRtvZ0qlL6Gug8 cWzT5vj0+eSzuLT2Ff214Zq2xUR/akm4E4l7O1Y4LHZBrhzlmScNoi3ADloCIJkK4Bz+MU3USXtOf rtTS1WOA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oTuJe-00B9pb-Uf; Fri, 02 Sep 2022 00:13:47 +0000 Date: Fri, 2 Sep 2022 01:13:46 +0100 From: Al Viro To: linux-riscv@lists.infradead.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: fix a nasty sigreturn bug... Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? Does anybody have objections? AFAICS, the bug is still there... On Fri, Sep 24, 2021 at 01:55:27AM +0000, Al Viro wrote: > riscv has an equivalent of arm bug fixed by 653d48b22166; if signal > gets caught by an interrupt that hits when we have the right value > in a0 (-513), *and* another signal gets delivered upon sigreturn() > (e.g. included into the blocked mask for the first signal and posted > while the handler had been running), the syscall restart logics will > see regs->cause equal to EXC_SYSCALL (we are in a syscall, after all) > and a0 already restored to its original value (-513, which happens to > be -ERESTARTNOINTR) and assume that we need to apply the usual > syscall restart logics. > > Signed-off-by: Al Viro > --- > diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c > index c2d5ecbe55264..f8fb85dc94b7a 100644 > --- a/arch/riscv/kernel/signal.c > +++ b/arch/riscv/kernel/signal.c > @@ -121,6 +121,8 @@ SYSCALL_DEFINE0(rt_sigreturn) > if (restore_altstack(&frame->uc.uc_stack)) > goto badframe; > > + regs->cause = -1UL; > + > return regs->a0; > > badframe: