Re: [PATCH 1/5] fs: Do not allow get_file() to resurrect 0 f_count

2024-05-03 Thread Christian Brauner
On Thu, May 02, 2024 at 04:03:24PM -0700, Kees Cook wrote: > On Fri, May 03, 2024 at 12:53:56AM +0200, Jann Horn wrote: > > On Fri, May 3, 2024 at 12:34 AM Kees Cook wrote: > > > If f_count reaches 0, calling get_file() should be a failure. Adjust to > > > use atomic_long_inc_not_zero() and

Re: [PATCH 1/5] fs: Do not allow get_file() to resurrect 0 f_count

2024-05-02 Thread Kees Cook
On Fri, May 03, 2024 at 12:53:56AM +0200, Jann Horn wrote: > On Fri, May 3, 2024 at 12:34 AM Kees Cook wrote: > > If f_count reaches 0, calling get_file() should be a failure. Adjust to > > use atomic_long_inc_not_zero() and return NULL on failure. In the future > > get_file() can be annotated

Re: [PATCH 1/5] fs: Do not allow get_file() to resurrect 0 f_count

2024-05-02 Thread Jann Horn
On Fri, May 3, 2024 at 12:34 AM Kees Cook wrote: > If f_count reaches 0, calling get_file() should be a failure. Adjust to > use atomic_long_inc_not_zero() and return NULL on failure. In the future > get_file() can be annotated with __must_check, though that is not > currently possible. [...] >

[PATCH 1/5] fs: Do not allow get_file() to resurrect 0 f_count

2024-05-02 Thread Kees Cook
If f_count reaches 0, calling get_file() should be a failure. Adjust to use atomic_long_inc_not_zero() and return NULL on failure. In the future get_file() can be annotated with __must_check, though that is not currently possible. Signed-off-by: Kees Cook --- Cc: Christian Brauner Cc: Alexander