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 32874C38145 for ; Fri, 2 Sep 2022 13:29:14 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zeGAE4/hxncHkA7yfpxr7ckeCSVaF0Zqs7mBbGoAMsw=; b=FwXCz0685eaL+X 0khHrKHbK1zXbuluj49Q8+CYnqvdjc+1PyNnZYr6fommxEcPwqIkLjg18sAJuV5BwN2K0bDdnYu7r TfZE+IKMHdt5WPoQaPj4fkMcX8sbdaToudS2x7MlNeKQ3FDVXcaqSk9vH5YP7r57akLpmAJrVi+yV WdoJohj5gjM0OGYMb2CA9tOAKlWwfhmYMgVYPjdfmEttX7AZqY9iVOVQvglxUSh4O/tv18rXARqUZ fA/340pdWw5K9UEV69c1vbu22VuvXtAbtAOkTGTfnxiYQUiVqoueTTNsOKi0ty0dYsDB0I2ENDtqY iSqq3dpkTPayIr0AwDpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oU6iQ-0055Be-PE; Fri, 02 Sep 2022 13:28:10 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oU6iN-00559t-GG for linux-arm-kernel@lists.infradead.org; Fri, 02 Sep 2022 13:28:08 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B729A620B7; Fri, 2 Sep 2022 13:28:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CDE4C433D6; Fri, 2 Sep 2022 13:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662125286; bh=GhwNE9VNeFqkNFezGLJnGdElo5ZBsmO9P5hfpSc4KyM=; h=From:To:Cc:Subject:Date:From; b=DXbvoXceLXh2L8lZ8QvaopYxqO9t1ez5SQouFQ1IJaT+mWUzOSRZYK8jm+XSPUVy8 wzn4zKPa0vBbfpPXrJo5z35qD9/cARlElQrk0BvIS3LiA7raWXEm3i151g7iDqBLQW Mq/MBj5ae6u4tDodwfLa+09O7Tfcp0eEsINQqTyWK+GAjHHZHSzgRKkBgXn1WxCExe VwVvXaTTGBo1xg5c0+oBltmM3jxSl1esqxwoiFIgwNhBjKb8UHan+EENGwFdPOFGy6 mL38A5GQsAWxGQQpx3VHvyUKYyle7tpASWh4Bejhchz7udthDczxcSJ4ORywwezYJN GUO1SlCgOIksw== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH] arm64/ptrace: Don't clear calling process' TIF_SME on OOM Date: Fri, 2 Sep 2022 14:28:02 +0100 Message-Id: <20220902132802.39682-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1333; i=broonie@kernel.org; h=from:subject; bh=GhwNE9VNeFqkNFezGLJnGdElo5ZBsmO9P5hfpSc4KyM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjEgThgYdj5QDHrLJjsJwTtQiU1j7d6/hPb4Lrm184 MT6GkJeJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYxIE4QAKCRAk1otyXVSH0ILIB/ kBqrrWliIF1IK+zrHHQxel6DgHhLRdRaXQG/4zdgKr9NpISBQ9DmY9ZcmhL/WCZq8/1HZSWVOgt2S9 rx/rZzqxoaDA2d4bMFb8fo0O5khognsmBHuDJs6y+21XpBLaB9pcKhcJqUBnazlh2cQVUXw8a7gSlI x0SkCraP4RsAPlJtcxttj+3rMxVckgJ7KABHmvu3Iq6suF7brwnTOMpKUG8SoEA8eB8GY1nF4dmUXI 2nuOl1VWf+3G/cC2p0zn9KyAPsakQl0AsTGRYQkH3hbWhRFaHgCiK6LigROLfnXmh1XMEgPLulNhQs YDrqgv3fdAzYfSi1PgGSn+9MplD5Bk X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220902_062807_601932_960164C4 X-CRM114-Status: GOOD ( 12.18 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If allocating memory for the target SVE state in za_set() fails we clear TIF_SME for the ptracing task which is obviously not correct. If we are here we know that the target task already had neither TIF_SVE nor TIF_SME set since we only need to allocate if either the target had not used either SVE or SME and had no need to allocate state before or we just changed the vector length with vec_set_vector_length() which clears TIF_ for us on allocation failure so just remove the clear entirely. Reported-by: Wang ShaoBo Signed-off-by: Mark Brown --- arch/arm64/kernel/ptrace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index eb7c08dfb834..041d2ae5c30a 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -1084,7 +1084,6 @@ static int za_set(struct task_struct *target, if (!target->thread.sve_state) { sve_alloc(target, false); if (!target->thread.sve_state) { - clear_thread_flag(TIF_SME); ret = -ENOMEM; goto out; } @@ -1094,7 +1093,6 @@ static int za_set(struct task_struct *target, sme_alloc(target); if (!target->thread.za_state) { ret = -ENOMEM; - clear_tsk_thread_flag(target, TIF_SME); goto out; } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel