[PATCH bpf-next] bpf: lsm: Remove hook to bpf_task_storage_free

Song Liu posted 1 patch 1 year ago
security/bpf/hooks.c | 1 -
1 file changed, 1 deletion(-)
[PATCH bpf-next] bpf: lsm: Remove hook to bpf_task_storage_free
Posted by Song Liu 1 year ago
free_task() already calls bpf_task_storage_free(). It is not necessary
to call it again on security_task_free(). Remove the hook.

Signed-off-by: Song Liu <song@kernel.org>

---

This was initially sent in a patchset [1]. However, this patch is not
closely related to other patches in the set, so sending it alone.

[1] https://lore.kernel.org/bpf/20241112083700.356299-1-song@kernel.org/
---
 security/bpf/hooks.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/security/bpf/hooks.c b/security/bpf/hooks.c
index 3663aec7bcbd..db759025abe1 100644
--- a/security/bpf/hooks.c
+++ b/security/bpf/hooks.c
@@ -13,7 +13,6 @@ static struct security_hook_list bpf_lsm_hooks[] __ro_after_init = {
 	#include <linux/lsm_hook_defs.h>
 	#undef LSM_HOOK
 	LSM_HOOK_INIT(inode_free_security, bpf_inode_storage_free),
-	LSM_HOOK_INIT(task_free, bpf_task_storage_free),
 };
 
 static const struct lsm_id bpf_lsmid = {
-- 
2.43.5
Re: [PATCH bpf-next] bpf: lsm: Remove hook to bpf_task_storage_free
Posted by Matt Bobrowski 1 year ago
On Wed, Dec 11, 2024 at 11:59:56PM -0800, Song Liu wrote:
> free_task() already calls bpf_task_storage_free(). It is not necessary
> to call it again on security_task_free(). Remove the hook.

Acked-by: Matt Bobrowski <mattbobrowski@google.com>

> Signed-off-by: Song Liu <song@kernel.org>
> 
> ---
> 
> This was initially sent in a patchset [1]. However, this patch is not
> closely related to other patches in the set, so sending it alone.
> 
> [1] https://lore.kernel.org/bpf/20241112083700.356299-1-song@kernel.org/
> ---
>  security/bpf/hooks.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/security/bpf/hooks.c b/security/bpf/hooks.c
> index 3663aec7bcbd..db759025abe1 100644
> --- a/security/bpf/hooks.c
> +++ b/security/bpf/hooks.c
> @@ -13,7 +13,6 @@ static struct security_hook_list bpf_lsm_hooks[] __ro_after_init = {
>  	#include <linux/lsm_hook_defs.h>
>  	#undef LSM_HOOK
>  	LSM_HOOK_INIT(inode_free_security, bpf_inode_storage_free),
> -	LSM_HOOK_INIT(task_free, bpf_task_storage_free),
>  };
>  
>  static const struct lsm_id bpf_lsmid = {
> -- 
> 2.43.5
>