Linux Kernel
3.7.1
|
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm-generic/uaccess-unaligned.h>
#include <asm/processor.h>
#include <asm/page.h>
Go to the source code of this file.
Data Structures | |
struct | exception_table_entry |
Functions | |
int | __range_ok (unsigned long addr, unsigned long size) |
int | fixup_exception (struct pt_regs *regs) |
int | __get_user_bad (void) __attribute__((warning("sizeof __get_user argument not 1 |
int | __put_user_bad (void) __attribute__((warning("sizeof __put_user argument not 1 |
unsigned long __must_check | __copy_to_user_inatomic (void __user *to, const void *from, unsigned long n) |
unsigned long __must_check | __copy_from_user_inatomic (void *to, const void __user *from, unsigned long n) |
unsigned long __must_check | __copy_from_user_zeroing (void *to, const void __user *from, unsigned long n) |
long | strnlen_user_asm (const char __user *str, long n) |
long | strncpy_from_user_asm (char *dst, const char __user *src, long) |
unsigned long | clear_user_asm (void __user *mem, unsigned long len) |
unsigned long | flush_user_asm (void __user *mem, unsigned long len) |
unsigned long | inv_user_asm (void __user *mem, unsigned long len) |
unsigned long | finv_user_asm (void __user *mem, unsigned long len) |
Variables | |
int | or |
#define __get_user | ( | x, | |
ptr | |||
) |
__get_user: - Get a simple variable from user space, with less checking. : Variable to store result. : Source address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple variable from user space to kernel space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and the result of dereferencing must be assignable to without a cast.
Returns zero on success, or -EFAULT on error. On error, the variable is set to zero.
Caller must check the pointer with access_ok() before calling this function.
__put_user: - Write a simple value into user space, with less checking. : Value to copy to user space. : Destination address, in user space.
Context: User context only. This function may sleep.
This macro copies a single simple value from kernel space to user space. It supports simple types like char and int, but not larger data types like structures or arrays.
must have pointer-to-simple-variable type, and must be assignable to the result of dereferencing .
Caller must check the pointer with access_ok() before calling this function.
Returns zero on success, or -EFAULT on error.
access_ok: - Checks if a user space pointer is valid : Type of access: VERIFY_READ or VERIFY_WRITE. Note that VERIFY_WRITE is a superset of VERIFY_READ - if it is safe to write to a block, it is always safe to read from it. : User space pointer to start of block to check : Size of block to check
Context: User context only. This function may sleep.
Checks if a pointer to a block of memory in user space is valid.
Returns true (nonzero) if the memory block may be valid, false (zero) if it is definitely invalid.
Note that, depending on architecture, this function probably just checks that the pointer is in the user space range - after calling this function, memory access functions may still return -EFAULT.
#define copy_from_user _copy_from_user |
#define get_fs | ( | void | ) | (current_thread_info()->addr_limit) |
#define KERNEL_DS MAKE_MM_SEG(-1UL) |
#define MAKE_MM_SEG | ( | a | ) | ((mm_segment_t) { (a) }) |
#define set_fs | ( | x | ) | (current_thread_info()->addr_limit = (x)) |
#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) |
unsigned long __must_check __copy_from_user_inatomic | ( | void * | to, |
const void __user * | from, | ||
unsigned long | n | ||
) |
__copy_from_user() - copy data from user space, with less checking. : Destination address, in kernel space. : Source address, in user space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from user space to kernel space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be copied. On success, this will be zero.
If some data could not be copied, this function will pad the copied data to the requested size using zero bytes.
An alternate version - __copy_from_user_inatomic() - is designed to be called from atomic context, typically bracketed by calls to pagefault_disable() and pagefault_enable(). This version does NOT pad with zeros.
Definition at line 258 of file memcpy_tile64.c.
unsigned long __must_check __copy_from_user_zeroing | ( | void * | to, |
const void __user * | from, | ||
unsigned long | n | ||
) |
Definition at line 267 of file memcpy_tile64.c.
unsigned long __must_check __copy_to_user_inatomic | ( | void __user * | to, |
const void * | from, | ||
unsigned long | n | ||
) |
__copy_to_user() - copy data into user space, with less checking. : Destination address, in user space. : Source address, in kernel space.
: Number of bytes to copy.
Context: User context only. This function may sleep.
Copy data from kernel space to user space. Caller must check the specified block with access_ok() before calling this function.
Returns number of bytes that could not be copied. On success, this will be zero.
An alternate version - __copy_to_user_inatomic() - is designed to be called from atomic context, typically bracketed by calls to pagefault_disable() and pagefault_enable().
Definition at line 249 of file memcpy_tile64.c.
clear_user: - Zero a block of memory in user space. : Destination address, in user space. : Number of bytes to zero.
Zero a block of memory in user space.
Returns number of bytes that could not be cleared. On success, this will be zero.
finv_user: - Flush-inval a block of memory in user space from cache. : Destination address, in user space. : Number of bytes to invalidate.
Returns number of bytes that could not be flush-invalidated. On success, this will be zero.
flush_user: - Flush a block of memory in user space from cache. : Destination address, in user space. : Number of bytes to flush.
Returns number of bytes that could not be flushed. On success, this will be zero.
inv_user: - Invalidate a block of memory in user space from cache. : Destination address, in user space. : Number of bytes to invalidate.
Returns number of bytes that could not be invalidated. On success, this will be zero.
Note that on Tile64, the "inv" operation is in fact a "flush and invalidate", so cache write-backs will occur prior to the cache being marked invalid.
strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking. : 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. Caller must check the specified block with access_ok() before calling this function.
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 .
strlen_user: - Get the size of a string in user space. : 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.