On Fri, May 29, 2020 at 12:12:27AM +0200, KP Singh wrote:
quoted
+ if (ret)
+ verbose(env, "%s() is not modifiable\n",
+ prog->aux->attach_func_name);
+ } else if (prog->aux->sleepable && prog->type == BPF_PROG_TYPE_TRACING) {
+ /* fentry/fexit progs can be sleepable only if they are
+ * attached to ALLOW_ERROR_INJECTION or security_*() funcs.
+ * LSM progs check that they are attached to bpf_lsm_*() funcs
+ * which are sleepable too.
I know of one LSM hook which is not sleepable and is executed in an
RCU callback i.e. task_free. I don't think t's a problem to run under
SRCU for that (I tried it and it does not cause any issues).
We can add a blacklisting mechanism later for the sleepable flags or
just the sleeping helpers (based on some of the work going on to
whitelist functions for helper usage).
Good catch. *_task_free() are not sleepable. I'll introduce a simple
blacklist for now. Since I'm not adding actual sleeping helpers in this
patch set nothing is broken, but it will give us the base to build stuff on top.