]> git.baikalelectronics.ru Git - kernel.git/commit
security: Fix hook iteration for secid_to_secctx
authorKP Singh <kpsingh@google.com>
Wed, 20 May 2020 12:56:16 +0000 (14:56 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 21 May 2020 03:12:07 +0000 (20:12 -0700)
commit1682e290fdadf8f494a8fdbf678c288e44afb577
tree5d01836dd15038bed2fdd235c31d7e528e1fd9b3
parent93c9cd8c1b38b308c03faefbe17920c8e057dc04
security: Fix hook iteration for secid_to_secctx

secid_to_secctx is not stackable, and since the BPF LSM registers this
hook by default, the call_int_hook logic is not suitable which
"bails-on-fail" and casues issues when other LSMs register this hook and
eventually breaks Audit.

In order to fix this, directly iterate over the security hooks instead
of using call_int_hook as suggested in:

https: //lore.kernel.org/bpf/9d0eb6c6-803a-ff3a-5603-9ad6d9edfc00@schaufler-ca.com/#t

Fixes: 2e3eefbf9d4d ("security: Refactor declaration of LSM hooks")
Fixes: bed5c36ee8e5 ("security: Fix the default value of secid_to_secctx hook")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: James Morris <jamorris@linux.microsoft.com>
Link: https://lore.kernel.org/bpf/20200520125616.193765-1-kpsingh@chromium.org
security/security.c