staticint do_op_one_page(unsignedlong addr, int len, int is_write, int (*op)(unsignedlong addr, int len, void *arg), void *arg)
{ struct page *page;
pte_t *pte; int n;
pte = maybe_map(addr, is_write); if (pte == NULL) return -1;
staticint strnlen_chunk(unsignedlong str, int len, void *arg)
{ int *len_ptr = arg, n;
n = strnlen((void *) str, len);
*len_ptr += n;
if (n < len) return 1; return 0;
}
long strnlen_user(constchar __user *str, long len)
{ int count = 0, n;
if (!access_ok(str, 1)) return -EFAULT;
n = buffer_op((unsignedlong) str, len, 0, strnlen_chunk, &count); if (n == 0) return count + 1; return 0;
}
EXPORT_SYMBOL(strnlen_user);
/** * arch_futex_atomic_op_inuser() - Atomic arithmetic operation with constant * argument and comparison of the previous * futex value with another constant. * * @op: operation to execute * @oparg: argument to operation * @oval: old value at uaddr * @uaddr: pointer to user space address * * Return: * 0 - On success * -EFAULT - User access resulted in a page fault * -EAGAIN - Atomic operation was unable to complete due to contention * -ENOSYS - Operation not supported
*/
int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, u32 __user *uaddr)
{ int oldval, ret; struct page *page; unsignedlong addr = (unsignedlong) uaddr;
pte_t *pte;
ret = -EFAULT; if (!access_ok(uaddr, sizeof(*uaddr))) return -EFAULT;
preempt_disable();
pte = maybe_map(addr, 1); if (pte == NULL) goto out_inuser;
/** * futex_atomic_cmpxchg_inatomic() - Compare and exchange the content of the * uaddr with newval if the current value is * oldval. * @uval: pointer to store content of @uaddr * @uaddr: pointer to user space address * @oldval: old value * @newval: new value to store to @uaddr * * Return: * 0 - On success * -EFAULT - User access resulted in a page fault * -EAGAIN - Atomic operation was unable to complete due to contention
*/
int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
u32 oldval, u32 newval)
{ struct page *page;
pte_t *pte; int ret = -EFAULT;
if (!access_ok(uaddr, sizeof(*uaddr))) return -EFAULT;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.