Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp118860rwb; Fri, 2 Sep 2022 11:07:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR41+oWynTPk5E7BbYWY9kF4RNiavQ7RvLE0T7X7MwoD/Ekg8/ew9NQRfsj6oHfNfH6fRusR X-Received: by 2002:a05:6a00:896:b0:53a:993c:a45e with SMTP id q22-20020a056a00089600b0053a993ca45emr16043855pfj.83.1662142040351; Fri, 02 Sep 2022 11:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662142040; cv=none; d=google.com; s=arc-20160816; b=V7Br83ypjBnWGLR7bkdOGms54Z9+l6XYRphABwTFQ1KFNlqOn9sWE9/F8XHP0ARY0J 29Xt9Tw8wGwQzSlyQpp524CaRMt00lwN4Fi2bA7uc9FAbM2IyIFSPnLy9rVXyGzU/2Oj HExkxUboWlBeVr3hSuKn1EF9nyqzSwn3mStBRugWqpwAVRMwUU4sdN/mryd+H5qSS+zC WxTfTFqFHBasdC5ou+c0YTOPUKhmWqspZj0UysjdQTVOoQVxm3Tyn0Hhi0WbzcvgcCks rgDU+9nAt7Y+WpaWBVyvq7nVXDbLYh8VAsrAHZ8UleD9subcYgHyxkRKnqWr+osF8pdU 66TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jDC7BqYo1R92jQlcphXp72QFerhqQBqx/36u1nEWo8I=; b=hC2TdUMiXkzlFGX0570IxFqi/MbeAYDeCvFtfetYMzVwjZbO/B8Trt8kdrEHeRFAFi zp010/iIE8dLuh3NJTI9rBkhsbqF65s6x+vMHX/qbUooVJoE/UzzHqvE/RW0HAKjRA88 QbJ2VQm5RI2KelDTbhECyCoAE04bmO5LWnkIsGHnS+2w7zuj/1wde6DHrHtfCyQgmaRm V0inbXXokJGyvTPQ/TD96GabLKJli09YTSqpSpA9n0JinUMzABe4zOKvTnpqoW0PMYrA GyQY+W/PV4FZaU1dLQrVIUBItsha680AIH6KT9utEJWLPFP63ENumFebQRETqK69Rp6N ro3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Pn7d4Cl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a17090aa01500b001f2f5069097si7754941pjp.33.2022.09.02.11.06.50; Fri, 02 Sep 2022 11:07:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Pn7d4Cl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235848AbiIBR7n (ORCPT + 99 others); Fri, 2 Sep 2022 13:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbiIBR7l (ORCPT ); Fri, 2 Sep 2022 13:59:41 -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 3ACAB2CDFD for ; Fri, 2 Sep 2022 10:59:40 -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=jDC7BqYo1R92jQlcphXp72QFerhqQBqx/36u1nEWo8I=; b=Pn7d4Cl4P8/i9GBaN50WiffbYK TKDYFY8U3yBtZN+zJ+3zSxzCAtxn/lkMvLobXg5x1mq4iN4hxADhMn7S5tEXeirHu2uW70ML6Xh2n uQnAcUbaaebbkJ/wa9yjIAz37GOKdKxhWvXubVPc/dFY96cc0QSVBUgEikDzSNGhat3o3gqAgCmjA jhdRluR1HqbYhXX2Ov0jDcgZpVAfa5ZyFLZ12uTpr6GRpl3ZUil2SJ9SjjkYy5uXb9AOSIT4bIaC+ 4BQ99DEmyac5wgNxcTIktHmEt3+RODZ83fsAgJCxECMOqKSFbuMsowsT9sH04pA0dCheJ5EzREgWB LynoUUFQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oUAx7-00BPZr-1h; Fri, 02 Sep 2022 17:59:37 +0000 Date: Fri, 2 Sep 2022 18:59:37 +0100 From: Al Viro To: Andrew Jones Cc: linux-riscv@lists.infradead.org, Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: fix a nasty sigreturn bug... Message-ID: References: <20220902092245.ande6fvievnbn35h@kamzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220902092245.ande6fvievnbn35h@kamzik> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 02, 2022 at 11:22:45AM +0200, Andrew Jones wrote: > So, for riscv, where in do_signal and handle_signal syscall restarting > is avoided when regs->cause != EXC_SYSCALL and it's common to set cause > to -1 to avoid it, then it makes sense to set regs->cause != EXEC_SYSCALL > in rt_sigreturn or in restore_sigcontext, which rt_sigreturn calls, as > well. > > So the only question I have is whether or not the cause assignment > is better in restore_sigcontext() like other architectures? At least, > since rt_sigreturn is the only caller of restore_sigcontext, it can't > break anything putting it there atm... The only reason for doing that in restore_sigcontext() is that for old architectures there'd been separate sigreturn(2) and rt_sigreturn(2). Doing that in the helper shared by both avoided duplication; since there's no such thing on riscv... Matter of taste, really - I have a slight preference for doing that closer to the syscall surface, but it's no more than that.