diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2020-06-26 00:48:26 +0300 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2020-07-04 17:35:56 +0300 |
commit | 1c340ead18ee4b4a84357abdef6d4f39ee08328b (patch) | |
tree | 412b58dd03cf04a9fd8cc26caae482628a0fbd71 /include/linux/usermode_driver.h | |
parent | 0fe3c63148ef5df1b3cb067e4b4d45d45d0c0fdc (diff) | |
download | linux-1c340ead18ee4b4a84357abdef6d4f39ee08328b.tar.xz |
umd: Track user space drivers with struct pid
Use struct pid instead of user space pid values that are prone to wrap
araound.
In addition track the entire thread group instead of just the first
thread that is started by exec. There are no multi-threaded user mode
drivers today but there is nothing preclucing user drivers from being
multi-threaded, so it is just a good idea to track the entire process.
Take a reference count on the tgid's in question to make it possible
to remove exit_umh in a future change.
As a struct pid is available directly use kill_pid_info.
The prior process signalling code was iffy in using a userspace pid
known to be in the initial pid namespace and then looking up it's task
in whatever the current pid namespace is. It worked only because
kernel threads always run in the initial pid namespace.
As the tgid is now refcounted verify the tgid is NULL at the start of
fork_usermode_driver to avoid the possibility of silent pid leaks.
v1: https://lkml.kernel.org/r/87mu4qdlv2.fsf_-_@x220.int.ebiederm.org
v2: https://lkml.kernel.org/r/a70l4oy8.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-12-ebiederm@xmission.com
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/usermode_driver.h')
-rw-r--r-- | include/linux/usermode_driver.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/usermode_driver.h b/include/linux/usermode_driver.h index 97c919b7147c..45adbffb31d9 100644 --- a/include/linux/usermode_driver.h +++ b/include/linux/usermode_driver.h @@ -25,7 +25,7 @@ struct umd_info { struct list_head list; void (*cleanup)(struct umd_info *info); struct path wd; - pid_t pid; + struct pid *tgid; }; int umd_load_blob(struct umd_info *info, const void *data, size_t len); int umd_unload_blob(struct umd_info *info); |