Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
uaccess_mm.h File Reference
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <asm/segment.h>

Go to the source code of this file.

Data Structures

struct  exception_table_entry
 

Macros

#define VERIFY_READ   0
 
#define VERIFY_WRITE   1
 
#define MOVES   "move"
 
#define __put_user_asm(res, x, ptr, bwl, reg, err)
 
#define __put_user(x, ptr)
 
#define put_user(x, ptr)   __put_user(x, ptr)
 
#define __get_user_asm(res, x, ptr, type, bwl, reg, err)
 
#define __get_user(x, ptr)
 
#define get_user(x, ptr)   __get_user(x, ptr)
 
#define __constant_copy_from_user_asm(res, to, from, tmp, n, s1, s2, s3)
 
#define __constant_copy_to_user_asm(res, to, from, tmp, n, s1, s2, s3)
 
#define __copy_from_user(to, from, n)
 
#define __copy_to_user(to, from, n)
 
#define __copy_to_user_inatomic   __copy_to_user
 
#define __copy_from_user_inatomic   __copy_from_user
 
#define copy_from_user(to, from, n)   __copy_from_user(to, from, n)
 
#define copy_to_user(to, from, n)   __copy_to_user(to, from, n)
 
#define user_addr_max()   (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
 
#define clear_user   __clear_user
 

Functions

int __put_user_bad (void)
 
int __get_user_bad (void)
 
unsigned long __generic_copy_from_user (void *to, const void __user *from, unsigned long n)
 
unsigned long __generic_copy_to_user (void __user *to, const void *from, unsigned long n)
 
long strncpy_from_user (char *dst, const char __user *src, long count)
 
__must_check long strlen_user (const char __user *str)
 
__must_check long strnlen_user (const char __user *str, long n)
 
unsigned long __clear_user (void __user *to, unsigned long n)
 

Macro Definition Documentation

#define __constant_copy_from_user_asm (   res,
  to,
  from,
  tmp,
  n,
  s1,
  s2,
  s3 
)

Definition at line 178 of file uaccess_mm.h.

#define __constant_copy_to_user_asm (   res,
  to,
  from,
  tmp,
  n,
  s1,
  s2,
  s3 
)

Definition at line 258 of file uaccess_mm.h.

#define __copy_from_user (   to,
  from,
  n 
)
Value:
(__builtin_constant_p(n) ? \
__constant_copy_from_user(to, from, n) : \

Definition at line 339 of file uaccess_mm.h.

#define __copy_from_user_inatomic   __copy_from_user

Definition at line 350 of file uaccess_mm.h.

#define __copy_to_user (   to,
  from,
  n 
)
Value:
(__builtin_constant_p(n) ? \
__constant_copy_to_user(to, from, n) : \

Definition at line 344 of file uaccess_mm.h.

#define __copy_to_user_inatomic   __copy_to_user

Definition at line 349 of file uaccess_mm.h.

#define __get_user (   x,
  ptr 
)

Definition at line 152 of file uaccess_mm.h.

#define __get_user_asm (   res,
  x,
  ptr,
  type,
  bwl,
  reg,
  err 
)
Value:
({ \
type __gu_val; \
asm volatile ("\n" \
"1: "MOVES"."#bwl" %2,%1\n" \
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .even\n" \
"10: move.l %3,%0\n" \
" sub.l %1,%1\n" \
" jra 2b\n" \
" .previous\n" \
"\n" \
" .section __ex_table,\"a\"\n" \
" .align 4\n" \
" .long 1b,10b\n" \
" .previous" \
: "+d" (res), "=&" #reg (__gu_val) \
: "m" (*(ptr)), "i" (err)); \
(x) = (typeof(*(ptr)))(unsigned long)__gu_val; \
})

Definition at line 131 of file uaccess_mm.h.

#define __put_user (   x,
  ptr 
)

Definition at line 83 of file uaccess_mm.h.

