Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-17 Thread Alexei Starovoitov
On Sat, Apr 17, 2021 at 04:48:53PM +, Al Viro wrote: > On Sat, Apr 17, 2021 at 07:36:39AM -0700, Alexei Starovoitov wrote: > > > The kernel will perform the same work with FDs. The same locks are held > > and the same execution conditions are in both cases. The LSM hooks, > > fsnotify, etc wil

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-17 Thread Al Viro
On Sat, Apr 17, 2021 at 07:36:39AM -0700, Alexei Starovoitov wrote: > The kernel will perform the same work with FDs. The same locks are held > and the same execution conditions are in both cases. The LSM hooks, > fsnotify, etc will be called the same way. > It's no different if new syscall was in

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-17 Thread Alexei Starovoitov
On Fri, Apr 16, 2021 at 10:01:43PM -0700, Alexei Starovoitov wrote: > On Fri, Apr 16, 2021 at 9:04 PM Al Viro 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 wrote: > > > > > > > > On Fri, Apr 16, 2021 at 08:32:20PM

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-16 Thread Alexei Starovoitov
On Fri, Apr 16, 2021 at 9:04 PM Al Viro 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 wrote: > > > > > > On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > > > > From: Alexei Starovoitov > > > > > > >

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-16 Thread Al Viro
On Fri, Apr 16, 2021 at 08:46:05PM -0700, Alexei Starovoitov wrote: > On Fri, Apr 16, 2021 at 8:42 PM Al Viro wrote: > > > > On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > > > From: Alexei Starovoitov > > > > > > Add bpf_sys_close() helper to be used by the syscall/loader p

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-16 Thread Alexei Starovoitov
On Fri, Apr 16, 2021 at 8:42 PM Al Viro wrote: > > On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > > From: Alexei Starovoitov > > > > Add bpf_sys_close() helper to be used by the syscall/loader program to close > > intermediate FDs and other cleanup. > > Conditional NAK. In

Re: [PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-16 Thread Al Viro
On Fri, Apr 16, 2021 at 08:32:20PM -0700, Alexei Starovoitov wrote: > From: Alexei Starovoitov > > 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 particul

[PATCH bpf-next 11/15] bpf: Add bpf_sys_close() helper.

2021-04-16 Thread Alexei Starovoitov
From: Alexei Starovoitov Add bpf_sys_close() helper to be used by the syscall/loader program to close intermediate FDs and other cleanup. Signed-off-by: Alexei Starovoitov --- include/uapi/linux/bpf.h | 7 +++ kernel/bpf/syscall.c | 14 ++ tools/include/uapi/li