#ifdef CONFIG_PPC_MM_SLICES
        u64 mm_ctx_low_slices_psize;
        unsigned char mm_ctx_high_slices_psize[SLICE_ARRAY_SIZE];
+       unsigned long addr_limit;
 #else
        u16 mm_ctx_user_psize;
        u16 mm_ctx_sllp;
 
 #ifdef CONFIG_PPC_MM_SLICES
        OFFSET(PACALOWSLICESPSIZE, paca_struct, mm_ctx_low_slices_psize);
        OFFSET(PACAHIGHSLICEPSIZE, paca_struct, mm_ctx_high_slices_psize);
+       DEFINE(PACA_ADDR_LIMIT, offsetof(struct paca_struct, addr_limit));
        DEFINE(MMUPSIZEDEFSIZE, sizeof(struct mmu_psize_def));
 #endif /* CONFIG_PPC_MM_SLICES */
 #endif
 
        get_paca()->mm_ctx_id = context->id;
 #ifdef CONFIG_PPC_MM_SLICES
        VM_BUG_ON(!mm->context.addr_limit);
+       get_paca()->addr_limit = mm->context.addr_limit;
        get_paca()->mm_ctx_low_slices_psize = context->low_slices_psize;
        memcpy(&get_paca()->mm_ctx_high_slices_psize,
               &context->high_slices_psize, TASK_SLICE_ARRAY_SZ(mm));
 
         * For userspace addresses, make sure this is region 0.
         */
        cmpdi   r9, 0
-       bne     8f
+       bne-    8f
+        /*
+         * user space make sure we are within the allowed limit
+        */
+       ld      r11,PACA_ADDR_LIMIT(r13)
+       cmpld   r3,r11
+       bge-    8f
 
        /* when using slices, we extract the psize off the slice bitmaps
         * and then we need to get the sllp encoding off the mmu_psize_defs