Re: [PATCH] fs: split receive_fd_replace from __receive_fd

From: Kees Cook
Date: Fri Apr 02 2021 - 15:01:22 EST


On Thu, Mar 25, 2021 at 09:22:09AM +0100, Christoph Hellwig wrote:
> receive_fd_replace shares almost no code with the general case, so split
> it out. Also remove the "Bump the sock usage counts" comment from
> both copies, as that is now what __receive_sock actually does.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>

I'm okay with repeating code in fs/file.c. What I wanted to avoid was
open coded combinations in various callers.

So, sure, this can be split, but as-is the patch breaks SECCOMP_IOCTL_NOTIF_ADDFD:
https://lore.kernel.org/linux-fsdevel/20210329071939.GC3633@xsang-OptiPlex-9020/

-Kees

--
Kees Cook