#define __put_user_asm (   res,
  x,
  ptr,
  bwl,
  reg,
  err 
)
Value:
asm volatile ("\n" \
"1: "MOVES"."#bwl" %2,%1\n" \
"2:\n" \
" .section .fixup,\"ax\"\n" \
" .even\n" \
"10: moveq.l %3,%0\n" \
" jra 2b\n" \
" .previous\n" \
"\n" \
" .section __ex_table,\"a\"\n" \
" .align 4\n" \
" .long 1b,10b\n" \
" .long 2b,10b\n" \
" .previous" \
: "+d" (res), "=m" (*(ptr)) \
: #reg (x), "i" (err))

Definition at line 60 of file uaccess_mm.h.

#define clear_user   __clear_user

Definition at line 364 of file uaccess_mm.h.

#define copy_from_user (   to,
  from,
  n 
)    __copy_from_user(to, from, n)

Definition at line 352 of file uaccess_mm.h.

#define copy_to_user (   to,
  from,
  n 
)    __copy_to_user(to, from, n)

Definition at line 353 of file uaccess_mm.h.

#define get_user (   x,
  ptr 
)    __get_user(x, ptr)

Definition at line 173 of file uaccess_mm.h.

#define MOVES   "move"

Definition at line 36 of file uaccess_mm.h.

#define put_user (   x,
  ptr 
)    __put_user(x, ptr)

Definition at line 128 of file uaccess_mm.h.

#define user_addr_max ( )    (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)

Definition at line 355 of file uaccess_mm.h.

#define VERIFY_READ   0

Definition at line 13 of file uaccess_mm.h.

#define VERIFY_WRITE   1

Definition at line 14 of file uaccess_mm.h.

Function Documentation

unsigned long __clear_user ( void __user addr,
unsigned long  size 
)

__clear_user: - Zero a block of memory in user space, with less checking. : Destination address, in user space.
: Number of bytes to zero.

Zero a block of memory in user space. Caller must check the specified block with access_ok() before calling this function.

Returns number of bytes that could not be cleared. On success, this will be zero.

Definition at line 158 of file uaccess_with_memcpy.c.

unsigned long __generic_copy_from_user ( void to,
const void __user from,
unsigned long  n 
)

Definition at line 24 of file usercopy.c.

unsigned long __generic_copy_to_user ( void __user to,
const void from,
unsigned long  n 
)

Definition at line 15 of file usercopy.c.

int __get_user_bad ( void  )
int __put_user_bad ( void  )
__must_check long strlen_user ( const char __user str)

strlen_user: - Get the size of a user string INCLUDING final NUL. : The string to measure.

Context: User context only. This function may sleep.

Get the size of a NUL-terminated string in user space.

Returns the size of the string INCLUDING the terminating NUL. On exception, returns 0.

If there is a limit on the length of a valid string, you may wish to consider using strnlen_user() instead.

Definition at line 126 of file strnlen_user.c.

long strncpy_from_user ( char dst,
const char __user src,
long  count 
)

strncpy_from_user: - Copy a NUL terminated string from userspace. : Destination address, in kernel space. This buffer must be at least bytes long. : Source address, in user space. : Maximum number of bytes to copy, including the trailing NUL.

Copies a NUL-terminated string from userspace to kernel space.

On success, returns the length of the string (not including the trailing NUL).

If access to userspace fails, returns -EFAULT (some data may have been copied).

If is smaller than the length of the string, copies bytes and returns .

Definition at line 20 of file uaccess.c.

__must_check long strnlen_user ( const char __user str,
long  count 
)

strnlen_user: - Get the size of a user string INCLUDING final NUL. : The string to measure. : Maximum count (including NUL character)

Context: User context only. This function may sleep.

Get the size of a NUL-terminated string in user space.

Returns the size of the string INCLUDING the terminating NUL. If the string is too long, returns 'count+1'. On exception (or invalid count), returns 0.

Definition at line 72 of file uaccess.c.