From patchwork Wed Nov 16 23:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 21328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp117344wrr; Wed, 16 Nov 2022 15:39:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iZ1vNwTZXOE+zJYNQ64mAl8jNwEhsxF6gyYTyEfXyfkEOoM0Tdsa6IPBrAcYkB3YLY98E X-Received: by 2002:a17:907:2105:b0:7a1:1c24:e566 with SMTP id qn5-20020a170907210500b007a11c24e566mr95569ejb.360.1668641993692; Wed, 16 Nov 2022 15:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668641993; cv=none; d=google.com; s=arc-20160816; b=PgRqDQPZb+JgI3iBUVu/jZBkaGvzUcSzAr6GETQDwR/dgPT+WPIR09nhGj3RmZ4Fx4 TomR92FZumqnFc3k0y5mq2B7bCPEiyiNsmplN4fhuUOH4b0HhID3kFCdj3gqgf8cRxsO gX5vDem1pxKODqkbGoItGoHNwmen5hL3Y84YE9ZECxmo3+5jjM4WJQ9Y8SkqsYkTxNiT BYuCtBryajw3bJdQCzjxXA6nDeyhIEYuZ4E165bhHkEsVGO0bC6+qmBHj6rpmjrTGAht dnt+zJsToTHKbMXUltOWmTwWnD475v/SAW9BCPYFpba+6QdY3LAyGqyzcvkQqG/h7Og7 iEfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=BIb2nOVzdKV7fJjQ2ycPYqfNNp5cI/HfWI1S6RSu83A=; b=W9/kDM1y715FL3bjdsLP0ndGXRkSRutYPxG3plNUabVXb84zLYF3qCs2htCeFE1mAg f+2xaYC+9mPNq7wPmI1I/pI89ZFFWuBvCzLK3ZZd/JWn7S/wlm/cCzrsP0J9DkRRsEAw ePkW9H8X22sE8+Pd+F8hk44v2ZPSj5btH0Pk1CHW6PFLlc6kXLInMeUOao4IoxjDdVQS tStC4FIt5257puiCQlTR+Em/Jxj9vnDe4wsVlEhd/ALZMGR8RouwMywRHAeeLq6bm4rx +bY2KSzA/NU4sbiIg72DrlzwaT9PPqrYw+s+savll0rn/HzcyJBqGgylBe98WXQGB8LZ tbRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TzLuM7xk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=M2PZen7b; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a508e15000000b00461f44d7bfcsi13258273edw.573.2022.11.16.15.39.28; Wed, 16 Nov 2022 15:39:53 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=TzLuM7xk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=M2PZen7b; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234460AbiKPXeX (ORCPT + 99 others); Wed, 16 Nov 2022 18:34:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234185AbiKPXeA (ORCPT ); Wed, 16 Nov 2022 18:34:00 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D23D449B46; Wed, 16 Nov 2022 15:33:57 -0800 (PST) Date: Wed, 16 Nov 2022 23:33:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668641636; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BIb2nOVzdKV7fJjQ2ycPYqfNNp5cI/HfWI1S6RSu83A=; b=TzLuM7xkr9NGQcEE4rtRFVJ3FAdWJ6s7Lwsz+mIUPibLFIVgOcGNsZy/ODX1llcgJRyOUV iofAfo6/93+FSn0NV5nlYQc6DSBm2geIak1nizbEENY3g097YT/UCeHMM0O1ARFX/fC7R4 G7rfS7MaJTwrxgWWgEpaAsy9uDMN0uoyZn1gsp4g5oBF2xwn+p29j6pdXSUugg8SgwcEff smB0vuBXMeKg2g/NAPAuqLYZ+5r33LHv3JWNsdV8WvZyXo3Y/RGKJbt/2TfvUH6RGRjS1Q FY5BodTwYJp9tjPhpV6PRoB21Cz/v3moJMQOuJf/pxsupGDFPtwgG+ylZG2xPA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668641636; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BIb2nOVzdKV7fJjQ2ycPYqfNNp5cI/HfWI1S6RSu83A=; b=M2PZen7bnALy83U5Ul57cGLH1B3FQ842UYYAALaQOXC0ahXq7pqDg+bdyCdZS4w9VFkeQ3 w1aHwfgYOX8ZL/Dg== From: "tip-bot2 for Kyle Huey" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fpu] x86/fpu: Take task_struct* in copy_sigframe_from_user_to_xstate() Cc: Kyle Huey , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <166864163463.4906.1952742397458403904.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749697946701212845?= X-GMAIL-MSGID: =?utf-8?q?1749697946701212845?= The following commit has been merged into the x86/fpu branch of tip: Commit-ID: 6a877d2450ace4f27c012519e5a1ae818f931983 Gitweb: https://git.kernel.org/tip/6a877d2450ace4f27c012519e5a1ae818f931983 Author: Kyle Huey AuthorDate: Tue, 15 Nov 2022 15:09:27 -08:00 Committer: Dave Hansen CommitterDate: Wed, 16 Nov 2022 15:02:30 -08:00 x86/fpu: Take task_struct* in copy_sigframe_from_user_to_xstate() This will allow copy_sigframe_from_user_to_xstate() to grab the address of thread_struct's pkru value in a later patch. Signed-off-by: Kyle Huey Signed-off-by: Dave Hansen Link: https://lore.kernel.org/all/20221115230932.7126-2-khuey%40kylehuey.com --- arch/x86/kernel/fpu/signal.c | 2 +- arch/x86/kernel/fpu/xstate.c | 4 ++-- arch/x86/kernel/fpu/xstate.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c index 91d4b6d..558076d 100644 --- a/arch/x86/kernel/fpu/signal.c +++ b/arch/x86/kernel/fpu/signal.c @@ -396,7 +396,7 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx, fpregs = &fpu->fpstate->regs; if (use_xsave() && !fx_only) { - if (copy_sigframe_from_user_to_xstate(fpu->fpstate, buf_fx)) + if (copy_sigframe_from_user_to_xstate(tsk, buf_fx)) return false; } else { if (__copy_from_user(&fpregs->fxsave, buf_fx, diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index c2dde46..c88c60b 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1278,10 +1278,10 @@ int copy_uabi_from_kernel_to_xstate(struct fpstate *fpstate, const void *kbuf) * XSAVE[S] format and copy to the target thread. This is called from the * sigreturn() and rt_sigreturn() system calls. */ -int copy_sigframe_from_user_to_xstate(struct fpstate *fpstate, +int copy_sigframe_from_user_to_xstate(struct task_struct *tsk, const void __user *ubuf) { - return copy_uabi_to_xstate(fpstate, NULL, ubuf); + return copy_uabi_to_xstate(tsk->thread.fpu.fpstate, NULL, ubuf); } static bool validate_independent_components(u64 mask) diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h index 5ad4703..f08ee27 100644 --- a/arch/x86/kernel/fpu/xstate.h +++ b/arch/x86/kernel/fpu/xstate.h @@ -47,7 +47,7 @@ extern void __copy_xstate_to_uabi_buf(struct membuf to, struct fpstate *fpstate, extern void copy_xstate_to_uabi_buf(struct membuf to, struct task_struct *tsk, enum xstate_copy_mode mode); extern int copy_uabi_from_kernel_to_xstate(struct fpstate *fpstate, const void *kbuf); -extern int copy_sigframe_from_user_to_xstate(struct fpstate *fpstate, const void __user *ubuf); +extern int copy_sigframe_from_user_to_xstate(struct task_struct *tsk, const void __user *ubuf); extern void fpu__init_cpu_xstate(void);