From: Michael Ellerman <mpe@ellerman.id.au> Date: 2017-07-07 12:46:32
Al Viro [off-list ref] writes:
vfs.git topology is rather convoluted this cycle, so
I'm afraid that it'll take more pull requests than usual ;-/
The first pile is #work.misc-set_fs. Assorted getting rid
of cargo-culted access_ok(), cargo-culted set_fs() and
field-by-field copyouts. The same description applies to
a lot of stuff in other branches - this is just the stuff that
didn't fit into a more specific topical branch.
The following changes since commit c86daad2c25bfd4a33d48b7691afaa96d9c5ab46:
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input (2017-05-26 16:45:13 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc-set_fs
for you to fetch changes up to 8c6657cb50cb037ff58b3f6a547c6569568f3527:
Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400)
This commit seems to have broken networking on a bunch of my PPC
machines (64-bit kernel, 32-bit userspace).
# first bad commit: [8c6657cb50cb037ff58b3f6a547c6569568f3527] Switch flock copyin/copyout primitives to copy_{from,to}_user()
The symptom is eth0 doesn't get address via dhcp.
Reverting it on top of master (9f45efb928) everything works OK again.
Trying to bring networking up manually gives:
# ifup eth0
ifup: failed to lock lockfile /run/network/ifstate.eth0: Invalid argument
strace shows:
5647 fcntl64(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = -1 EINVAL (Invalid argument)
5647 write(2, "ifup: failed to lock lockfile /r"..., 74) = 74
vs the working case:
6005 fcntl64(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
Patch coming.
cheers
On Fri, Jul 7, 2017 at 5:46 AM, Michael Ellerman [off-list ref] wrote:
Al Viro [off-list ref] writes:
quoted
Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400)
This commit seems to have broken networking on a bunch of my PPC
machines (64-bit kernel, 32-bit userspace).
Bah. I think that commit is entirely broken, due to having the
arguments to the "copy_flock_fields()" in the wrong order.
The copy_flock_fields() macro has the arguments in order <from, to>,
but all the users seem to do it the other way around.
I think it would have been more obvious if the put_compat_flock*()
source argument had been "const".
Patch coming.
I'm not seeing a patch, so I did my own. But it's _entirely_ untested.
Does the attached fix things for you?
Linus
On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
[off-list ref] wrote:
quoted
Patch coming.
I'm not seeing a patch, so I did my own. But it's _entirely_ untested.
Does the attached fix things for you?
Oh, I see you sent a patch to the list but didn't cc me like in this thread.
Hmm. Al - I'd like to add the "const" parts at least. How the ordering
gets fixed (I changed it in the users of the macro, Michael changed
the macro itself) I don't much care about.
Can you get me a pull request soon since this presumably also breaks
every other compat case, and it just happened that power was the one
that noticed it first.. Or I can just commit my version, but I guess
Michael's is at least tested..
Linus
On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
[off-list ref] wrote:
The copy_flock_fields() macro has the arguments in order <from, to>,
but all the users seem to do it the other way around.
Looking more at it, I think I'd also like copy_flock_fields() to take
pointer arguments, to match all the code around it (both
copy_to/from_user and the memset calls.
The actual order of arguments I suspect Michael's patch did better -
make the copy_flock_fields() just match the order of memcpy() and
copy_to/from_user(), both of which have <dest,src> order.
So I think my preferred patch would be something like this, even if it
is bigger than either.
Comments? Michael, does this work for your case?
Linus
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2017-07-07 22:50:40
Linus Torvalds [off-list ref] writes:
On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
[off-list ref] wrote:
quoted
The copy_flock_fields() macro has the arguments in order <from, to>,
but all the users seem to do it the other way around.
Looking more at it, I think I'd also like copy_flock_fields() to take
pointer arguments, to match all the code around it (both
copy_to/from_user and the memset calls.
The actual order of arguments I suspect Michael's patch did better -
make the copy_flock_fields() just match the order of memcpy() and
copy_to/from_user(), both of which have <dest,src> order.
So I think my preferred patch would be something like this, even if it
is bigger than either.
Comments? Michael, does this work for your case?
Yeah that works, as committed in your tree. Sorry for the slow reply,
our time zones don't line up all that well :)
cheers