diff mbox series

[03/10] fs,kernel: Export d_absolute_path()/find_task_by_pid_ns()/find_task_by_vpid()

Message ID 20221102171025.126961-3-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive)
State Rejected
Delegated to: Paul Moore
Headers show
Series [01/10] security: Export security_hook_heads | expand

Commit Message

Tetsuo Handa Nov. 2, 2022, 5:10 p.m. UTC
CaitSith module which can be loaded using /sbin/insmod needs to be able to
access these functions. TOMOYO module will also access these functions when
CONFIG_SECURITY_TOMOYO=m becomes possible.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 fs/d_path.c  | 1 +
 kernel/pid.c | 2 ++
 2 files changed, 3 insertions(+)

Comments

Serge E. Hallyn Nov. 5, 2022, 11:51 p.m. UTC | #1
On Thu, Nov 03, 2022 at 02:10:18AM +0900, Tetsuo Handa wrote:
> CaitSith module which can be loaded using /sbin/insmod needs to be able to
> access these functions. TOMOYO module will also access these functions when
> CONFIG_SECURITY_TOMOYO=m becomes possible.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
>  fs/d_path.c  | 1 +
>  kernel/pid.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/fs/d_path.c b/fs/d_path.c
> index 56a6ee4c6331..417e74414f19 100644
> --- a/fs/d_path.c
> +++ b/fs/d_path.c
> @@ -234,6 +234,7 @@ char *d_absolute_path(const struct path *path,
>  		return ERR_PTR(-EINVAL);
>  	return extract_string(&b);
>  }
> +EXPORT_SYMBOL_GPL(d_absolute_path);
>  
>  static void get_fs_root_rcu(struct fs_struct *fs, struct path *root)
>  {
> diff --git a/kernel/pid.c b/kernel/pid.c
> index 3fbc5e46b721..9e5224d8769c 100644
> --- a/kernel/pid.c
> +++ b/kernel/pid.c
> @@ -416,11 +416,13 @@ struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
>  			 "find_task_by_pid_ns() needs rcu_read_lock() protection");
>  	return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
>  }
> +EXPORT_SYMBOL_GPL(find_task_by_pid_ns);
>  
>  struct task_struct *find_task_by_vpid(pid_t vnr)
>  {
>  	return find_task_by_pid_ns(vnr, task_active_pid_ns(current));
>  }
> +EXPORT_SYMBOL_GPL(find_task_by_vpid);

It would be neat if you could avoid the need for these by instead using
pidfds.

>  struct task_struct *find_get_task_by_vpid(pid_t nr)
>  {
> -- 
> 2.18.4
diff mbox series

Patch

diff --git a/fs/d_path.c b/fs/d_path.c
index 56a6ee4c6331..417e74414f19 100644
--- a/fs/d_path.c
+++ b/fs/d_path.c
@@ -234,6 +234,7 @@  char *d_absolute_path(const struct path *path,
 		return ERR_PTR(-EINVAL);
 	return extract_string(&b);
 }
+EXPORT_SYMBOL_GPL(d_absolute_path);
 
 static void get_fs_root_rcu(struct fs_struct *fs, struct path *root)
 {
diff --git a/kernel/pid.c b/kernel/pid.c
index 3fbc5e46b721..9e5224d8769c 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -416,11 +416,13 @@  struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
 			 "find_task_by_pid_ns() needs rcu_read_lock() protection");
 	return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
 }
+EXPORT_SYMBOL_GPL(find_task_by_pid_ns);
 
 struct task_struct *find_task_by_vpid(pid_t vnr)
 {
 	return find_task_by_pid_ns(vnr, task_active_pid_ns(current));
 }
+EXPORT_SYMBOL_GPL(find_task_by_vpid);
 
 struct task_struct *find_get_task_by_vpid(pid_t nr)
 {