On Fri, Apr 16, 2021 at 9:04 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > On Fri, Apr 16, 2021 at 08:46:05PM -0700, Alexei Starovoitov wrote: > > On Fri, Apr 16, 2021 at 8:42 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > > > > > On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > > > > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > > > > > > > Add bpf_sys_close() helper to be used by the syscall/loader program to close > > > > intermediate FDs and other cleanup. > > > > > > Conditional NAK. In a lot of contexts close_fd() is very much unsafe. > > > In particular, anything that might call it between fdget() and fdput() > > > is Right Fucking Out(tm). > > > In which contexts can that thing be executed? > > > > user context only. > > It's not for all of bpf _obviously_. > > Let me restate the question: what call chains could lead to bpf_sys_close()? Already answered. User context only. It's all safe.