Commit d4f309ca authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents b0ef7cda d4bf9053
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
{
{
	int oldval = 0, ret;
	int oldval = 0, ret;


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


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


	*oval = oldval;
	*oval = oldval;


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


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


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

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


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

        return ret;
        return ret;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -214,7 +214,7 @@ transfer_to_handler_cont:
	 * To speed up the syscall path where interrupts stay on, let's check
	 * To speed up the syscall path where interrupts stay on, let's check
	 * first if we are changing the MSR value at all.
	 * first if we are changing the MSR value at all.
	 */
	 */
	tophys(r12, r1)
	tophys_novmstack r12, r1
	lwz	r12,_MSR(r12)
	lwz	r12,_MSR(r12)
	andi.	r12,r12,MSR_EE
	andi.	r12,r12,MSR_EE
	bne	1f
	bne	1f