/usr/share/systemtap/runtime/linux
NameSizeModeActions
uprobes/-0755rm
uprobes2/-0755rm
access_process_vm.h43110644editdlrm
addr-map.c97490644editdlrm
alloc.c159000644editdlrm
arith.c167990644editdlrm
autoconf-514-panic.c680644editdlrm
autoconf-access_ok_2args.c900644editdlrm
autoconf-alloc-percpu-align.c1180644editdlrm
autoconf-asm-syscall.c510644editdlrm
autoconf-atomic_fetch_add_unless.c940644editdlrm
autoconf-bio-bi_opf.c8240644editdlrm
autoconf-blk-types.c3590644editdlrm
autoconf-compat-utimbuf.c530644editdlrm
autoconf-compat_sigaction.c4480644editdlrm
autoconf-constant-tsc.c630644editdlrm
autoconf-cpu-clock.c12770644editdlrm
autoconf-dpath-path.c1210644editdlrm
autoconf-files_lookup_fd_raw.c1360644editdlrm
autoconf-from_kuid_munged.c1910644editdlrm
autoconf-fs_supers-hlist.c3540644editdlrm
autoconf-generated-compile.c560644editdlrm
autoconf-genhd.c2010644editdlrm
autoconf-get-kretprobe.c1070644editdlrm
autoconf-get_user_pages-flags.c15490644editdlrm
autoconf-get_user_pages-notask_struct.c13010644editdlrm
autoconf-get_user_pages_remote-flags.c15500644editdlrm
autoconf-get_user_pages_remote-flags_locked.c13310644editdlrm
autoconf-get_user_pages_remote-notask_struct.c14380644editdlrm
autoconf-grsecurity.c2190644editdlrm
autoconf-hlist-4args.c2960644editdlrm
autoconf-hlist_add_tail_rcu.c1120644editdlrm
autoconf-hrtimer-getset-expires.c1260644editdlrm
autoconf-hrtimer-rel.c870644editdlrm
autoconf-hw_breakpoint_context.c3150644editdlrm
autoconf-inode-private.c1730644editdlrm
autoconf-inode-rwsem.c1720644editdlrm
autoconf-inode-uretprobes.c2640644editdlrm
autoconf-kernel_read-new-args.c10300644editdlrm
autoconf-kprobe-symbol-name.c900644editdlrm
autoconf-ktime-get-real.c980644editdlrm
autoconf-linux-sched_headers.c16780644editdlrm
autoconf-local-clock.c12820644editdlrm
autoconf-lockdown-debugfs.c1020644editdlrm
autoconf-lockdown-kernel.c900644editdlrm
autoconf-mm-context-vdso-base.c1170644editdlrm
autoconf-mm-context-vdso.c1140644editdlrm
autoconf-mm-shmempages.c720644editdlrm
autoconf-mmap_lock.c1750644editdlrm
autoconf-module-sect-attrs.c1580644editdlrm
autoconf-module_layout.c520644editdlrm
autoconf-mod_kallsyms.c510644editdlrm
autoconf-nameidata.c960644editdlrm
autoconf-netfilter-4_1.c7690644editdlrm
autoconf-netfilter-4_4.c14600644editdlrm
autoconf-netfilter-313b.c6020644editdlrm
autoconf-netfilter.c4220644editdlrm
autoconf-old-inode-uprobes.c3570644editdlrm
autoconf-oneachcpu-retry.c9570644editdlrm
autoconf-pagefault_disable.c1370644editdlrm
autoconf-pde_data.c2260644editdlrm
autoconf-perf-structpid.c4440644editdlrm
autoconf-procfs-owner.c1580644editdlrm
autoconf-proc_ops.c5660644editdlrm
autoconf-rcu_is_watching.c3850644editdlrm
autoconf-real-parent.c4270644editdlrm
autoconf-regset.c2390644editdlrm
autoconf-relay-umode_t.c7300644editdlrm
autoconf-relay_buf-per_cpu_ptr.c9200644editdlrm
autoconf-ring_buffer-flags.c1120644editdlrm
autoconf-ring_buffer_lost_events.c2960644editdlrm
autoconf-ring_buffer_read_prepare.c1810644editdlrm
autoconf-save-stack-trace-no-bp.c4980644editdlrm
autoconf-save-stack-trace.c5010644editdlrm
autoconf-set_fs.c2210644editdlrm
autoconf-smpcall-4args.c1660644editdlrm
autoconf-smpcall-5args.c1690644editdlrm
autoconf-stack-trace-save-regs.c1760644editdlrm
autoconf-stacktrace_ops-int-address.c4090644editdlrm
autoconf-stacktrace_ops-warning.c1880644editdlrm
autoconf-syscall_get_args_3args.c2390644editdlrm
autoconf-task-state.c5500644editdlrm
autoconf-task-uid.c1520644editdlrm
autoconf-task_work-struct.c2190644editdlrm
autoconf-time32-old.c520644editdlrm
autoconf-time32.c530644editdlrm
autoconf-timerfd.c2320644editdlrm
autoconf-trace-printk.c1510644editdlrm
autoconf-tracepoint-has-data.c4930644editdlrm
autoconf-tracepoint-strings.c2330644editdlrm
autoconf-uaccess.c280644editdlrm
autoconf-uapi-mount.c520644editdlrm
autoconf-udelay_simple.c900644editdlrm
autoconf-uidgid.c500644editdlrm
autoconf-unwind-stack-trace.c3260644editdlrm
autoconf-uprobe-get-pc.c3740644editdlrm
autoconf-utrace-regset.c2730644editdlrm
autoconf-utrace-via-tracepoints.c17120644editdlrm
autoconf-vm-area-pte.c1410644editdlrm
autoconf-walk-stack.c2170644editdlrm
autoconf-x86-fs.c900644editdlrm
autoconf-x86-gs.c900644editdlrm
autoconf-x86-uniregs.c1400644editdlrm
autoconf-x86-xfs.c910644editdlrm
common_session_state.h32490644editdlrm
compat_net.h8580644editdlrm
compat_structs.h44090644editdlrm
compat_unistd.h683840644editdlrm
copy.c27170644editdlrm
debug.h29780644editdlrm
io.c52910644editdlrm
itrace.c148740644editdlrm
kprobes.c251260644editdlrm
loc2c-runtime.h298740644editdlrm
map_list.h12200644editdlrm
map_runtime.h52660644editdlrm
namespaces.h71280644editdlrm
netfilter.c14100644editdlrm
perf.c75960644editdlrm
perf.h12720644editdlrm
perf_event_counter_context.c3360644editdlrm
perf_probe_handler_nmi.c2780644editdlrm
perf_read.h9590644editdlrm
print.c114020644editdlrm
probe_lock.h18070644editdlrm
regs-ia64.c37410644editdlrm
regs.c134900644editdlrm
runtime.h125910644editdlrm
runtime_context.h60890644editdlrm
runtime_defines.h10410644editdlrm
stap_mmap_lock.h3430644editdlrm
stat_runtime.h17740644editdlrm
stp_tls.h11810644editdlrm
stp_tracepoint.c114810644editdlrm
stp_tracepoint.h22700644editdlrm
syscalls-common.h9760644editdlrm
task_finder.c538600644editdlrm
task_finder2.c576400644editdlrm
task_finder_map.c51940644editdlrm
task_finder_stubs.c24420644editdlrm
task_work_compatibility.h12830644editdlrm
timer.c22000644editdlrm
timer.h13830644editdlrm
timer_compatibility.h23170644editdlrm
uprobes-common.c155730644editdlrm
uprobes-common.h16530644editdlrm
uprobes-inc.h4840644editdlrm
uprobes-inode.c340860644editdlrm
Edit: /usr/share/systemtap/runtime/linux/namespaces.h (7128B)
/* -*- linux-c -*- * Namespace Functions * Copyright (C) 2015 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 _LINUX_NAMESPACES_H_ #define _LINUX_NAMESPACES_H_ #if defined(CONFIG_PID_NS) #include #endif #if defined(CONFIG_USER_NS) #include #endif typedef enum { PID, TID, PGRP, SID } PIDINFOTYPE; typedef enum { UID, EUID, GID, EGID } USERINFOTYPE; // The get_task_from_pid() function assumes the rcu_read_lock is // held. The returned task_struct, if not NULL, has its reference // count increased. Callers must call put_task_struct() when finished // to decrease the reference count. // // Also note that the returned task_struct pointer, if not NULL, // should be a valid task_struct pointer that doesn't need to be // dereferenced before using. static struct task_struct *get_task_from_pid(int target_pid) { struct task_struct *target_ns_task = NULL; #if defined(CONFIG_PID_NS) || defined(CONFIG_USER_NS) struct pid *target_ns_pid; // can't use find_get_pid() since it ends up looking for the // STP_TARGET_NS_PID in the current process' ns, when the PID is // what's seen in the init ns (I think) target_ns_pid = find_pid_ns(target_pid, &init_pid_ns); if (!target_ns_pid) return NULL; // use pid_task instead of since we want to handle our own locking target_ns_task = pid_task(target_ns_pid, PIDTYPE_PID); if (!target_ns_task) return NULL; get_task_struct(target_ns_task); #endif return target_ns_task; } // The get_pid_namespace() function assumes the rcu_read_lock is // held. The returned pid_namespace, if not NULL, has its reference // count increased. Callers must call put_pid_ns() when finished to // decrease the reference count. static struct pid_namespace *get_pid_namespace(int target_ns) { #if defined(CONFIG_PID_NS) struct task_struct *target_ns_task; struct pid_namespace *target_pid_ns; target_ns_task = get_task_from_pid(target_ns); if (!target_ns_task) return NULL; target_pid_ns = task_active_pid_ns(target_ns_task); if (target_pid_ns) get_pid_ns(target_pid_ns); // there is no put_pid_task(), so do the next best thing put_task_struct(target_ns_task); return target_pid_ns; #else return NULL; #endif } // The _stp_task_struct_valid() function ensures that 't' is a valid // task by looking for it on the kernel's task list. Returns 1 if the // task struct pointer was found, 0 if not found. static int _stp_task_struct_valid(struct task_struct *t) { struct task_struct *grp, *tsk; int rc = 0; rcu_read_lock(); do_each_thread(grp, tsk) { if (tsk == t) { rc = 1; goto do_each_thread_out; } } while_each_thread(grp, tsk); do_each_thread_out: rcu_read_unlock(); return rc; } static int from_target_pid_ns(struct task_struct *ts, PIDINFOTYPE type) { #if defined(CONFIG_PID_NS) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) struct pid_namespace *target_pid_ns; int ret = -1; // At this point, the caller above us has determined that the memory // at 'ts' is valid to read. However, we *really* need to know not // only if this memory is valid to read, but is it a real task // struct pointer. Why? For example, the task_tgid_nr_ns() function // calls task_tgid() on 'ts', then passes that result to // pid_nr_ns(). task_tgid() reads // ts->group_leader->pids[N]. pid_nr_ns() reads pid->numbers[N]. // // We could try dereferencing all those items (and hope that the // kernel implementation of those functions doesn't change), but at // this point we're getting bogged down in the internals of // task_tgid(), task_tgid_nr_ns() and pid_nr_ns(). // // So, instead let's try making sure that 'ts' is a valid task by // looking for it on the task list. We assume that if 'ts' is // actually on the task list, we can call task_*_nr_ns() on it // without accessing invalid memory and causing a kernel crash. rcu_read_lock(); if (! _stp_task_struct_valid(ts)) { rcu_read_unlock(); return -1; } target_pid_ns = get_pid_namespace(_stp_namespaces_pid); if (!target_pid_ns) { rcu_read_unlock(); return -1; } switch (type) { case PID: ret = task_tgid_nr_ns(ts, target_pid_ns); break; case TID: ret = task_pid_nr_ns(ts, target_pid_ns); break; case PGRP: ret = task_pgrp_nr_ns(ts, target_pid_ns); break; case SID: ret = task_session_nr_ns(ts, target_pid_ns); break; } // done with the pid namespace and the read lock put_pid_ns(target_pid_ns); rcu_read_unlock(); return ret; #else return -1; #endif } // The get_user_namespace() function assumes the rcu_read_lock is // held. The returned user_namespace, if not NULL, has its reference // count increased by get_user_ns(). Callers must call put_user_ns() // when finished with the returned user_namespace to decrease the // reference count. static struct user_namespace *get_user_namespace(int target_ns) { #if defined(CONFIG_USER_NS) struct task_struct *target_ns_task; struct user_namespace *target_user_ns; target_ns_task = get_task_from_pid(target_ns); if (!target_ns_task) return NULL; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) target_user_ns = target_ns_task->nsproxy->user_ns; #else #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) target_user_ns = (task_cred_xxx(target_ns_task, user))->user_ns; #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) */ target_user_ns = task_cred_xxx(target_ns_task, user_ns); #endif #endif if (target_user_ns) get_user_ns(target_user_ns); put_task_struct(target_ns_task); return target_user_ns; #endif /* defined(CONFIG_USER_NS) */ return NULL; } static int from_target_user_ns(struct task_struct *ts, USERINFOTYPE type) { #if defined(CONFIG_USER_NS) struct user_namespace *target_user_ns; int ret = -1; rcu_read_lock(); target_user_ns = get_user_namespace(_stp_namespaces_pid); if (!target_user_ns) { rcu_read_unlock(); return -1; } switch (type) { case UID: ret = from_kuid_munged(target_user_ns, task_uid(ts)); break; case EUID: ret = from_kuid_munged(target_user_ns, task_euid(ts)); break; case GID: /* If task_gid() isn't defined, make our own. */ #if !defined(task_gid) && defined(task_cred_xxx) #define task_gid(task) (task_cred_xxx((task), gid)) #endif ret = from_kgid_munged(target_user_ns, task_gid(ts)); break; case EGID: /* If task_egid() isn't defined, make our own. */ #if !defined(task_egid) && defined(task_cred_xxx) #define task_egid(task) (task_cred_xxx((task), egid)) #endif ret = from_kgid_munged(target_user_ns, task_egid(ts)); break; } // done with the user namespace and the read lock put_user_ns(target_user_ns); rcu_read_unlock(); return ret; #else return -1; #endif } #endif /* _LINUX_NAMESPACES_H_ */