We were using get_user(), but that doesn't reliably work on all
platforms (such as SPARC64) and cannot trap faults, which meant we were
jumping through extra hoops to trap faults when copy_from_user() does
that anyway.
The extra copy is notably less efficient (since we end up looping over,
and copying, essentially the entire user stack in one-word increments),
but has the advantage of actually working.
Orabug:
22629102
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
sp++) {
struct vm_area_struct *code_vma;
unsigned long addr;
+ int copyret;
/*
* Recheck for faultedness and pin at page boundaries.
break;
}
- DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
- get_user(addr, sp);
- DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
-
- if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT)) {
- DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_BADADDR);
+ pagefault_disable();
+ copyret = copy_from_user(&addr, sp, sizeof(addr));
+ pagefault_enable();
+ if (copyret)
break;
- }
if (addr == fpc)
continue;