landlock: Rename "ptrace" files to "task"

ptrace.[ch] are currently only used for the ptrace LSM hooks but their
scope will expand with IPCs and audit support.  Rename ptrace.[ch] to
task.[ch], which better reflect their content.  Similarly, rename
landlock_add_ptrace_hooks() to landlock_add_task_hooks().  Keep header
files for now.

Cc: Günther Noack <gnoack@google.com>
Cc: Paul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20240307093923.1466071-2-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
This commit is contained in:
Mickaël Salaün 2024-03-07 10:39:23 +01:00
parent 088e2efaf3
commit e3e37fe022
No known key found for this signature in database
GPG Key ID: E5E3D0E88C82F6D2
4 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
obj-$(CONFIG_SECURITY_LANDLOCK) := landlock.o obj-$(CONFIG_SECURITY_LANDLOCK) := landlock.o
landlock-y := setup.o syscalls.o object.o ruleset.o \ landlock-y := setup.o syscalls.o object.o ruleset.o \
cred.o ptrace.o fs.o cred.o task.o fs.o
landlock-$(CONFIG_INET) += net.o landlock-$(CONFIG_INET) += net.o

View File

@ -14,8 +14,8 @@
#include "cred.h" #include "cred.h"
#include "fs.h" #include "fs.h"
#include "net.h" #include "net.h"
#include "ptrace.h"
#include "setup.h" #include "setup.h"
#include "task.h"
bool landlock_initialized __ro_after_init = false; bool landlock_initialized __ro_after_init = false;
@ -34,7 +34,7 @@ const struct lsm_id landlock_lsmid = {
static int __init landlock_init(void) static int __init landlock_init(void)
{ {
landlock_add_cred_hooks(); landlock_add_cred_hooks();
landlock_add_ptrace_hooks(); landlock_add_task_hooks();
landlock_add_fs_hooks(); landlock_add_fs_hooks();
landlock_add_net_hooks(); landlock_add_net_hooks();
landlock_initialized = true; landlock_initialized = true;

View File

@ -16,9 +16,9 @@
#include "common.h" #include "common.h"
#include "cred.h" #include "cred.h"
#include "ptrace.h"
#include "ruleset.h" #include "ruleset.h"
#include "setup.h" #include "setup.h"
#include "task.h"
/** /**
* domain_scope_le - Checks domain ordering for scoped ptrace * domain_scope_le - Checks domain ordering for scoped ptrace
@ -113,7 +113,7 @@ static struct security_hook_list landlock_hooks[] __ro_after_init = {
LSM_HOOK_INIT(ptrace_traceme, hook_ptrace_traceme), LSM_HOOK_INIT(ptrace_traceme, hook_ptrace_traceme),
}; };
__init void landlock_add_ptrace_hooks(void) __init void landlock_add_task_hooks(void)
{ {
security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks), security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks),
&landlock_lsmid); &landlock_lsmid);

View File

@ -6,9 +6,9 @@
* Copyright © 2019 ANSSI * Copyright © 2019 ANSSI
*/ */
#ifndef _SECURITY_LANDLOCK_PTRACE_H #ifndef _SECURITY_LANDLOCK_TASK_H
#define _SECURITY_LANDLOCK_PTRACE_H #define _SECURITY_LANDLOCK_TASK_H
__init void landlock_add_ptrace_hooks(void); __init void landlock_add_task_hooks(void);
#endif /* _SECURITY_LANDLOCK_PTRACE_H */ #endif /* _SECURITY_LANDLOCK_TASK_H */