Message ID | 20231030063709.2443546-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4.19] arm64: fix a concurrency issue in emulation_proc_handler() | expand |
On Mon, Oct 30, 2023 at 06:37:09AM +0000, Jinjie Ruan wrote: > In linux-6.1, the related code is refactored in commit 124c49b1b5d9 > ("arm64: armv8_deprecated: rework deprected instruction handling") and this > issue was incidentally fixed. I have adapted the patch set to linux stable > 5.10. However, 4.19 and 5.10 are too different and the patch set is > hard to adapt to 4.19. This is also needed for 5.4.y, right? Now queued up for both. thanks, greg k-h
On 2023/10/31 19:18, Greg KH wrote: > On Mon, Oct 30, 2023 at 06:37:09AM +0000, Jinjie Ruan wrote: >> In linux-6.1, the related code is refactored in commit 124c49b1b5d9 >> ("arm64: armv8_deprecated: rework deprected instruction handling") and this >> issue was incidentally fixed. I have adapted the patch set to linux stable >> 5.10. However, 4.19 and 5.10 are too different and the patch set is >> hard to adapt to 4.19. > > This is also needed for 5.4.y, right? Now queued up for both. Right! 5.4.y also need it. Thank you very much. > > thanks, > > greg k-h > > From mboxrd@z Thu Jan 1 00:00:00 1970 > Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> > 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 81AC2C4332F > for <linux-arm-kernel@archiver.kernel.org>; Tue, 31 Oct 2023 11:19:01 +0000 (UTC) > DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; > d=lists.infradead.org; s=bombadil.20210309; h=Sender: > Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: > List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: > Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: > Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: > List-Owner; bh=sHNb70g1HDu0TF54RigSJfYMEz5vBtgGnOr5JOh2HyQ=; b=iFgVKiA+IkzhII > m4gw5nvcyNNhqjko8wsNMeG+gPyXUAkeZPfjW2w2erf+P6b4YZFQ0iuIwjDLzv/SBKpYa+vWmbv5E > /TisXFYw7ISsR7nmNdQMmZWs5VVeGYO7MlP1u1/2Cw7EfSZ28ynjndjexd7fVHeKdB5R2ciVsWPVk > n2v29BlvlRs7MfzHJ2JKYyd0JqFoGKTDPxQA5G2l3+aKt1p+5Ujqvv+adKlaU9ZO+qd/DErfcwATR > BGvjbVo1uYIXyMXqoODe/dZW7BTcnC9WQb5cxnq3GUP2AzfEaStJEYNvX9e6DQKM89EfhU1EBLZMt > e7MdaC4WSAweX4R63wQA==; > Received: from localhost ([::1] helo=bombadil.infradead.org) > by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) > id 1qxmlU-0059OC-1J; > Tue, 31 Oct 2023 11:18:32 +0000 > Received: from ams.source.kernel.org ([145.40.68.75]) > by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) > id 1qxmlR-0059Ma-34 > for linux-arm-kernel@lists.infradead.org; > Tue, 31 Oct 2023 11:18:31 +0000 > Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) > by ams.source.kernel.org (Postfix) with ESMTP id 8E876B810AC; > Tue, 31 Oct 2023 11:18:21 +0000 (UTC) > Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E680C433C8; > Tue, 31 Oct 2023 11:18:20 +0000 (UTC) > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; > s=korg; t=1698751100; > bh=FrkgzgA5lVgOv9L7nzUu3Pnkn7b1h5ivphcK2rmy0/k=; > h=Date:From:To:Cc:Subject:References:In-Reply-To:From; > b=0SnFDTNYaKYCbdOzEos6VTDFSfwrsP68TOPQnm1RW6NlEHxCMLjW5JSmUoK5ya9Yn > wvsTROrz11Ki59JxvLNnYJdmRMpdVzi6WC2gjr3O2xq6Rd0NE5r/0OMIHmdM+ucQvJ > c0k+YQyEE43MNueByonhQ6Zw4tfdwPoxruNsrMr4= > Date: Tue, 31 Oct 2023 12:18:17 +0100 > From: Greg KH <gregkh@linuxfoundation.org> > To: Jinjie Ruan <ruanjinjie@huawei.com> > Cc: catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, > linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org > Subject: Re: [PATCH v4.19] arm64: fix a concurrency issue in > emulation_proc_handler() > Message-ID: <2023103103-revision-gigantic-cc05@gregkh> > References: <20231030063709.2443546-1-ruanjinjie@huawei.com> > MIME-Version: 1.0 > Content-Disposition: inline > In-Reply-To: <20231030063709.2443546-1-ruanjinjie@huawei.com> > X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 > X-CRM114-CacheID: sfid-20231031_041830_159334_D1F4D83C > X-CRM114-Status: GOOD ( 10.35 ) > X-BeenThere: linux-arm-kernel@lists.infradead.org > X-Mailman-Version: 2.1.34 > Precedence: list > List-Id: <linux-arm-kernel.lists.infradead.org> > List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, > <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> > List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> > List-Post: <mailto:linux-arm-kernel@lists.infradead.org> > List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> > List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, > <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> > Content-Type: text/plain; charset="us-ascii" > Content-Transfer-Encoding: 7bit > Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> > Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > > On Mon, Oct 30, 2023 at 06:37:09AM +0000, Jinjie Ruan wrote: >> In linux-6.1, the related code is refactored in commit 124c49b1b5d9 >> ("arm64: armv8_deprecated: rework deprected instruction handling") and this >> issue was incidentally fixed. I have adapted the patch set to linux stable >> 5.10. However, 4.19 and 5.10 are too different and the patch set is >> hard to adapt to 4.19. > > This is also needed for 5.4.y, right? Now queued up for both. > > thanks, > > greg k-h > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index 7c69a203cdf8..b8d481c3e26d 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -211,10 +211,12 @@ static int emulation_proc_handler(struct ctl_table *table, int write, loff_t *ppos) { int ret = 0; - struct insn_emulation *insn = container_of(table->data, struct insn_emulation, current_mode); - enum insn_emulation_mode prev_mode = insn->current_mode; + struct insn_emulation *insn; + enum insn_emulation_mode prev_mode; mutex_lock(&insn_emulation_mutex); + insn = container_of(table->data, struct insn_emulation, current_mode); + prev_mode = insn->current_mode; ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); if (ret || !write || prev_mode == insn->current_mode)