Commit 74be2d3b authored by Eric W. Biederman's avatar Eric W. Biederman
parent 884c5e68
...@@ -11,7 +11,7 @@ int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char __user *optval, ...@@ -11,7 +11,7 @@ int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char __user *optval,
int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval, int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,
int __user *optlen); int __user *optlen);
struct bpfilter_umh_ops { struct bpfilter_umh_ops {
struct umh_info info; struct umd_info info;
/* since ip_getsockopt() can run in parallel, serialize access to umh */ /* since ip_getsockopt() can run in parallel, serialize access to umh */
struct mutex lock; struct mutex lock;
int (*sockopt)(struct sock *sk, int optname, int (*sockopt)(struct sock *sk, int optname,
......
...@@ -17,14 +17,14 @@ static inline void exit_umh(struct task_struct *tsk) ...@@ -17,14 +17,14 @@ static inline void exit_umh(struct task_struct *tsk)
} }
#endif #endif
struct umh_info { struct umd_info {
const char *cmdline; const char *cmdline;
struct file *pipe_to_umh; struct file *pipe_to_umh;
struct file *pipe_from_umh; struct file *pipe_from_umh;
struct list_head list; struct list_head list;
void (*cleanup)(struct umh_info *info); void (*cleanup)(struct umd_info *info);
pid_t pid; pid_t pid;
}; };
int fork_usermode_blob(void *data, size_t len, struct umh_info *info); int fork_usermode_blob(void *data, size_t len, struct umd_info *info);
#endif /* __LINUX_USERMODE_DRIVER_H__ */ #endif /* __LINUX_USERMODE_DRIVER_H__ */
...@@ -11,7 +11,7 @@ static DEFINE_MUTEX(umh_list_lock); ...@@ -11,7 +11,7 @@ static DEFINE_MUTEX(umh_list_lock);
static int umd_setup(struct subprocess_info *info, struct cred *new) static int umd_setup(struct subprocess_info *info, struct cred *new)
{ {
struct umh_info *umh_info = info->data; struct umd_info *umd_info = info->data;
struct file *from_umh[2]; struct file *from_umh[2];
struct file *to_umh[2]; struct file *to_umh[2];
int err; int err;
...@@ -43,21 +43,21 @@ static int umd_setup(struct subprocess_info *info, struct cred *new) ...@@ -43,21 +43,21 @@ static int umd_setup(struct subprocess_info *info, struct cred *new)
return err; return err;
} }
umh_info->pipe_to_umh = to_umh[1]; umd_info->pipe_to_umh = to_umh[1];
umh_info->pipe_from_umh = from_umh[0]; umd_info->pipe_from_umh = from_umh[0];
umh_info->pid = task_pid_nr(current); umd_info->pid = task_pid_nr(current);
current->flags |= PF_UMH; current->flags |= PF_UMH;
return 0; return 0;
} }
static void umd_cleanup(struct subprocess_info *info) static void umd_cleanup(struct subprocess_info *info)
{ {
struct umh_info *umh_info = info->data; struct umd_info *umd_info = info->data;
/* cleanup if umh_setup() was successful but exec failed */ /* cleanup if umh_setup() was successful but exec failed */
if (info->retval) { if (info->retval) {
fput(umh_info->pipe_to_umh); fput(umd_info->pipe_to_umh);
fput(umh_info->pipe_from_umh); fput(umd_info->pipe_from_umh);
} }
} }
...@@ -72,12 +72,12 @@ static void umd_cleanup(struct subprocess_info *info) ...@@ -72,12 +72,12 @@ static void umd_cleanup(struct subprocess_info *info)
* *
* Returns either negative error or zero which indicates success * Returns either negative error or zero which indicates success
* in executing a blob of bytes as a usermode process. In such * in executing a blob of bytes as a usermode process. In such
* case 'struct umh_info *info' is populated with two pipes * case 'struct umd_info *info' is populated with two pipes
* and a pid of the process. The caller is responsible for health * and a pid of the process. The caller is responsible for health
* check of the user process, killing it via pid, and closing the * check of the user process, killing it via pid, and closing the
* pipes when user process is no longer needed. * pipes when user process is no longer needed.
*/ */
int fork_usermode_blob(void *data, size_t len, struct umh_info *info) int fork_usermode_blob(void *data, size_t len, struct umd_info *info)
{ {
const char *cmdline = (info->cmdline) ? info->cmdline : "usermodehelper"; const char *cmdline = (info->cmdline) ? info->cmdline : "usermodehelper";
struct subprocess_info *sub_info; struct subprocess_info *sub_info;
...@@ -126,7 +126,7 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob); ...@@ -126,7 +126,7 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob);
void __exit_umh(struct task_struct *tsk) void __exit_umh(struct task_struct *tsk)
{ {
struct umh_info *info; struct umd_info *info;
pid_t pid = tsk->pid; pid_t pid = tsk->pid;
mutex_lock(&umh_list_lock); mutex_lock(&umh_list_lock);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
struct bpfilter_umh_ops bpfilter_ops; struct bpfilter_umh_ops bpfilter_ops;
EXPORT_SYMBOL_GPL(bpfilter_ops); EXPORT_SYMBOL_GPL(bpfilter_ops);
static void bpfilter_umh_cleanup(struct umh_info *info) static void bpfilter_umh_cleanup(struct umd_info *info)
{ {
mutex_lock(&bpfilter_ops.lock); mutex_lock(&bpfilter_ops.lock);
bpfilter_ops.stop = true; bpfilter_ops.stop = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment