* [PATCH] um: Stop conflating task_struct::stack with thread_info
@ 2016-07-18 22:22 Andy Lutomirski
2016-07-18 22:25 ` Andy Lutomirski
0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2016-07-18 22:22 UTC (permalink / raw)
To: x86; +Cc: Borislav Petkov, linux-kernel, Linus Torvalds, Andy Lutomirski
From: Linus Torvalds <torvalds@linux-foundation.org>
thread_info may move in the future, so use the accessors.
[Andy Lutomirski wrote this changelog message and changed
"task_thread_info(child)->cpu" to "task_cpu(child)".]
Message-Id: <CA+55aFxvZhBu9U1cqpVm4frv0p5mqu=0TxsSqE-=95ft8HvCVA@mail.gmail.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
arch/x86/um/ptrace_32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c
index ebd4dd6ef73b..2a6f781ce9cf 100644
--- a/arch/x86/um/ptrace_32.c
+++ b/arch/x86/um/ptrace_32.c
@@ -191,7 +191,7 @@ int peek_user(struct task_struct *child, long addr, long data)
static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
{
- int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
+ int err, n, cpu = task_cpu(child);
struct user_i387_struct fpregs;
err = save_i387_registers(userspace_pid[cpu],
@@ -208,7 +208,7 @@ static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *c
static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
{
- int n, cpu = ((struct thread_info *) child->stack)->cpu;
+ int n, cpu = task_cpu(child);
struct user_i387_struct fpregs;
n = copy_from_user(&fpregs, buf, sizeof(fpregs));
@@ -221,7 +221,7 @@ static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *c
static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
{
- int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
+ int err, n, cpu = task_cpu(child);
struct user_fxsr_struct fpregs;
err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
@@ -237,7 +237,7 @@ static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *
static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
{
- int n, cpu = ((struct thread_info *) child->stack)->cpu;
+ int n, cpu = task_cpu(child);
struct user_fxsr_struct fpregs;
n = copy_from_user(&fpregs, buf, sizeof(fpregs));
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] um: Stop conflating task_struct::stack with thread_info
2016-07-18 22:22 [PATCH] um: Stop conflating task_struct::stack with thread_info Andy Lutomirski
@ 2016-07-18 22:25 ` Andy Lutomirski
0 siblings, 0 replies; 2+ messages in thread
From: Andy Lutomirski @ 2016-07-18 22:25 UTC (permalink / raw)
To: Andy Lutomirski, Richard Weinberger, Jeff Dike
Cc: X86 ML, Borislav Petkov, linux-kernel, Linus Torvalds
On Mon, Jul 18, 2016 at 3:22 PM, Andy Lutomirski <luto@kernel.org> wrote:
> From: Linus Torvalds <torvalds@linux-foundation.org>
>
> thread_info may move in the future, so use the accessors.
>
> [Andy Lutomirski wrote this changelog message and changed
> "task_thread_info(child)->cpu" to "task_cpu(child)".]
>
> Message-Id: <CA+55aFxvZhBu9U1cqpVm4frv0p5mqu=0TxsSqE-=95ft8HvCVA@mail.gmail.com>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
Forgot to cc maintainers...
> ---
> arch/x86/um/ptrace_32.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c
> index ebd4dd6ef73b..2a6f781ce9cf 100644
> --- a/arch/x86/um/ptrace_32.c
> +++ b/arch/x86/um/ptrace_32.c
> @@ -191,7 +191,7 @@ int peek_user(struct task_struct *child, long addr, long data)
>
> static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
> {
> - int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
> + int err, n, cpu = task_cpu(child);
> struct user_i387_struct fpregs;
>
> err = save_i387_registers(userspace_pid[cpu],
> @@ -208,7 +208,7 @@ static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *c
>
> static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
> {
> - int n, cpu = ((struct thread_info *) child->stack)->cpu;
> + int n, cpu = task_cpu(child);
> struct user_i387_struct fpregs;
>
> n = copy_from_user(&fpregs, buf, sizeof(fpregs));
> @@ -221,7 +221,7 @@ static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *c
>
> static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
> {
> - int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
> + int err, n, cpu = task_cpu(child);
> struct user_fxsr_struct fpregs;
>
> err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs);
> @@ -237,7 +237,7 @@ static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *
>
> static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
> {
> - int n, cpu = ((struct thread_info *) child->stack)->cpu;
> + int n, cpu = task_cpu(child);
> struct user_fxsr_struct fpregs;
>
> n = copy_from_user(&fpregs, buf, sizeof(fpregs));
> --
> 2.7.4
>
--
Andy Lutomirski
AMA Capital Management, LLC
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-18 22:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 22:22 [PATCH] um: Stop conflating task_struct::stack with thread_info Andy Lutomirski
2016-07-18 22:25 ` Andy Lutomirski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®