lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 7 Jul 2017 16:22:15 +0100 From: Al Viro <viro@...IV.linux.org.uk> To: Michael Ellerman <mpe@...erman.id.au> Cc: torvalds@...ux-fondation.org, linux-kernel@...r.kernel.org, linuxppc-dev@...abs.org, linux-fsdevel@...r.kernel.org Subject: Re: [PATCH] fs/fcntl: Fix F_GET/SETLK etc. for compat processes On Fri, Jul 07, 2017 at 10:48:51PM +1000, Michael Ellerman wrote: > Commit 8c6657cb50cb ("Switch flock copyin/copyout primitives to > copy_{from,to}_user()") added copy_flock_fields(from, to), but then in all cases > called it with arguments of (to, from). eg: > > static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl) > { > struct compat_flock fl; > > if (copy_from_user(&fl, ufl, sizeof(struct compat_flock))) > return -EFAULT; > copy_flock_fields(*kfl, fl); > return 0; > } > > We are reading the compat_flock ufl from userspace, into flock kfl. First we > copy all of ufl into fl on the stack, and then we want to assign each field of > fl to kfl. So we are copying from fl and to kfl. But as written the > copy_flock_fields() macro takes the arguments in the other order. > > copy_to/from_user() take "to" as the first argument, so change the order of > arguments in the copy_flock_fields() macro, rather than changing the callers. D'oh... Acked-by: Al Viro <viro@...iv.linux.org.uk>
Powered by blists - more mailing lists