Re: [PATCH bpf-next v3 2/4] libfs: support RENAME_EXCHANGE in simple_rename()

From: Christian Brauner
Date: Tue Nov 02 2021 - 07:36:49 EST


On Tue, Nov 02, 2021 at 11:11:02AM +0100, Daniel Borkmann wrote:
> On 11/2/21 10:25 AM, Miklos Szeredi wrote:
> > On Thu, 28 Oct 2021 at 11:48, Lorenz Bauer <lmb@xxxxxxxxxxxxxx> wrote:
> > >
> > > Allow atomic exchange via RENAME_EXCHANGE when using simple_rename.
> > > This affects binderfs, ramfs, hubetlbfs and bpffs.
> >
> > Ramfs and hugetlbfs are generic enough; those seem safe.
> >
> > Binderfs: I have no idea what this does; binderfs_rename() should

Fwiw, allows dynamic creation and removal of Android binder ipc
devices. Each mount is a separate instance and it's mountable inside
unprivileged containers. Since Android 12 default how binder devices are
managed. Also makes it possibe to run Android in unprivileged
containers.

> > probably error out on RENAME_EXCHANGE for now, or an explicit ack from
> > the maintainers.
>
> Thanks for the review, Miklos! Adding Christian to Cc wrt binderfs ... full context
> for all patches: https://lore.kernel.org/bpf/20211028094724.59043-1-lmb@xxxxxxxxxxxxxx/

Yep, I saw that. Seems good.

> probably error out on RENAME_EXCHANGE for now, or an explicit ack from
> the maintainers.

I don't think there is any issue in allowing binderfs to support this.
Binderfs files are always device nodes. Allowing them to be atomically
renamed shouldn't be a problem. So:

Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>

Christian