The bprm_revalidate_files hook is called from begin_new_exec() right
after the close-on-exec files have been closed. It only exists so that
an LSM can revoke inherited files before exec_update_lock is taken as
that may block on the filesystem. So it's always called from sleepable
context.

Add it to sleepable_lsm_hooks so that sleepable bpf lsm programs can
attach to it. All the other bprm hooks are sleepable already.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 kernel/bpf/bpf_lsm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
index 468e63dbd922d..df6ee6e3674dd 100644
--- a/kernel/bpf/bpf_lsm.c
+++ b/kernel/bpf/bpf_lsm.c
@@ -324,6 +324,7 @@ BTF_ID(func, bpf_lsm_bprm_committed_creds)
 BTF_ID(func, bpf_lsm_bprm_committing_creds)
 BTF_ID(func, bpf_lsm_bprm_creds_for_exec)
 BTF_ID(func, bpf_lsm_bprm_creds_from_file)
+BTF_ID(func, bpf_lsm_bprm_revalidate_files)
 BTF_ID(func, bpf_lsm_capget)
 BTF_ID(func, bpf_lsm_capset)
 BTF_ID(func, bpf_lsm_cred_prepare)

-- 
2.53.0


Reply via email to