Skip to content

Commit

Permalink
statx: define STATX_ATTR_VERITY
Browse files Browse the repository at this point in the history
Add a statx attribute bit STATX_ATTR_VERITY which will be set if the
file has fs-verity enabled.  This is the statx() equivalent of
FS_VERITY_FL which is returned by FS_IOC_GETFLAGS.

This is useful because it allows applications to check whether a file is
a verity file without opening it.  Opening a verity file can be
expensive because the fsverity_info is set up on open, which involves
parsing metadata and optionally verifying a cryptographic signature.

This is analogous to how various other bits are exposed through both
FS_IOC_GETFLAGS and statx(), e.g. the encrypt bit.

Reviewed-by: Andreas Dilger <[email protected]>
Acked-by: Darrick J. Wong <[email protected]>
Signed-off-by: Eric Biggers <[email protected]>
  • Loading branch information
ebiggers committed Nov 13, 2019
1 parent c0d782a commit 3ad2522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/linux/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ struct kstat {
STATX_ATTR_IMMUTABLE | \
STATX_ATTR_APPEND | \
STATX_ATTR_NODUMP | \
STATX_ATTR_ENCRYPTED \
STATX_ATTR_ENCRYPTED | \
STATX_ATTR_VERITY \
)/* Attrs corresponding to FS_*_FL flags */
u64 ino;
dev_t dev;
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/linux/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ struct statx {
#define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */

#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */


#endif /* _UAPI_LINUX_STAT_H */

0 comments on commit 3ad2522

Please sign in to comment.