diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-04-13 14:59:36 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-04-13 14:59:36 -0400 |
commit | 1ec6761a6b893c2c755753617bebac79b3040fca (patch) | |
tree | bd252bb1d5253e1a10ff24b1790e6e0e1b7cec02 /runtime/copy.c | |
parent | bf50bb491c5bfcf3035de45ac58acf11ed02af06 (diff) | |
parent | 1c86aa2adc1165906057cdde4cc7484468726fc4 (diff) | |
download | systemtap-steved-1ec6761a6b893c2c755753617bebac79b3040fca.tar.gz systemtap-steved-1ec6761a6b893c2c755753617bebac79b3040fca.tar.xz systemtap-steved-1ec6761a6b893c2c755753617bebac79b3040fca.zip |
Merge commit 'origin/unwind'
* commit 'origin/unwind':
Fixes for 2.6.25 pt_regs changes.
Include string.h
Change stap to get kernel symbols from debuginfo and
reincarnate vim/ directory in this branch to match master
Add new define STP_USE_DWARF_UNWINDER which is set based on which archs
Remove misleading error message.
Support for kernels built with CONFIG_FRAME_POINTER
Fix regression.
dded _stp_read_address() and changed code to use it.
kretprobe trampoline fixes
i386 fixes.
control.c (_stp_ctl_write_dbug): Insert missing break.
32-bit fixes
Cleanup.
2008-03-23 Frank Ch. Eigler <fche@elastic.org>
2008-03-23 Frank Ch. Eigler <fche@elastic.org>
2008-03-21 Eugene Teo <eugeneteo@kernel.sg>
add (back) runtime/unwind files
* clarify utility of epilogue-type probe aliases in documentation
rebased unwind_branch on top of current master
Diffstat (limited to 'runtime/copy.c')
-rw-r--r-- | runtime/copy.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/runtime/copy.c b/runtime/copy.c index ef3fd223..6bb22762 100644 --- a/runtime/copy.c +++ b/runtime/copy.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Copy from user space functions - * Copyright (C) 2005, 2006, 2007 Red Hat Inc. + * Copyright (C) 2005-2008 Red Hat Inc. * Copyright (C) 2005 Intel Corporation. * * This file is part of systemtap, and is free software. You can @@ -9,11 +9,10 @@ * later version. */ -#ifndef _COPY_C_ /* -*- linux-c -*- */ +#ifndef _COPY_C_ /* -*- linux-c -*- */ #define _COPY_C_ #include "string.c" - /** @file copy.c * @brief Functions to copy from user space. */ @@ -26,6 +25,28 @@ * @{ */ +/** Safely read from userspace or kernelspace. + * On success, returns 0. Returns -EFAULT on error. + * + * This uses __get_user() to read from userspace or + * kernelspace. Will not sleep or cause pagefaults when + * called from within a kprobe context. + * + * @param segment . KERNEL_DS for kernel access + * USER_DS for userspace. + */ + +#define _stp_read_address(x, ptr, segment) \ + ({ \ + long ret; \ + mm_segment_t ofs = get_fs(); \ + set_fs(segment); \ + ret = __stp_get_user(x, ptr); \ + set_fs(ofs); \ + ret; \ + }) + + long _stp_strncpy_from_user(char *dst, const char __user *src, long count); //static long __stp_strncpy_from_user(char *dst, const char __user *src, long count); @@ -110,8 +131,7 @@ do { \ * <i>count</i> bytes and returns <i>count</i>. */ -long -_stp_strncpy_from_user(char *dst, const char __user *src, long count) +long _stp_strncpy_from_user(char *dst, const char __user *src, long count) { long res = -EFAULT; if (access_ok(VERIFY_READ, src, count)) @@ -119,7 +139,6 @@ _stp_strncpy_from_user(char *dst, const char __user *src, long count) return res; } - /** Copy a block of data from user space. * * If some data could not be copied, this function will pad the copied @@ -133,8 +152,7 @@ _stp_strncpy_from_user(char *dst, const char __user *src, long count) * */ -unsigned long -_stp_copy_from_user (char *dst, const char __user *src, unsigned long count) +unsigned long _stp_copy_from_user(char *dst, const char __user *src, unsigned long count) { if (count) { if (access_ok(VERIFY_READ, src, count)) |