android_kernel_msm-6.1_noth.../include/uapi/linux
Eric Biggers 6b972d6047 BACKPORT: fscrypt: support crypto data unit size less than filesystem block size
Until now, fscrypt has always used the filesystem block size as the
granularity of file contents encryption.  Two scenarios have come up
where a sub-block granularity of contents encryption would be useful:

1. Inline crypto hardware that only supports a crypto data unit size
   that is less than the filesystem block size.

2. Support for direct I/O at a granularity less than the filesystem
   block size, for example at the block device's logical block size in
   order to match the traditional direct I/O alignment requirement.

(1) first came up with older eMMC inline crypto hardware that only
supports a crypto data unit size of 512 bytes.  That specific case
ultimately went away because all systems with that hardware continued
using out of tree code and never actually upgraded to the upstream
inline crypto framework.  But, now it's coming back in a new way: some
current UFS controllers only support a data unit size of 4096 bytes, and
there is a proposal to increase the filesystem block size to 16K.

(2) was discussed as a "nice to have" feature, though not essential,
when support for direct I/O on encrypted files was being upstreamed.

Still, the fact that this feature has come up several times does suggest
it would be wise to have available.  Therefore, this patch implements it
by using one of the reserved bytes in fscrypt_policy_v2 to allow users
to select a sub-block data unit size.  Supported data unit sizes are
powers of 2 between 512 and the filesystem block size, inclusively.
Support is implemented for both the FS-layer and inline crypto cases.

This patch focuses on the basic support for sub-block data units.  Some
things are out of scope for this patch but may be addressed later:

- Supporting sub-block data units in combination with
  FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64, in most cases.  Unfortunately this
  combination usually causes data unit indices to exceed 32 bits, and
  thus fscrypt_supported_policy() correctly disallows it.  The users who
  potentially need this combination are using f2fs.  To support it, f2fs
  would need to provide an option to slightly reduce its max file size.

- Supporting sub-block data units in combination with
  FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.  This has the same problem
  described above, but also it will need special code to make DUN
  wraparound still happen on a FS block boundary.

- Supporting use case (2) mentioned above.  The encrypted direct I/O
  code will need to stop requiring and assuming FS block alignment.
  This won't be hard, but it belongs in a separate patch.

- Supporting this feature on filesystems other than ext4 and f2fs.
  (Filesystems declare support for it via their fscrypt_operations.)
  On UBIFS, sub-block data units don't make sense because UBIFS encrypts
  variable-length blocks as a result of compression.  CephFS could
  support it, but a bit more work would be needed to make the
  fscrypt_*_block_inplace functions play nicely with sub-block data
  units.  I don't think there's a use case for this on CephFS anyway.

Link: https://lore.kernel.org/r/20230925055451.59499-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>

Bug: 299136786
Bug: 302588300
(cherry picked from commit 5b11888471806edf699316d4dcb9b426caebbef2)
(Reworked this commit to not change struct fscrypt_operations and not
 depend on other commits that changed struct fscrypt_operations.  Also
 resolved conflicts with the HW-wrapped key support.)
