Re: [PATCH v2 0/2] mm/memfd: add ioctl(MEMFD_CHECK_IF_ORIGINAL)

From: Jonathan Corbet
Date: Fri Sep 08 2023 - 18:07:05 EST


Michał Cłapiński <mclapinski@xxxxxxxxxx> writes:

> On Fri, Sep 8, 2023 at 10:34 PM Jonathan Corbet <corbet@xxxxxxx> wrote:
>> Given that the two file descriptors are otherwise indistinguishable,
>> might a better fix be to make them indistinguishable in this regard as
>> well? Is there a good reason why the second fd doesn't become
>> exec()able in this scenario and, if not, perhaps that behavior could be
>> changed instead?
>
> It probably could be changed, yes. But I'm worried that would be
> broadening the bug that is the exec()ability of memfds. AFAIK no other
> fd that is opened as writable can be exec()ed. If maintainers would
> prefer this, I could do this.

I'm not convinced that perpetuating the behavior and adding an ioctl()
workaround would be better than that; it seems to me that consistency
would be better. But I don't have any real say in that matter, of
course; I'm curious what others think.

Thanks,

jon