diff options
author | dsmith <dsmith> | 2007-08-14 15:27:58 +0000 |
---|---|---|
committer | dsmith <dsmith> | 2007-08-14 15:27:58 +0000 |
commit | b79aff3684e02d6f83a2fa2a2fcfe53d5c9d6d14 (patch) | |
tree | bb872eed2c44fbca889e0a068ecd964e86938f87 /runtime/transport/utt.c | |
parent | 5eddf13b73a01f3b334e5be80fc3cc1b312d1fea (diff) | |
download | systemtap-steved-b79aff3684e02d6f83a2fa2a2fcfe53d5c9d6d14.tar.gz systemtap-steved-b79aff3684e02d6f83a2fa2a2fcfe53d5c9d6d14.tar.xz systemtap-steved-b79aff3684e02d6f83a2fa2a2fcfe53d5c9d6d14.zip |
2007-08-14 David Smith <dsmith@redhat.com>
Merge from setuid-branch. Changes also by Martin Hunt
<hunt@redhat.com>.
* control.c (_stp_ctl_write): Make sure we don't overflow.
(_stp_ctl_open_cmd): Do not allow multiple opens of the control
file.
(_stp_ctl_write_cmd): Once STP_START is received, ignore
everything except STP_EXIT. Create another state variable
"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
initialized is 0. Also check that current pid is the same as the
pid that did insmod.
(_stp_register_ctl_channel): Bug fix - sets owner/group after
checking for NULL.
* procfs.c (_stp_ctl_write): Make sure we don't overflow.
(_stp_ctl_open_cmd): Do not allow multiple opens of the control
file.
(_stp_ctl_write_cmd): Once STP_START is received, ignore
everything except STP_EXIT. Create another state variable
"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
initialized is 0. Also check that current pid is the same as the
pid that did insmod.
(_stp_register_ctl_channel): Set ownership of cmd file and percpu
files for bulkmode.
* relayfs.c (utt_trace_setup): Set ownership of percpu files.
Improved error handling.
(utt_trace_remove): Improved error checking.
* utt.c (utt_remove_tree): Improved error checking.
(utt_trace_cleanup): Ditto.
(utt_create_buf_file_callback): Set file ownership.
(utt_create_global_buf_file_callback): Set file ownership.
* transport.h: Delcare _stp_uid, _stp_gid, and _stp_init_pid.
* transport.c (_stp_transport_init): Set _stp_uid, _stp_gid, and
_stp_init_pid.
Diffstat (limited to 'runtime/transport/utt.c')
-rw-r--r-- | runtime/transport/utt.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/runtime/transport/utt.c b/runtime/transport/utt.c index 2389ccac..1ca59592 100644 --- a/runtime/transport/utt.c +++ b/runtime/transport/utt.c @@ -45,6 +45,8 @@ static void utt_remove_root(struct utt_trace *utt) static void utt_remove_tree(struct utt_trace *utt) { + if (utt == NULL || utt->dir == NULL) + return; debugfs_remove(utt->dir); utt_remove_root(utt); } @@ -65,7 +67,6 @@ static struct dentry *utt_create_tree(struct utt_trace *utt, const char *root, c dir = debugfs_create_dir(name, utt->utt_tree_root); if (!dir) utt_remove_root(utt); - err: return dir; } @@ -73,8 +74,12 @@ err: void utt_trace_cleanup(struct utt_trace *utt) { - relay_close(utt->rchan); - debugfs_remove(utt->dropped_file); + if (utt == NULL) + return; + if (utt->rchan) + relay_close(utt->rchan); + if (utt->dropped_file) + debugfs_remove(utt->dropped_file); utt_remove_tree(utt); kfree(utt); } @@ -144,8 +149,13 @@ static struct dentry *utt_create_buf_file_callback(const char *filename, struct rchan_buf *buf, int *is_global) { - return debugfs_create_file(filename, mode, parent, buf, + struct dentry *file = debugfs_create_file(filename, mode, parent, buf, &relay_file_operations); + if (file) { + file->d_inode->i_uid = _stp_uid; + file->d_inode->i_gid = _stp_gid; + } + return file; } static struct dentry *utt_create_global_buf_file_callback(const char *filename, @@ -154,9 +164,15 @@ static struct dentry *utt_create_global_buf_file_callback(const char *filename, struct rchan_buf *buf, int *is_global) { + struct dentry *file; *is_global = 1; - return debugfs_create_file(filename, mode, parent, buf, + file = debugfs_create_file(filename, mode, parent, buf, &relay_file_operations); + if (file) { + file->d_inode->i_uid = _stp_uid; + file->d_inode->i_gid = _stp_gid; + } + return file; } static struct rchan_callbacks utt_relay_callbacks = { |