statx: Reserve the top bit of the mask for future struct expansion
authorDavid Howells <dhowells@redhat.com>
Fri, 31 Mar 2017 17:32:10 +0000 (18:32 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 3 Apr 2017 05:05:59 +0000 (01:05 -0400)
Reserve the top bit of the mask for future expansion of the statx struct
and give an error if statx() sees it set.  All the other bits are ignored
if we see them set but don't support the bit; we just clear the bit in the
returned mask.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/stat.c
include/uapi/linux/stat.h

index ab27f2868588b89a9408e9c1192c34571daeab2b..0c7e6cdc435c2a194dcbdd8684e9c0e9c5f01e6e 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -562,6 +562,8 @@ SYSCALL_DEFINE5(statx,
        struct kstat stat;
        int error;
 
+       if (mask & STATX__RESERVED)
+               return -EINVAL;
        if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
                return -EINVAL;
 
index 51a6b86e370043f7b37f128c4896f5f588710643..0869b9eaa8ce875fa99e1470daabfa2e4346a189 100644 (file)
@@ -152,6 +152,7 @@ struct statx {
 #define STATX_BASIC_STATS      0x000007ffU     /* The stuff in the normal stat struct */
 #define STATX_BTIME            0x00000800U     /* Want/got stx_btime */
 #define STATX_ALL              0x00000fffU     /* All currently supported flags */
+#define STATX__RESERVED                0x80000000U     /* Reserved for future struct statx expansion */
 
 /*
  * Attributes to be found in stx_attributes