Skip to content

exfat: Valid Data Length(VDL) ioctl

David Timber linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1exfat: Valid Data Length(VDL) ioctlfs/exfat/file.c include/uapi/linux/exfat.h+102 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/1] exfat: Valid Data Length(VDL) ioctl

To remedy the problems outlines in the commit 1f2b2a3f submitted previously, I implemented two new ioctls for reading and manipulating the VDL of files in exFAT fs. For usage example, please review the link attached.

chdosattr and lsdosattr commands are analogous to lsattr and chattr commands from e2fsprogs. Below is sample output of lsdosattr.

	$ lsdosattr
	----d-        32768            0 .
	------     67108864            = ./full-file
	r-----        32768            = ./readonly
	-h----        32768            = ./hidden
	--s---        32768            = ./system-file
	-h---a      2097152            = ./hidden-archived
	----d-        32768            = ./dir
	------   3221225472   1073741824 ./vdl-a
	------   1073741824         4100 ./vdl-b

where '=' denotes that the VDL is same as isize, '*' denotes no kernel support(ioctl returned ENOTTY).

Some notable examples of chdosattr usage as follows.

	chdosattr +a   file  # add ARCHIVE to the attribute bitset
	chdosattr -h   file  # clear HIDDEN from the attribute bitset
	chdosattr =ra  file  # set to RO|ARCHIVE
	chdosattr = -R dir   # clear all attributes recursively

Manipulation of the SYSTEM attribute bit is subject to restrictions already in place within the kernel.

I understand VDL manipulation poses a risk so I decided to submit the code patch first before doing some documentation work. I'd happily accept the rejection to the idea of EXFAT_IOC_SET_VALID_DATA.

Further work

NTFS also incorporates DOS attributes and VDL for backward compatibility in legacy systems albeit NTFS is a sparse-capable filesystem. For future works, it might be in our interest to implement the ioctls in the NTFS as well.

Despite the fact that FAT_IOCTL_*_ATTRIBUTES ioctls have been available for a long time now, most userspace programs(most notably Wine) still rely on the write permission bit to control ATTR_RO. The only way to control the other attributes(ARCHIVED and HIDDEN) is through the ioctl.

The VDL ioctl only requires CAP_SYS_ADMIN. For an added layer of security, perhaps a new SELinux boolean, say allow_fat_set_valid_data_ioctl, should be added.

David Timber (1):
exfat: Valid Data Length(VDL) ioctl

 fs/exfat/file.c            | 93 ++++++++++++++++++++++++++++++++++++++
 include/uapi/linux/exfat.h | 10 +++-
 2 files changed, 102 insertions(+), 1 deletion(-)
Signature · 1 line
2.53.0.1.ga224b40d3f.dirty