selinux: cleanup obsolete comments for selinux_hooks[]
PATCH 1/1 selinux: cleanup obsolete comments for selinux_hooks[]
After commit f22f9aaf6c3d ("selinux: remove the runtime disable functionality"), the order in selinux_hooks[] does not affect any selinux function, so remove the comments.
--- security/selinux/hooks.c | 21 --------------------- 1 file changed, 21 deletions(-)
security/selinux/hooks.c +0 -21
@@ -6951,21 +6951,6 @@ static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) }#endif /* CONFIG_IO_URING */ -/* -* IMPORTANT NOTE: When adding new hooks, please be careful to keep this order: -* 1. any hooks that don't belong to (2.) or (3.) below, -* 2. hooks that both access structures allocated by other hooks, and allocate -* structures that can be later accessed by other hooks (mostly "cloning" -* hooks), -* 3. hooks that only allocate structures that can be later accessed by other -* hooks ("allocating" hooks). -* -* Please follow block comment delimiters in the list to keep this order. -* -* This ordering is needed for SELinux runtime disable to work at least somewhat -* safely. Breaking the ordering rules above might lead to NULL pointer derefs -* when disabling SELinux at runtime. -*/ static struct security_hook_list selinux_hooks[]__ro_after_init = {LSM_HOOK_INIT (binder_set_context_mgr, selinux_binder_set_context_mgr),LSM_HOOK_INIT (binder_transaction, selinux_binder_transaction),
@@ -7201,9 +7186,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (uring_cmd, selinux_uring_cmd), #endif -/* -* PUT "CLONING" (ACCESSING + ALLOCATING) HOOKS HERE -*/ LSM_HOOK_INIT (fs_context_dup, selinux_fs_context_dup),LSM_HOOK_INIT (fs_context_parse_param, selinux_fs_context_parse_param), LSM_HOOK_INIT(sb_eat_lsm_opts, selinux_sb_eat_lsm_opts),
@@ -7211,9 +7193,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (xfrm_policy_clone_security, selinux_xfrm_policy_clone), #endif -/* -* PUT "ALLOCATING" HOOKS HERE -*/ LSM_HOOK_INIT (msg_msg_alloc_security, selinux_msg_msg_alloc_security),LSM_HOOK_INIT (msg_queue_alloc_security, selinux_msg_queue_alloc_security),
Signature · 1 line
2.34.1
Paul Moore
maintainerQuoted 23 lines · Xiu Jianfeng
After commit
f22f9aaf6c3d("selinux: remove the runtime disable functionality"), the order in selinux_hooks[] does not affect any selinux function, so remove the comments.Signed-off-by Xiu Jianfeng <[email protected]>--- security/selinux/hooks.c | 21 --------------------- 1 file changed, 21 deletions(-)security/selinux/hooks.c +0
-5@@ -6951,21 +6951,6 @@ static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) }#endif /* CONFIG_IO_URING */ -/* -* IMPORTANT NOTE: When adding new hooks, please be careful to keep this order: -* 1. any hooks that don't belong to (2.) or (3.) below, -* 2. hooks that both access structures allocated by other hooks, and allocate -* structures that can be later accessed by other hooks (mostly "cloning"
security/selinux/hooks.c static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) · line 6968
Quoted 10 lines
security/selinux/hooks.c +0
-10-* hooks), -* 3. hooks that only allocate structures that can be later accessed by other -* hooks ("allocating" hooks). -* -* Please follow block comment delimiters in the list to keep this order. -* -* This ordering is needed for SELinux runtime disable to work at least somewhat -* safely. Breaking the ordering rules above might lead to NULL pointer derefs -* when disabling SELinux at runtime. -*/
I don't mind the hook ordering message, even if it is not strictly necessary anymore, so let's keep it for now. However, if you wanted to remove that last paragraph about it being needed to support the runtime disable functionality that would be okay.
Quoted 25 lines
security/selinux/hooks.c +0
-7static struct security_hook_list selinux_hooks[]__ro_after_init = {LSM_HOOK_INIT (binder_set_context_mgr, selinux_binder_set_context_mgr),LSM_HOOK_INIT (binder_transaction, selinux_binder_transaction),@@ -7201,9 +7186,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (uring_cmd, selinux_uring_cmd), #endif -/* -* PUT "CLONING" (ACCESSING + ALLOCATING) HOOKS HERE -*/ LSM_HOOK_INIT (fs_context_dup, selinux_fs_context_dup),LSM_HOOK_INIT (fs_context_parse_param, selinux_fs_context_parse_param), LSM_HOOK_INIT(sb_eat_lsm_opts, selinux_sb_eat_lsm_opts),@@ -7211,9 +7193,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (xfrm_policy_clone_security, selinux_xfrm_policy_clone), #endif -/* -* PUT "ALLOCATING" HOOKS HERE -*/ LSM_HOOK_INIT (msg_msg_alloc_security, selinux_msg_msg_alloc_security),LSM_HOOK_INIT (msg_queue_alloc_security, selinux_msg_queue_alloc_security), --2.34.1
Signature · 1 line
paul-moore.com
Hi,
Quoted 31 lines · Paul Moore
Quoted 30 lines · Xiu Jianfeng
After commit
f22f9aaf6c3d("selinux: remove the runtime disable functionality"), the order in selinux_hooks[] does not affect any selinux function, so remove the comments.Signed-off-by Xiu Jianfeng <[email protected]>--- security/selinux/hooks.c | 21 --------------------- 1 file changed, 21 deletions(-)security/selinux/hooks.c +0
-12@@ -6951,21 +6951,6 @@ static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) }#endif /* CONFIG_IO_URING */ -/* -* IMPORTANT NOTE: When adding new hooks, please be careful to keep this order: -* 1. any hooks that don't belong to (2.) or (3.) below, -* 2. hooks that both access structures allocated by other hooks, and allocate -* structures that can be later accessed by other hooks (mostly "cloning" -* hooks), -* 3. hooks that only allocate structures that can be later accessed by other -* hooks ("allocating" hooks). -* -* Please follow block comment delimiters in the list to keep this order. -* -* This ordering is needed for SELinux runtime disable to work at least somewhat
Quoted 8 lines
security/selinux/hooks.c static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) · line 6968
Quoted 3 lines
security/selinux/hooks.c +0
-3-* safely. Breaking the ordering rules above might lead to NULL pointer derefs -* when disabling SELinux at runtime. -*/ I don't mind the hook ordering message, even if it is not strictly necessary anymore, so let's keep it for now. However, if you wanted to remove that last paragraph about it being needed to support the runtime disable functionality that would be okay.
Thanks, I will send another one.
Quoted 27 lines
Quoted 26 lines
security/selinux/hooks.c +0
-7static struct security_hook_list selinux_hooks[]__ro_after_init = {LSM_HOOK_INIT (binder_set_context_mgr, selinux_binder_set_context_mgr),LSM_HOOK_INIT (binder_transaction, selinux_binder_transaction),@@ -7201,9 +7186,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (uring_cmd, selinux_uring_cmd), #endif -/* -* PUT "CLONING" (ACCESSING + ALLOCATING) HOOKS HERE -*/ LSM_HOOK_INIT (fs_context_dup, selinux_fs_context_dup),LSM_HOOK_INIT (fs_context_parse_param, selinux_fs_context_parse_param), LSM_HOOK_INIT(sb_eat_lsm_opts, selinux_sb_eat_lsm_opts),@@ -7211,9 +7193,6 @@ static struct security_hook_list selinux_hooks[] __ro_after_init = {LSM_HOOK_INIT (xfrm_policy_clone_security, selinux_xfrm_policy_clone), #endif -/* -* PUT "ALLOCATING" HOOKS HERE -*/ LSM_HOOK_INIT (msg_msg_alloc_security, selinux_msg_msg_alloc_security),LSM_HOOK_INIT (msg_queue_alloc_security, selinux_msg_queue_alloc_security), --2.34.1