lkml.org 
[lkml]   [2019]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V2] MIPS: Add get_thread_area syscall
On Fri, Dec 13, 2019 at 9:30 AM Guoyun Sun <sunguoyun@loongson.cn> wrote:

Thanks for fixing the numbers. On second look, I saw another problem:

> diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
> index c333e57..20bf4c5 100644
> --- a/arch/mips/kernel/syscall.c
> +++ b/arch/mips/kernel/syscall.c
> @@ -94,6 +94,16 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
> return 0;
> }
>
> +SYSCALL_DEFINE1(get_thread_area, unsigned long __user *, u_info)
> +{
> + struct thread_info *ti = task_thread_info(current);
> +
> + if (copy_to_user(u_info, &(ti->tp_value), sizeof(ti->tp_value)))
> + return -EFAULT;
> +
> + return 0;
> +}
> +

This won't work for compat mode, when tp_value is a different size
in kernel and user space. You could either add a COMPAT_SYSCALL_DEFINE1()
variant, or handle it like

if (in_compat_syscall())
return put_user(ti->tp_value, (__u32 *)u_info);
return put_user(ti->tp_value, u_info);


Arnd

\
 
 \ /
  Last update: 2019-12-13 10:13    [W:0.037 / U:10.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site