lkml.org 
[lkml]   [2018]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH bpf-next 2/6] fs: wire in BPF_CGROUP_FILE_OPEN hook
Date
enable cgroup-bpf BPF_CGROUP_FILE_OPEN hook after security_file_open() LSM hook.
Similarly to other cgroup-bpf hooks it's gated by static key 'cgroup_bpf_enabled'
and has zero overhead until bpf prog is attached to that hook.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
fs/open.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/fs/open.c b/fs/open.c
index 0285ce7dbd51..7e1170863f40 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -759,6 +759,10 @@ static int do_dentry_open(struct file *f,
if (error)
goto cleanup_all;

+ error = BPF_CGROUP_RUN_PROG_FILE_FILTER(f);
+ if (error)
+ goto cleanup_all;
+
error = break_lease(locks_inode(f), f->f_flags);
if (error)
goto cleanup_all;
--
2.17.1
\
 
 \ /
  Last update: 2018-10-04 04:58    [W:0.129 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site