/usr/share/systemtap/runtime/stp_string.h is in systemtap-common 2.9-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | /* -*- linux-c -*-
* Copyright (C) 2005-2012 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
* Public License (GPL); either version 2, or (at your option) any
* later version.
*/
#ifndef _STP_STRING_H_
#define _STP_STRING_H_
#define to_oct_digit(c) ((c) + '0')
static int _stp_text_str(char *out, const char *in, int inlen, int outlen, int quoted, int user);
#if defined(__KERNEL__)
/*
* Powerpc uses a paranoid user address check in __get_user() which
* spews warnings "BUG: Sleeping function...." when DEBUG_SPINLOCK_SLEEP
* is enabled. With 2.6.21 and above, a newer variant __get_user_inatomic
* is provided without the paranoid check. Use it if available, fall back
* to __get_user() if not. Other archs can use __get_user() as is
*/
#if defined(__powerpc__) && defined(__get_user_inatomic)
#define __stp_get_user(x, ptr) __get_user_inatomic (x, ptr)
#else
#define __stp_get_user(x, ptr) __get_user (x, ptr)
#endif
#elif defined(__DYNINST__)
#define __stp_get_user(x, ptr) __get_user(x, ptr)
#endif
/** 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.
*/
/* XXX: duplicates _stp_deref() in loc2c-runtime.h */
/* NB: lookup_bad_addr cannot easily be called from here due to header
* file ordering. */
/* XXX: no error signalling */
#define _stp_read_address(x, ptr, segment) \
({ \
long ret; \
mm_segment_t ofs = get_fs(); \
set_fs(segment); \
pagefault_disable(); \
if (!access_ok(VERIFY_READ, (char __user *)ptr, sizeof(x))) \
ret = -EFAULT; \
else \
ret = __stp_get_user(x, ptr); \
pagefault_enable(); \
set_fs(ofs); \
ret; \
})
#endif /* _STP_STRING_H_ */
|