/
usr
/
share
/
systemtap
/
runtime
/
linux
/
/usr/share/systemtap/runtime/linux
mkdir
upload
Name
Size
Mode
Actions
uprobes/
-
0755
rm
uprobes2/
-
0755
rm
access_process_vm.h
4311
0644
edit
dl
rm
addr-map.c
9749
0644
edit
dl
rm
alloc.c
15900
0644
edit
dl
rm
arith.c
16799
0644
edit
dl
rm
autoconf-514-panic.c
68
0644
edit
dl
rm
autoconf-access_ok_2args.c
90
0644
edit
dl
rm
autoconf-alloc-percpu-align.c
118
0644
edit
dl
rm
autoconf-asm-syscall.c
51
0644
edit
dl
rm
autoconf-atomic_fetch_add_unless.c
94
0644
edit
dl
rm
autoconf-bio-bi_opf.c
824
0644
edit
dl
rm
autoconf-blk-types.c
359
0644
edit
dl
rm
autoconf-compat-utimbuf.c
53
0644
edit
dl
rm
autoconf-compat_sigaction.c
448
0644
edit
dl
rm
autoconf-constant-tsc.c
63
0644
edit
dl
rm
autoconf-cpu-clock.c
1277
0644
edit
dl
rm
autoconf-dpath-path.c
121
0644
edit
dl
rm
autoconf-files_lookup_fd_raw.c
136
0644
edit
dl
rm
autoconf-from_kuid_munged.c
191
0644
edit
dl
rm
autoconf-fs_supers-hlist.c
354
0644
edit
dl
rm
autoconf-generated-compile.c
56
0644
edit
dl
rm
autoconf-genhd.c
201
0644
edit
dl
rm
autoconf-get-kretprobe.c
107
0644
edit
dl
rm
autoconf-get_user_pages-flags.c
1549
0644
edit
dl
rm
autoconf-get_user_pages-notask_struct.c
1301
0644
edit
dl
rm
autoconf-get_user_pages_remote-flags.c
1550
0644
edit
dl
rm
autoconf-get_user_pages_remote-flags_locked.c
1331
0644
edit
dl
rm
autoconf-get_user_pages_remote-notask_struct.c
1438
0644
edit
dl
rm
autoconf-grsecurity.c
219
0644
edit
dl
rm
autoconf-hlist-4args.c
296
0644
edit
dl
rm
autoconf-hlist_add_tail_rcu.c
112
0644
edit
dl
rm
autoconf-hrtimer-getset-expires.c
126
0644
edit
dl
rm
autoconf-hrtimer-rel.c
87
0644
edit
dl
rm
autoconf-hw_breakpoint_context.c
315
0644
edit
dl
rm
autoconf-inode-private.c
173
0644
edit
dl
rm
autoconf-inode-rwsem.c
172
0644
edit
dl
rm
autoconf-inode-uretprobes.c
264
0644
edit
dl
rm
autoconf-kernel_read-new-args.c
1030
0644
edit
dl
rm
autoconf-kprobe-symbol-name.c
90
0644
edit
dl
rm
autoconf-ktime-get-real.c
98
0644
edit
dl
rm
autoconf-linux-sched_headers.c
1678
0644
edit
dl
rm
autoconf-local-clock.c
1282
0644
edit
dl
rm
autoconf-lockdown-debugfs.c
102
0644
edit
dl
rm
autoconf-lockdown-kernel.c
90
0644
edit
dl
rm
autoconf-mm-context-vdso-base.c
117
0644
edit
dl
rm
autoconf-mm-context-vdso.c
114
0644
edit
dl
rm
autoconf-mm-shmempages.c
72
0644
edit
dl
rm
autoconf-mmap_lock.c
175
0644
edit
dl
rm
autoconf-module-sect-attrs.c
158
0644
edit
dl
rm
autoconf-module_layout.c
52
0644
edit
dl
rm
autoconf-mod_kallsyms.c
51
0644
edit
dl
rm
autoconf-nameidata.c
96
0644
edit
dl
rm
autoconf-netfilter-4_1.c
769
0644
edit
dl
rm
autoconf-netfilter-4_4.c
1460
0644
edit
dl
rm
autoconf-netfilter-313b.c
602
0644
edit
dl
rm
autoconf-netfilter.c
422
0644
edit
dl
rm
autoconf-old-inode-uprobes.c
357
0644
edit
dl
rm
autoconf-oneachcpu-retry.c
957
0644
edit
dl
rm
autoconf-pagefault_disable.c
137
0644
edit
dl
rm
autoconf-pde_data.c
226
0644
edit
dl
rm
autoconf-perf-structpid.c
444
0644
edit
dl
rm
autoconf-procfs-owner.c
158
0644
edit
dl
rm
autoconf-proc_ops.c
566
0644
edit
dl
rm
autoconf-rcu_is_watching.c
385
0644
edit
dl
rm
autoconf-real-parent.c
427
0644
edit
dl
rm
autoconf-regset.c
239
0644
edit
dl
rm
autoconf-relay-umode_t.c
730
0644
edit
dl
rm
autoconf-relay_buf-per_cpu_ptr.c
920
0644
edit
dl
rm
autoconf-ring_buffer-flags.c
112
0644
edit
dl
rm
autoconf-ring_buffer_lost_events.c
296
0644
edit
dl
rm
autoconf-ring_buffer_read_prepare.c
181
0644
edit
dl
rm
autoconf-save-stack-trace-no-bp.c
498
0644
edit
dl
rm
autoconf-save-stack-trace.c
501
0644
edit
dl
rm
autoconf-set_fs.c
221
0644
edit
dl
rm
autoconf-smpcall-4args.c
166
0644
edit
dl
rm
autoconf-smpcall-5args.c
169
0644
edit
dl
rm
autoconf-stack-trace-save-regs.c
176
0644
edit
dl
rm
autoconf-stacktrace_ops-int-address.c
409
0644
edit
dl
rm
autoconf-stacktrace_ops-warning.c
188
0644
edit
dl
rm
autoconf-syscall_get_args_3args.c
239
0644
edit
dl
rm
autoconf-task-state.c
550
0644
edit
dl
rm
autoconf-task-uid.c
152
0644
edit
dl
rm
autoconf-task_work-struct.c
219
0644
edit
dl
rm
autoconf-time32-old.c
52
0644
edit
dl
rm
autoconf-time32.c
53
0644
edit
dl
rm
autoconf-timerfd.c
232
0644
edit
dl
rm
autoconf-trace-printk.c
151
0644
edit
dl
rm
autoconf-tracepoint-has-data.c
493
0644
edit
dl
rm
autoconf-tracepoint-strings.c
233
0644
edit
dl
rm
autoconf-uaccess.c
28
0644
edit
dl
rm
autoconf-uapi-mount.c
52
0644
edit
dl
rm
autoconf-udelay_simple.c
90
0644
edit
dl
rm
autoconf-uidgid.c
50
0644
edit
dl
rm
autoconf-unwind-stack-trace.c
326
0644
edit
dl
rm
autoconf-uprobe-get-pc.c
374
0644
edit
dl
rm
autoconf-utrace-regset.c
273
0644
edit
dl
rm
autoconf-utrace-via-tracepoints.c
1712
0644
edit
dl
rm
autoconf-vm-area-pte.c
141
0644
edit
dl
rm
autoconf-walk-stack.c
217
0644
edit
dl
rm
autoconf-x86-fs.c
90
0644
edit
dl
rm
autoconf-x86-gs.c
90
0644
edit
dl
rm
autoconf-x86-uniregs.c
140
0644
edit
dl
rm
autoconf-x86-xfs.c
91
0644
edit
dl
rm
common_session_state.h
3249
0644
edit
dl
rm
compat_net.h
858
0644
edit
dl
rm
compat_structs.h
4409
0644
edit
dl
rm
compat_unistd.h
68384
0644
edit
dl
rm
copy.c
2717
0644
edit
dl
rm
debug.h
2978
0644
edit
dl
rm
io.c
5291
0644
edit
dl
rm
itrace.c
14874
0644
edit
dl
rm
kprobes.c
25126
0644
edit
dl
rm
loc2c-runtime.h
29874
0644
edit
dl
rm
map_list.h
1220
0644
edit
dl
rm
map_runtime.h
5266
0644
edit
dl
rm
namespaces.h
7128
0644
edit
dl
rm
netfilter.c
1410
0644
edit
dl
rm
perf.c
7596
0644
edit
dl
rm
perf.h
1272
0644
edit
dl
rm
perf_event_counter_context.c
336
0644
edit
dl
rm
perf_probe_handler_nmi.c
278
0644
edit
dl
rm
perf_read.h
959
0644
edit
dl
rm
print.c
11402
0644
edit
dl
rm
probe_lock.h
1807
0644
edit
dl
rm
regs-ia64.c
3741
0644
edit
dl
rm
regs.c
13490
0644
edit
dl
rm
runtime.h
12591
0644
edit
dl
rm
runtime_context.h
6089
0644
edit
dl
rm
runtime_defines.h
1041
0644
edit
dl
rm
stap_mmap_lock.h
343
0644
edit
dl
rm
stat_runtime.h
1774
0644
edit
dl
rm
stp_tls.h
1181
0644
edit
dl
rm
stp_tracepoint.c
11481
0644
edit
dl
rm
stp_tracepoint.h
2270
0644
edit
dl
rm
syscalls-common.h
976
0644
edit
dl
rm
task_finder.c
53860
0644
edit
dl
rm
task_finder2.c
57640
0644
edit
dl
rm
task_finder_map.c
5194
0644
edit
dl
rm
task_finder_stubs.c
2442
0644
edit
dl
rm
task_work_compatibility.h
1283
0644
edit
dl
rm
timer.c
2200
0644
edit
dl
rm
timer.h
1383
0644
edit
dl
rm
timer_compatibility.h
2317
0644
edit
dl
rm
uprobes-common.c
15573
0644
edit
dl
rm
uprobes-common.h
1653
0644
edit
dl
rm
uprobes-inc.h
484
0644
edit
dl
rm
uprobes-inode.c
34086
0644
edit
dl
rm
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 <linux/pid_namespace.h> #endif #if defined(CONFIG_USER_NS) #include <linux/user_namespace.h> #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_ */
Save
cmd:
run