Re: [PATCH] do_open(): Fix O_DIRECTORY | O_CREAT behavior

From: Aleksa Sarai
Date: Mon Mar 20 2023 - 18:11:00 EST


On 2023-03-20, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> What about O_PATH? I guess it's fine to create a file and only get a
> path fd to the result?

O_PATH ignores the O_CREAT flag so it's the same as just passing O_PATH.
This is the case for all flags not in O_PATH_FLAGS (so only O_DIRECTORY,
O_NOFOLLOW, O_CLOEXEC have an effect on O_PATH). With openat2, passing
any other flag with O_PATH returns -EINVAL.

--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Attachment: signature.asc
Description: PGP signature