Change-Id: Ic3dc56ef3f42d123f812e9037e2cc6f0b24bacc1
Signed-off-by: Eric Biggers <ebiggers@google.com>
2023-12-06 17:54:14 +00:00
..
android
byteorder
caif
can can: raw: add CAN XL support 2022-09-15 09:08:09 +02:00
cifs
dvb
genwqe
hdlc
hsi
iio iio: add modifers for pitch, yaw, roll 2022-09-21 18:42:55 +01:00
isdn
misc
mmc
netfilter This is the 6.1.9 stable release 2023-02-01 09:12:59 +00:00
netfilter_arp
netfilter_bridge netfilter: ebtables: fix fortify warnings in size_entry_mwt() 2023-09-23 11:11:03 +02:00
netfilter_ipv4
netfilter_ipv6
nfsd
raid
sched
spi
sunrpc
surface_aggregator
tc_act headers: Remove some left-over license text 2022-09-27 07:48:01 -07:00
tc_ematch
usb Merge 6.1.18 into android14-6.1 2023-03-21 08:22:15 +00:00
a.out.h
acct.h
acrn.h
adb.h
adfs_fs.h
affs_hardblocks.h block: change all __u32 annotations to __be32 in affs_hardblocks.h 2023-07-19 16:21:47 +02:00
agpgart.h
aio_abi.h
am437x-vpfe.h
amt.h
android_fuse.h ANDROID: fuse-bpf: Align data structs for 32-bit kernels 2023-09-05 21:24:08 +00:00
apm_bios.h
arcfb.h
arm_sdei.h
aspeed-lpc-ctrl.h
aspeed-p2a-ctrl.h
atalk.h
atm.h
atm_eni.h
atm_he.h
atm_idt77105.h
atm_nicstar.h
atm_tcp.h
atm_zatm.h
atmapi.h
atmarp.h
atmbr2684.h
atmclip.h
atmdev.h
atmioc.h
atmlec.h
atmmpc.h
atmppp.h
atmsap.h
atmsvc.h
audit.h audit: fix undefined behavior in bit shift for AUDIT_BIT 2022-10-31 07:29:47 -04:00
auto_dev-ioctl.h autofs: use flexible array in ioctl structure 2023-07-19 16:22:11 +02:00
auto_fs.h
auto_fs4.h
auxvec.h
ax25.h
batadv_packet.h
batman_adv.h
baycom.h
bcm933xx_hcs.h
bfs_fs.h
binfmts.h
blkpg.h
blktrace_api.h
blkzoned.h block: Fix a source code comment in include/uapi/linux/blkzoned.h 2023-08-03 10:24:04 +02:00
bpf.h This is the 6.1.57 stable release 2023-11-02 07:05:54 +00:00
bpf_common.h
bpf_perf_event.h
bpfilter.h
bpqether.h
bsg.h
bt-bmc.h
btf.h
btrfs.h btrfs: scrub: reject unsupported scrub flags 2023-05-11 23:03:40 +09:00
btrfs_tree.h btrfs: introduce BTRFS_QGROUP_STATUS_FLAGS_MASK for later expansion 2022-09-26 12:28:01 +02:00
cachefiles.h
can.h can: canxl: introduce CAN XL data structure 2022-09-15 09:08:09 +02:00
capability.h capabilities: fix undefined behavior in bit shift for CAP_TO_MASK 2022-11-05 01:25:57 -04:00
capi.h
cciss_defs.h
cciss_ioctl.h
ccs.h
cdrom.h
cec-funcs.h media: cec: add support for Absolute Volume Control 2022-09-24 08:50:04 +02:00
cec.h media: cec: add support for Absolute Volume Control 2022-09-24 08:50:04 +02:00
cfm_bridge.h
cgroupstats.h
chio.h
close_range.h
cm4000_cs.h
cn_proc.h
coda.h
coff.h
comedi.h
connector.h
const.h UPSTREAM: uapi/linux/const.h: prefer ISO-friendly __typeof__ 2023-06-14 16:40:59 +00:00
coresight-stm.h
counter.h counter: Introduce the Count capture component 2022-09-30 14:32:35 +02:00
cramfs_fs.h
cryptouser.h
cuda.h
cxl_mem.h
cyclades.h
cycx_cfm.h
dcbnl.h
dccp.h
devlink.h
dlm.h fs: dlm: remove DLM_LSFL_FS from uapi 2022-08-23 14:54:54 -05:00
dlm_device.h
dlm_netlink.h
dlm_plock.h
dlmconstants.h
dm-ioctl.h
dm-log-userspace.h
dm-user.h
dma-buf.h
dma-heap.h
dns_resolver.h
dqblk_xfs.h
dw100.h media: uapi: Add a control for DW100 driver 2022-08-29 15:32:13 +02:00
edd.h
efs_fs_sb.h
elf-em.h
elf-fdpic.h
elf.h
errno.h
errqueue.h
erspan.h
ethtool.h ethtool: add interface to interact with Ethernet Power Equipment 2022-10-03 17:33:57 -07:00
ethtool_netlink.h net: ethtool: correct MAX attribute value for stats 2023-06-21 16:01:00 +02:00
eventpoll.h eventpoll: add EPOLL_URING_WAKE poll wakeup flag 2023-01-04 11:28:47 +01:00
f2fs.h f2fs: introduce F2FS_IOC_START_ATOMIC_REPLACE 2022-12-19 11:05:21 -08:00
fadvise.h
falloc.h
fanotify.h
fb.h
fcntl.h
fd.h
fdreg.h
fib_rules.h
fiemap.h
filter.h
firewire-cdev.h
firewire-constants.h
fou.h
fpga-dfl.h
fs.h
fscrypt.h BACKPORT: fscrypt: support crypto data unit size less than filesystem block size 2023-12-06 17:54:14 +00:00
fsi.h
fsl_hypervisor.h
fsl_mc.h
fsmap.h
fsverity.h
fuse.h Merge f721d24e5d ("Merge tag 'pull-tmpfile' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs") into android-mainline 2022-10-25 14:51:37 +02:00
futex.h
gameport.h
gen_stats.h
genetlink.h
gfs2_ondisk.h
gpio.h
gsmmux.h
gtp.h
gunyah.h ANDROID: gunyah: Sync with latest documentation and UAPI 2023-05-16 20:35:28 +00:00
gzvm.h FROMLIST: virt: geniezone: Add memory relinquish support 2023-11-27 19:03:01 +00:00
hash_info.h
hdlc.h
hdlcdrv.h
hdreg.h
hid.h HID: convert defines of HID class requests into a proper enum 2022-09-20 11:53:32 +01:00
hiddev.h
hidraw.h
hpet.h
hsr_netlink.h
hw_breakpoint.h
hyperv.h
i2c-dev.h
i2c.h
i2o-dev.h
i8k.h
icmp.h
icmpv6.h
idxd.h dmaengine: idxd: Fix crc_val field for completion record 2022-12-31 13:32:49 +01:00
if.h
if_addr.h
if_addrlabel.h
if_alg.h
if_arcnet.h
if_arp.h
if_bonding.h
if_bridge.h
if_cablemodem.h
if_eql.h
if_ether.h can: canxl: update CAN infrastructure for CAN XL frames 2022-09-15 09:08:09 +02:00
if_fc.h
if_fddi.h
if_hippi.h
if_infiniband.h
if_link.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next 2022-10-03 07:52:13 +01:00
if_ltalk.h
if_macsec.h
if_packet.h
if_phonet.h
if_plip.h
if_ppp.h
if_pppol2tp.h
if_pppox.h
if_slip.h
if_team.h
if_tun.h tun: support not enabling carrier in TUNSETIFF 2022-09-23 12:02:03 +01:00
if_tunnel.h
if_vlan.h
if_x25.h
if_xdp.h
ife.h
igmp.h
ila.h
in.h UPSTREAM: ipv{4,6}/raw: fix output xfrm lookup wrt protocol 2023-06-07 14:24:50 +00:00
in6.h
in_route.h
incrementalfs.h
inet_diag.h
inotify.h
input-event-codes.h Input: add ABS_PROFILE to uapi and documentation 2022-09-28 18:31:37 -07:00
input.h
io_uring.h io_uring: Replace 0-length array with flexible array 2023-03-10 09:34:03 +01:00
ioam6.h
ioam6_genl.h
ioam6_iptunnel.h
ioctl.h
iommu.h
ioprio.h
ip.h uapi: add missing ip/ipv6 header dependencies for linux/stddef.h 2023-02-14 19:11:44 +01:00
ip6_tunnel.h
ip_vs.h
ipc.h
ipmi.h
ipmi_bmc.h
ipmi_msgdefs.h
ipsec.h
ipv6.h Revert "net: add sysctl accept_ra_min_rtr_lft" 2023-11-02 07:06:05 +00:00
ipv6_route.h
irqnr.h
iso_fs.h
isst_if.h
ivtv.h
ivtvfb.h
jffs2.h
joystick.h
kcm.h
kcmp.h
kcov.h
kd.h
kdev_t.h
kernel-page-flags.h
kernel.h
kernelcapi.h
kexec.h
keyboard.h
keyctl.h
kfd_ioctl.h
kfd_sysfs.h
kvm.h ANDROID: KVM: arm64: Introduce KVM_CAP_ARM_PROTECTED_VM to set/query PVM firmware 2022-12-15 16:12:59 +00:00
kvm_para.h
l2tp.h uapi: move IPPROTO_L2TP to in.h 2022-09-20 09:13:38 +02:00
landlock.h landlock: Fix documentation style 2022-09-29 18:43:04 +02:00
libc-compat.h
limits.h
lirc.h
llc.h
loadpin.h
loop.h
lp.h
lwtunnel.h xfrm: lwtunnel: add lwtunnel support for xfrm interfaces in collect_md mode 2022-08-29 10:44:08 +02:00
magic.h
major.h
map_to_7segment.h
map_to_14segment.h
matroxfb.h
max2175.h
mctp.h
mdio.h
media-bus-format.h
media.h
mei.h
membarrier.h
memfd.h
mempolicy.h
meye.h
mii.h
minix_fs.h
mman.h
mmtimer.h
module.h
mount.h
mpls.h
mpls_iptunnel.h
mptcp.h
mqueue.h
mroute.h
mroute6.h
mrp_bridge.h
msdos_fs.h
msg.h
mtio.h
nbd-netlink.h
nbd.h
ncsi.h
ndctl.h
neighbour.h
net.h
net_dropmon.h
net_namespace.h
net_tstamp.h
netconf.h
netdevice.h
netfilter.h netfilter: remove NFPROTO_DECNET 2022-09-07 16:46:03 +02:00
netfilter_arp.h
netfilter_bridge.h
netfilter_ipv4.h
netfilter_ipv6.h
netlink.h netlink: remove the flex array from struct nlmsghdr 2023-10-10 22:00:46 +02:00
netlink_diag.h
netrom.h
nexthop.h
nfc.h
nfs.h
nfs2.h
nfs3.h
nfs4.h
nfs4_mount.h
nfs_fs.h
nfs_idmap.h
nfs_mount.h
nfsacl.h
nilfs2_api.h
nilfs2_ondisk.h
nitro_enclaves.h
nl80211-vnd-intel.h
nl80211.h BACKPORT: wifi: cfg80211: OWE DH IE handling offload 2023-11-20 22:25:18 +00:00
nsfs.h
nubus.h
nvme_ioctl.h
nvram.h
omap3isp.h
omapfb.h
oom.h
openat2.h
openvswitch.h openvswitch: allow specifying ifindex of new interfaces 2022-08-26 19:31:20 -07:00
packet_diag.h
param.h
parport.h
patchkey.h
pci.h
pci_regs.h
pcitest.h
perf_event.h perf/mem: Rename PERF_MEM_LVLNUM_EXTN_MEM to PERF_MEM_LVLNUM_CXL 2022-10-27 10:27:32 +02:00
personality.h
pfkeyv2.h
pfrut.h
pg.h
phantom.h
phonet.h
pidfd.h
pkt_cls.h net/sched: flower: Add L2TPv3 filter 2022-09-20 09:13:38 +02:00
pkt_sched.h net/sched: taprio: allow user input of per-tc max SDU 2022-09-29 18:52:05 -07:00
pktcdvd.h
pmu.h
poll.h
posix_acl.h
posix_acl_xattr.h
posix_types.h
ppdev.h
ppp-comp.h
ppp-ioctl.h
ppp_defs.h
pps.h
pr.h
prctl.h
psample.h
psci.h ANDROID: firmware/psci: Remove PSCI_1_1_FN64_MEM_PROTECT definition 2023-04-19 12:58:27 +00:00
psp-sev.h
ptp_clock.h
ptrace.h
qemu_fw_cfg.h
qnx4_fs.h
qnxtypes.h
qrtr.h
quota.h
radeonfb.h
random.h
rds.h
reboot.h
reiserfs_fs.h
reiserfs_xattr.h
remoteproc_cdev.h
resource.h
rfkill.h
rio_cm_cdev.h
rio_mport_cdev.h
rkisp1-config.h media: rockchip: rkisp1: Define macros for DPCC configurations in UAPI 2022-09-24 08:31:54 +02:00
romfs_fs.h
rose.h
route.h
rpl.h
rpl_iptunnel.h
rpmsg.h
rpmsg_types.h
rseq.h
rtc.h
rtnetlink.h net/sched: act_api: add specific EXT_WARN_MSG for tc action 2023-06-21 16:01:02 +02:00
rxrpc.h
scc.h
sched.h
scif_ioctl.h
screen_info.h
sctp.h
seccomp.h
securebits.h
sed-opal.h block: sed-opal: Add ioctl to return device status 2022-08-22 07:52:51 -06:00
seg6.h
seg6_genl.h
seg6_hmac.h
seg6_iptunnel.h
seg6_local.h seg6: add NEXT-C-SID support for SRv6 End behavior 2022-09-20 12:33:22 +02:00
selinux_netlink.h
sem.h
serial.h
serial_core.h
serial_reg.h
serio.h
sev-guest.h
shm.h
signal.h
signalfd.h
smc.h
smc_diag.h
smiapp.h
snmp.h
sock_diag.h
socket.h
sockios.h
sonet.h
sonypi.h
sound.h
soundcard.h
stat.h statx: add direct I/O alignment information 2022-09-11 19:47:04 -05:00
stddef.h
stm.h
string.h
suspend_ioctls.h
swab.h include/uapi/linux/swab: Fix potentially missing __always_inline 2022-12-31 13:32:48 +01:00
switchtec_ioctl.h
sync_file.h dma-buf/sync_file: Fix docs syntax 2023-09-13 09:42:53 +02:00
synclink.h
sysctl.h
sysinfo.h
target_core_user.h
taskstats.h
tcp.h
tcp_metrics.h
tee.h
termios.h
thermal.h
time.h
time_types.h
timerfd.h
times.h
timex.h
tiocl.h
tipc.h
tipc_config.h
tipc_netlink.h
tipc_sockets_diag.h
tls.h net: tls: Add ARIA-GCM algorithm 2022-09-27 17:29:09 -07:00
toshiba.h
tty.h
tty_flags.h
types.h
ublk_cmd.h ublk_drv: add START_USER_RECOVERY and END_USER_RECOVERY support 2022-09-23 19:09:56 -06:00
udf_fs_i.h
udmabuf.h
udp.h
uhid.h
uinput.h
uio.h
uleds.h
ultrasound.h
um_timetravel.h
un.h
unistd.h
unix_diag.h
usbdevice_fs.h
usbip.h usbip: add USBIP_URB_* URB transfer flags 2022-08-31 09:07:53 +02:00
userfaultfd.h userfaultfd: add /dev/userfaultfd for fine grained access control 2022-09-11 20:25:48 -07:00
userio.h
utime.h
utsname.h
uuid.h
uvcvideo.h media: uvcvideo: Silence memcpy() run-time false positive warnings 2023-03-11 13:55:33 +01:00
v4l2-common.h
v4l2-controls.h Revert "media: uapi: HEVC: Add num_delta_pocs_of_ref_rps_idx field" 2023-10-12 12:03:37 +00:00
v4l2-dv-timings.h
v4l2-mediabus.h
v4l2-subdev.h
vbox_err.h
vbox_vmmdev_types.h
vboxguest.h
vdpa.h vDPA: allow userspace to query features of a vDPA device 2022-10-07 20:00:42 -04:00
vduse.h
veth.h
vfio.h vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR 2023-03-10 09:34:32 +01:00
vfio_ccw.h
vfio_zdev.h
vhost.h
vhost_types.h
videodev2.h This is the 6.1.39 stable release 2023-09-02 19:41:42 +00:00
virtio_9p.h
virtio_balloon.h
virtio_blk.h virtio_blk: add SECURE ERASE command support 2022-10-07 09:32:41 -04:00
virtio_bt.h
virtio_config.h
virtio_console.h
virtio_crypto.h
virtio_fs.h
virtio_gpio.h
virtio_gpu.h
virtio_i2c.h
virtio_ids.h
virtio_input.h
virtio_iommu.h
virtio_mem.h
virtio_mmio.h
virtio_net.h net: virtio_net: fix notification coalescing comments 2022-08-30 22:44:25 -07:00
virtio_pci.h
virtio_pcidev.h
virtio_pmem.h
virtio_ring.h
virtio_rng.h
virtio_scmi.h
virtio_scsi.h
virtio_snd.h
virtio_types.h
virtio_vsock.h
vm_sockets.h
vm_sockets_diag.h
vmcore.h
vsockmon.h
vt.h
vtpm_proxy.h
wait.h
watch_queue.h
watchdog.h
wireguard.h
wireless.h
wmi.h
wwan.h
x25.h
xattr.h
xdp_diag.h
xfrm.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec 2022-08-24 12:51:50 +01:00
xilinx-v4l2-controls.h
zorro.h
zorro_ids.h