Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7654550rwb; Tue, 15 Nov 2022 15:56:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf4hqVpM5zKLr6QBXs6Q0zoao3msPqZB3ca8fQAIlL1BJXV8bhLo8uZAxM/A7gEMk8PBAoAn X-Received: by 2002:a17:906:a896:b0:7ab:afd4:d7ed with SMTP id ha22-20020a170906a89600b007abafd4d7edmr15572605ejb.228.1668556586695; Tue, 15 Nov 2022 15:56:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668556586; cv=none; d=google.com; s=arc-20160816; b=fa865sJmU9Pv+L+YejThtqslsqfvC05NmorY8bxviuOJ7zwEBN7bVGA+/E2H+Wyznt je0gtRlq1L0HZubyoTB7BFu8P2uy9qTDBFoqeLslJ1GtkW0Qy5mh1iqt7kqqZvdCUm9R H3wMW40LKz9FBnUDVUeYK3Cf3qB9dXgg76sVXWp1UdzUXUqEzF5ZTTAWFdcP14jUG5m6 xOsWCae16fM65RWpT3NZ5UgPTfi7Tz/JC2fIFJaKaBtkZBQ1ZuZey8oAiOLx8N4U0hZS vNtXUxvXs3EZIuWxQnQnglbpWlWSx794IH/iijitLv5lM73H1Qn5RbFf0eSrukXJkbQR KpKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qhCq8AfDMkagyPimKyHUX7gwQAIYuE0429CZlbx4GKo=; b=v3d+uADAxDDRfkubMFqfaX33oXeOL5N1PU+KHsJgwlrRvJbs1t7n3wbukYG9HLR33X f6f8ztnew10agpfygQOWiGajOnMojnUPl91ZjEyfD/sKdNHwkk9bXPUXk7Fs5ubpWoER Pz3yjGPAxcdqffSX83HSL8riKama8E9Dx7/WKhB045NXWGezZXe7bR0eAD6kD9Q8wRS+ 2AYg31IusvSkVdMYSPCjikTWNpPdS9QAAtXVcJG7j7SoLRGTrNmEPYF9RVrVsAYhQxr7 D2d2B9h2FzbT03n3GB4l/iAMVgnxrJH+kOOgKpnHXj/EL/BMUzEucr8S1BM6u2qtDuKZ NWTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kylehuey.com header.s=google header.b=GimrCofV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh14-20020a170906da8e00b0078dd12d0a9fsi11413390ejb.548.2022.11.15.15.55.52; Tue, 15 Nov 2022 15:56:26 -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=@kylehuey.com header.s=google header.b=GimrCofV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231811AbiKOXMD (ORCPT + 90 others); Tue, 15 Nov 2022 18:12:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231931AbiKOXLe (ORCPT ); Tue, 15 Nov 2022 18:11:34 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BBBF2E694 for ; Tue, 15 Nov 2022 15:11:33 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so625044pjk.1 for ; Tue, 15 Nov 2022 15:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qhCq8AfDMkagyPimKyHUX7gwQAIYuE0429CZlbx4GKo=; b=GimrCofVDchBbipFskt1iUCOXnsWmIdeeUhJXRau6K5YrKcWWLcbm4F6m/Rt+KUJAw +WRhPd+7BzDfOsxy0qrFpcfJzeV+BcJpYPqUUHzjI40fCqFnDZ/60Sn/OqkCFCwvJ1Pa 8fbLcULMD5kLsZxJQx+HNteTzYyOKSAqUvU6rdjNsW8sgOgMMV75IDivsBzAHyMGZTSN 1LCWAgm2a9FTx2BX9r0sq0SdTky6C/z5V1IyDlILeX5grbmZ82gCRccKNehMA4xWGVLe jDkvaMW/D3aT8UGl4tk5nqXwC7c4CNpe93sbiL70+q70UZ6IwOrMNi/O9mCpoQygC8oy X3Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhCq8AfDMkagyPimKyHUX7gwQAIYuE0429CZlbx4GKo=; b=g/3ABBWyelJTMsG3LPzuM+88jCMqTe+OOA6MfkUDJjND50AAAjMK2+hU9iDeWCZxpT xjYo3xuK0KS6trs2ANfH9hKNJ9cc5LdZNcg6nbZ8KSpbvVyxVLVNS7spV0fSFiKBZCw3 t0LSiqpE7jRhsr2DwyQArCD7rLaNthnx73KwMjjwTZCEfdLVNf731ro3jIHDE5+IN4DR nBd1MmKsovx0xcIooM8NncKJkCRw7lFmu66Vm60lr0q50DA5+V7NoOnXyGCnMTFOjvoH OkM4jNfKyL6fGKq4fcK2BzT28CKzStuBvvGZ3SWJs85idEt7dD+ETvgf8aHtff4coU0/ JCgQ== X-Gm-Message-State: ANoB5pnSkMrLetZtd3n8NnFNj2ohfaS+vlyGsC1KWkErpb/97L5wL8hX bq4F3IerJ/o53IXrGSpj/DaKgA== X-Received: by 2002:a17:902:e483:b0:188:b44b:598 with SMTP id i3-20020a170902e48300b00188b44b0598mr6272266ple.54.1668553892785; Tue, 15 Nov 2022 15:11:32 -0800 (PST) Received: from minbar.home.kylehuey.com (c-71-198-251-229.hsd1.ca.comcast.net. [71.198.251.229]) by smtp.gmail.com with ESMTPSA id f15-20020a62380f000000b0056c360af4e3sm9308372pfa.9.2022.11.15.15.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 15:11:32 -0800 (PST) From: Kyle Huey X-Google-Original-From: Kyle Huey To: Dave Hansen Cc: Linus Torvalds , Thomas Gleixner , Borislav Petkov , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Robert O'Callahan , David Manouchehri , Kyle Huey Subject: [PATCH v7 1/6] x86/fpu: Take task_struct* in copy_sigframe_from_user_to_xstate() Date: Tue, 15 Nov 2022 15:09:27 -0800 Message-Id: <20221115230932.7126-2-khuey@kylehuey.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221115230932.7126-1-khuey@kylehuey.com> References: <20221115230932.7126-1-khuey@kylehuey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 --- 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 91d4b6de58ab..558076dbde5b 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 59e543b95a3c..32ba5d95628d 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 5ad47031383b..f08ee2722e74 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); -- 2.38.1