vfs: add faccessat2 syscall
POSIX defines faccessat() as having a fourth "flags" argument, while the linux syscall doesn't have it. Glibc tries to emulate AT_EACCESS and AT_SYMLINK_NOFOLLOW, but AT_EACCESS emulation is broken. Add a new faccessat(2) syscall with the added flags argument and implement both flags. The value of AT_EACCESS is defined in glibc headers to be the same as AT_REMOVEDIR. Use this value for the kernel interface as well, together with the explanatory comment. Also add AT_EMPTY_PATH support, which is not documented by POSIX, but can be useful and is trivial to implement. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
@@ -428,6 +428,8 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
|
||||
#endif
|
||||
asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
|
||||
asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
|
||||
asmlinkage long sys_faccessat2(int dfd, const char __user *filename, int mode,
|
||||
int flags);
|
||||
asmlinkage long sys_chdir(const char __user *filename);
|
||||
asmlinkage long sys_fchdir(unsigned int fd);
|
||||
asmlinkage long sys_chroot(const char __user *filename);
|
||||
@@ -1333,11 +1335,11 @@ static inline int ksys_chmod(const char __user *filename, umode_t mode)
|
||||
return do_fchmodat(AT_FDCWD, filename, mode);
|
||||
}
|
||||
|
||||
extern long do_faccessat(int dfd, const char __user *filename, int mode);
|
||||
long do_faccessat(int dfd, const char __user *filename, int mode, int flags);
|
||||
|
||||
static inline long ksys_access(const char __user *filename, int mode)
|
||||
{
|
||||
return do_faccessat(AT_FDCWD, filename, mode);
|
||||
return do_faccessat(AT_FDCWD, filename, mode, 0);
|
||||
}
|
||||
|
||||
extern int do_fchownat(int dfd, const char __user *filename, uid_t user,
|
||||
|
Reference in New Issue
Block a user