This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v2] linux: open and openat ignore 'mode' with O_TMPFILE in flags
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Eric Rannaud <e at nanocritical dot com>
- Cc: Roland McGrath <roland at hack dot frob dot com>, libc-alpha at sourceware dot org, joseph at codesourcery dot com
- Date: Sun, 02 Nov 2014 16:59:35 +0100
- Subject: Re: [PATCH v2] linux: open and openat ignore 'mode' with O_TMPFILE in flags
- Authentication-results: sourceware.org; auth=none
- References: <CAH_=xoZcXehKgY6jviDbmUpOxS7Vn_pWm75zzr+mT4dGop5sjQ at mail dot gmail dot com> <9e272d5ae70d7db36329c99785aefa9d32f0964d dot 1414714637 dot git dot e at nanocritical dot com> <CAH_=xoZbC1064T13ZXXdYp8c2mU15QANumefm1XzWCEG-XuDMg at mail dot gmail dot com>
* Eric Rannaud:
> This patch above is a straightforward fix, but Linus asks: why not
> invoke va_arg() unconditionally? The 'mode' argument thus read could
> not be used by the wrapper, as it could contain garbage, but it could
> be passed untouched to the kernel.
If technically undefined behavior which just happens to work is
acceptable, you could also add the optional argument to the argument
list. This would address the performance concern which may have been
the reason to make the va_arg call conditional.
Anyway, I think the definition of __OPEN_NEEDS_MODE is still
incorrect. It should check for any unknown flags in addition to
O_CREAT and O_TMPFILE. Otherwise, we'll run into the same problem