Skip to content

Commit

Permalink
Merge tag 'powerpc-5.6-2' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix an existing bug in our user access handling, exposed by one of
   the bug fixes we merged this cycle.

 - A fix for a boot hang on 32-bit with CONFIG_TRACE_IRQFLAGS and the
   recently added CONFIG_VMAP_STACK.

Thanks to: Christophe Leroy, Guenter Roeck.

* tag 'powerpc-5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc: Fix CONFIG_TRACE_IRQFLAGS with CONFIG_VMAP_STACK
  powerpc/futex: Fix incorrect user access blocking
  • Loading branch information
Linus Torvalds committed Feb 8, 2020
2 parents b0ef7cd + d4bf905 commit d4f309c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions arch/powerpc/include/asm/futex.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
{
int oldval = 0, ret;

allow_write_to_user(uaddr, sizeof(*uaddr));
allow_read_write_user(uaddr, uaddr, sizeof(*uaddr));
pagefault_disable();

switch (op) {
Expand All @@ -62,7 +62,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,

*oval = oldval;

prevent_write_to_user(uaddr, sizeof(*uaddr));
prevent_read_write_user(uaddr, uaddr, sizeof(*uaddr));
return ret;
}

Expand All @@ -76,7 +76,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
if (!access_ok(uaddr, sizeof(u32)))
return -EFAULT;

allow_write_to_user(uaddr, sizeof(*uaddr));
allow_read_write_user(uaddr, uaddr, sizeof(*uaddr));

__asm__ __volatile__ (
PPC_ATOMIC_ENTRY_BARRIER
"1: lwarx %1,0,%3 # futex_atomic_cmpxchg_inatomic\n\
Expand All @@ -97,7 +98,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
: "cc", "memory");

*uval = prev;
prevent_write_to_user(uaddr, sizeof(*uaddr));
prevent_read_write_user(uaddr, uaddr, sizeof(*uaddr));

return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ transfer_to_handler_cont:
* To speed up the syscall path where interrupts stay on, let's check
* first if we are changing the MSR value at all.
*/
tophys(r12, r1)
tophys_novmstack r12, r1
lwz r12,_MSR(r12)
andi. r12,r12,MSR_EE
bne 1f
Expand Down

0 comments on commit d4f309c

Please sign in to comment.