[PATCH 4/6] x86/shstk: add "task_struct *tsk" argument to reset_thread_features()

Oleg Nesterov posted 6 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 4/6] x86/shstk: add "task_struct *tsk" argument to reset_thread_features()
Posted by Oleg Nesterov 1 month, 3 weeks ago
Preparation for the next change.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 arch/x86/include/asm/shstk.h | 4 ++--
 arch/x86/kernel/process_64.c | 2 +-
 arch/x86/kernel/shstk.c      | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/shstk.h b/arch/x86/include/asm/shstk.h
index ba6f2fe43848..92d449cc352a 100644
--- a/arch/x86/include/asm/shstk.h
+++ b/arch/x86/include/asm/shstk.h
@@ -15,7 +15,7 @@ struct thread_shstk {
 };
 
 long shstk_prctl(struct task_struct *task, int option, unsigned long arg2);
-void reset_thread_features(void);
+void reset_thread_features(struct task_struct *task);
 unsigned long shstk_alloc_thread_stack(struct task_struct *p, unsigned long clone_flags,
 				       unsigned long stack_size);
 void shstk_free(struct task_struct *p);
@@ -26,7 +26,7 @@ bool shstk_is_enabled(void);
 #else
 static inline long shstk_prctl(struct task_struct *task, int option,
 			       unsigned long arg2) { return -EINVAL; }
-static inline void reset_thread_features(void) {}
+static inline void reset_thread_features(struct task_struct *task) {}
 static inline unsigned long shstk_alloc_thread_stack(struct task_struct *p,
 						     unsigned long clone_flags,
 						     unsigned long stack_size) { return 0; }
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 52a5c03c353c..543425ea8d44 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -540,7 +540,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
 		load_gs_index(__USER_DS);
 	}
 
-	reset_thread_features();
+	reset_thread_features(current);
 
 	loadsegment(fs, 0);
 	loadsegment(es, _ds);
diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
index 2ddf23387c7e..e6d3b1371b11 100644
--- a/arch/x86/kernel/shstk.c
+++ b/arch/x86/kernel/shstk.c
@@ -184,11 +184,11 @@ static int shstk_setup(void)
 	return 0;
 }
 
-void reset_thread_features(void)
+void reset_thread_features(struct task_struct *tsk)
 {
-	memset(&current->thread.shstk, 0, sizeof(struct thread_shstk));
-	current->thread.features = 0;
-	current->thread.features_locked = 0;
+	memset(&tsk->thread.shstk, 0, sizeof(struct thread_shstk));
+	tsk->thread.features = 0;
+	tsk->thread.features_locked = 0;
 }
 
 unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, unsigned long clone_flags,
-- 
2.25.1.362.g51ebf55