mirror of https://gitee.com/openkylin/linux.git
futex: Change utime parameter to be 'const ... *'
futex(2) says that 'utime' is a pointer to 'const'. The implementation doesn't use 'const'; however, it _never_ modifies the contents of utime. - futex() either uses 'utime' as a pointer to struct or as a 'u32'. - In case it's used as a 'u32', it makes a copy of it, and of course it is not dereferenced. - In case it's used as a 'struct __kernel_timespec __user *', the pointer is not dereferenced inside the futex() definition, and it is only passed to a function: get_timespec64(), which accepts a 'const struct __kernel_timespec __user *'. [ tglx: Make the same change to the compat syscall and fixup the prototypes. ] Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20201128123945.4592-1-alx.manpages@gmail.com
This commit is contained in:
parent
997acaf6b4
commit
1ce53e2c2a
|
@ -583,11 +583,11 @@ asmlinkage long sys_unshare(unsigned long unshare_flags);
|
|||
|
||||
/* kernel/futex.c */
|
||||
asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
|
||||
struct __kernel_timespec __user *utime, u32 __user *uaddr2,
|
||||
u32 val3);
|
||||
const struct __kernel_timespec __user *utime,
|
||||
u32 __user *uaddr2, u32 val3);
|
||||
asmlinkage long sys_futex_time32(u32 __user *uaddr, int op, u32 val,
|
||||
struct old_timespec32 __user *utime, u32 __user *uaddr2,
|
||||
u32 val3);
|
||||
const struct old_timespec32 __user *utime,
|
||||
u32 __user *uaddr2, u32 val3);
|
||||
asmlinkage long sys_get_robust_list(int pid,
|
||||
struct robust_list_head __user * __user *head_ptr,
|
||||
size_t __user *len_ptr);
|
||||
|
|
|
@ -3790,8 +3790,8 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
|
|||
|
||||
|
||||
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
struct __kernel_timespec __user *, utime, u32 __user *, uaddr2,
|
||||
u32, val3)
|
||||
const struct __kernel_timespec __user *, utime,
|
||||
u32 __user *, uaddr2, u32, val3)
|
||||
{
|
||||
struct timespec64 ts;
|
||||
ktime_t t, *tp = NULL;
|
||||
|
@ -3986,7 +3986,7 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
|
|||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
||||
struct old_timespec32 __user *, utime, u32 __user *, uaddr2,
|
||||
const struct old_timespec32 __user *, utime, u32 __user *, uaddr2,
|
||||
u32, val3)
|
||||
{
|
||||
struct timespec64 ts;
|
||||
|
|
Loading…
Reference in New Issue