Re: [PATCH 1/3] autofs - fix AT_NO_AUTOMOUNT not being honored
From: Colin Walters
Date: Tue Aug 08 2017 - 09:11:21 EST
On Tue, Aug 8, 2017, at 12:26 AM, Ian Kent wrote:
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3022,8 +3022,7 @@ static inline int vfs_lstat(const char __user *name, struct kstat *stat)
> static inline int vfs_fstatat(int dfd, const char __user *filename,
> struct kstat *stat, int flags)
> {
> - return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT,
> - stat, STATX_BASIC_STATS);
> + return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS);
> }
> static inline int vfs_fstat(int fd, struct kstat *stat)
> {
This is reverting the fstatat() prat of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=deccf497d804a4c5fca2dbfad2f104675a6f9102
Which itself seems weird to me - it looks like we were unconditionally
forcing on AT_NO_AUTOMOUNT regardless of what userspace passed?
So perhaps a
Fixes: deccf497d804a4c5fca2dbfad2f104675a6f9102
is appropriate here?
I understand that for stat()/lstat() we didn't expose the option to userspace,
so the behavior was...ah, there's this note in man-pages (man-pages-4.09-3.fc26.noarch):
> On Linux, lstat() will generally not trigger automounter action, whereas stat() will (but see fstatat(2)).
I have no idea of the history here, but maybe it makes sense to drop
the AT_NO_AUTOMOUNT from the vfs_stat() too?