aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
authorfellair <tesladead43@gmail.com>2025-06-12 20:39:14 +0300
committerAleksandr Nogikh <nogikh@google.com>2025-06-16 16:52:54 +0000
commitcfebc8873b2f707ef8ed0bb2d8abb0280fede23a (patch)
tree78e81303e6483d12f2aa1078462703710a1e49a8 /sys/linux
parentb07d761310f45ec82aafa352739e190d12ab58a0 (diff)
sys/linux: update descriptions in dev_block.txt
A few things done here: - Add new block device ioctls (and structs) related to encryption, added in 1ebd4a3c095c ("blk-crypto: add ioctls to create and prepare hardware-wrapped keys"): BLKCRYPTOIMPORTKEY BLKCRYPTOGENERATEKEY BLKCRYPTOPREPAREKEY Deviate slightly from original keys-related structs to ensure that ioctl syscalls have preallocated buffers to work with, not merely pointers that go nowhere. - Add and update new/missing syscalls related to zoned block devices: BLKGETZONESZ BLKGETNRZONES BLKOPENZONE BLKCLOSEZONE BLKFINISHZONE - Add a few other missing syscalls, such as BLKRASET. - Fix some syscalls' directions (mostly, to 'inout').
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/dev_block.txt46
-rw-r--r--sys/linux/dev_block.txt.const16
2 files changed, 58 insertions, 4 deletions
diff --git a/sys/linux/dev_block.txt b/sys/linux/dev_block.txt
index 3d445c216..536367d02 100644
--- a/sys/linux/dev_block.txt
+++ b/sys/linux/dev_block.txt
@@ -7,6 +7,7 @@ include <uapi/linux/blkzoned.h>
include <uapi/linux/pr.h>
include <uapi/linux/hdreg.h>
include <uapi/linux/blkpg.h>
+include <linux/blk-crypto.h>
resource fd_block_trace[fd]
resource fd_block[fd_block_trace]
@@ -16,7 +17,7 @@ openat$rnullb(fd const[AT_FDCWD], file ptr[in, string["/dev/rnullb0"]], flags fl
openat$md(fd const[AT_FDCWD], file ptr[in, string["/dev/md0"]], flags flags[open_flags], mode const[0]) fd_block
openat$pmem0(fd const[AT_FDCWD], file ptr[in, string["/dev/pmem0"]], flags flags[open_flags], mode const[0]) fd_block
-ioctl$BLKTRACESETUP(fd fd_block_trace, cmd const[BLKTRACESETUP], arg ptr[in, blk_user_trace_setup])
+ioctl$BLKTRACESETUP(fd fd_block_trace, cmd const[BLKTRACESETUP], arg ptr[inout, blk_user_trace_setup])
ioctl$BLKTRACESTART(fd fd_block_trace, cmd const[BLKTRACESTART], arg const[0])
ioctl$BLKTRACESTOP(fd fd_block_trace, cmd const[BLKTRACESTOP], arg const[0])
ioctl$BLKTRACETEARDOWN(fd fd_block_trace, cmd const[BLKTRACETEARDOWN], arg const[0])
@@ -25,18 +26,20 @@ ioctl$BLKFLSBUF(fd fd_block, cmd const[BLKFLSBUF], arg ptr[in, intptr])
ioctl$BLKROSET(fd fd_block, cmd const[BLKROSET], arg ptr[in, intptr])
ioctl$BLKDISCARD(fd fd_block, cmd const[BLKDISCARD], arg ptr[in, intptr])
ioctl$BLKSECDISCARD(fd fd_block, cmd const[BLKSECDISCARD], arg ptr[in, intptr])
+ioctl$BLKDISCARDZEROES(fd fd_block, cmd const[BLKDISCARDZEROES], arg ptr[out, intptr])
ioctl$BLKZEROOUT(fd fd_block, cmd const[BLKZEROOUT], arg ptr[in, blk_zone_range])
-ioctl$BLKREPORTZONE(fd fd_block, cmd const[BLKREPORTZONE], arg ptr[in, blk_zone_report])
-ioctl$BLKRESETZONE(fd fd_block, cmd const[BLKRESETZONE], arg ptr[in, blk_zone_range])
ioctl$BLKRAGET(fd fd_block, cmd const[BLKRAGET], arg ptr[out, intptr])
+ioctl$BLKFRAGET(fd fd_block, cmd const[BLKFRAGET], arg ptr[out, intptr])
ioctl$BLKROGET(fd fd_block, cmd const[BLKROGET], arg ptr[out, intptr])
ioctl$BLKBSZGET(fd fd_block, cmd const[BLKBSZGET], arg ptr[out, intptr])
+ioctl$BLKSSZGET(fd fd_block, cmd const[BLKSSZGET], arg ptr[out, intptr])
ioctl$BLKPBSZGET(fd fd_block, cmd const[BLKPBSZGET], arg ptr[out, intptr])
ioctl$BLKIOMIN(fd fd_block, cmd const[BLKIOMIN], arg ptr[out, intptr])
ioctl$BLKIOOPT(fd fd_block, cmd const[BLKIOOPT], arg ptr[out, intptr])
ioctl$BLKALIGNOFF(fd fd_block, cmd const[BLKALIGNOFF], arg ptr[out, intptr])
ioctl$BLKSECTGET(fd fd_block, cmd const[BLKSECTGET], arg ptr[out, intptr])
ioctl$BLKROTATIONAL(fd fd_block, cmd const[BLKROTATIONAL], arg ptr[out, intptr])
+ioctl$BLKRASET(fd fd_block, cmd const[BLKRASET], arg ptr[in, intptr])
ioctl$BLKFRASET(fd fd_block, cmd const[BLKFRASET], arg ptr[in, intptr])
ioctl$BLKBSZSET(fd fd_block, cmd const[BLKBSZSET], arg ptr[in, intptr])
ioctl$BLKPG(fd fd_block, cmd const[BLKPG], arg ptr[in, blkpg_ioctl_arg])
@@ -45,6 +48,21 @@ ioctl$BLKGETSIZE(fd fd_block, cmd const[BLKGETSIZE], arg ptr[out, intptr])
ioctl$BLKGETSIZE64(fd fd_block, cmd const[BLKGETSIZE64], arg ptr[out, int64])
ioctl$BLKGETDISKSEQ(fd fd_block, cmd const[BLKGETDISKSEQ], arg ptr[out, int64])
+# TODO: To properly explore zones-related ioctls, figure out how to setup zoned devices.
+ioctl$BLKREPORTZONE(fd fd_block, cmd const[BLKREPORTZONE], arg ptr[inout, blk_zone_report])
+ioctl$BLKRESETZONE(fd fd_block, cmd const[BLKRESETZONE], arg ptr[in, blk_zone_range])
+ioctl$BLKOPENZONE(fd fd_block, cmd const[BLKOPENZONE], arg ptr[in, blk_zone_range])
+ioctl$BLKCLOSEZONE(fd fd_block, cmd const[BLKCLOSEZONE], arg ptr[in, blk_zone_range])
+ioctl$BLKFINISHZONE(fd fd_block, cmd const[BLKFINISHZONE], arg ptr[in, blk_zone_range])
+ioctl$BLKGETZONESZ(fd fd_block, cmd const[BLKGETZONESZ], arg ptr[in, int32])
+ioctl$BLKGETNRZONES(fd fd_block, cmd const[BLKGETNRZONES], arg ptr[in, int32])
+
+# TODO: These calls may fail early on current kernel testing setups due to
+# uninitialized blk_crypto_profile involved in related device drivers.
+ioctl$BLKCRYPTOIMPORTKEY(fd fd_block, cmd const[BLKCRYPTOIMPORTKEY], arg ptr[inout, blk_crypto_import_key_arg])
+ioctl$BLKCRYPTOGENERATEKEY(fd fd_block, cmd const[BLKCRYPTOGENERATEKEY], arg ptr[inout, blk_crypto_generate_key_arg])
+ioctl$BLKCRYPTOPREPAREKEY(fd fd_block, cmd const[BLKCRYPTOPREPAREKEY], arg ptr[inout, blk_crypto_prepare_key_arg])
+
ioctl$HDIO_GETGEO(fd fd_block, cmd const[HDIO_GETGEO], arg ptr[out, hd_geometry])
ioctl$IOC_PR_REGISTER(fd fd_block, cmd const[IOC_PR_REGISTER], arg ptr[in, pr_registration])
@@ -113,6 +131,28 @@ blk_user_trace_setup {
pid pid
}
+blk_crypto_import_key_arg {
+ raw_key_ptr ptr[in, array[int8, 16:BLK_CRYPTO_MAX_RAW_KEY_SIZE]]
+ raw_key_size len[raw_key_ptr, int64]
+ lt_key_ptr ptr[out, array[int8, 1:BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]]
+ lt_key_size len[lt_key_ptr, int64]
+ reserved array[const[0, int64], 4]
+}
+
+blk_crypto_generate_key_arg {
+ lt_key_ptr ptr[out, array[int8, 1:BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]]
+ lt_key_size len[lt_key_ptr, int64]
+ reserved array[const[0, int64], 4]
+}
+
+blk_crypto_prepare_key_arg {
+ lt_key_ptr ptr[in, array[int8, 1:BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]]
+ lt_key_size len[lt_key_ptr, int64]
+ eph_key_ptr ptr[out, array[int8, 1:BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]]
+ eph_key_size len[eph_key_ptr, int64]
+ reserved array[const[0, int64], 4]
+}
+
pr_registration {
old_key int64
new_key int64
diff --git a/sys/linux/dev_block.txt.const b/sys/linux/dev_block.txt.const
index 889c850b7..4938e318d 100644
--- a/sys/linux/dev_block.txt.const
+++ b/sys/linux/dev_block.txt.const
@@ -1,17 +1,27 @@
# Code generated by syz-sysgen. DO NOT EDIT.
arches = 386, amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x
-AT_FDCWD = ???
+AT_FDCWD = 18446744073709551516
BLKALIGNOFF = 4730, mips64le:ppc64le:536875642
BLKBSZGET = 2148012656, 386:arm:2147750512, mips64le:ppc64le:1074270832
BLKBSZSET = 1074270833, 386:arm:1074008689, mips64le:ppc64le:2148012657
+BLKCLOSEZONE = 1074795143, mips64le:ppc64le:2148536967
+BLKCRYPTOGENERATEKEY = 3224375946
+BLKCRYPTOIMPORTKEY = 3225424521
+BLKCRYPTOPREPAREKEY = 3225424523
BLKDISCARD = 4727, mips64le:ppc64le:536875639
+BLKDISCARDZEROES = 4732, mips64le:ppc64le:536875644
+BLKFINISHZONE = 1074795144, mips64le:ppc64le:2148536968
BLKFLSBUF = 4705, mips64le:ppc64le:536875617
+BLKFRAGET = 4709, mips64le:ppc64le:536875621
BLKFRASET = 4708, mips64le:ppc64le:536875620
BLKGETDISKSEQ = 2148012672, mips64le:ppc64le:1074270848
+BLKGETNRZONES = 2147750533, mips64le:ppc64le:1074008709
BLKGETSIZE = 4704, mips64le:ppc64le:536875616
BLKGETSIZE64 = 2148012658, 386:arm:2147750514, mips64le:ppc64le:1074270834
+BLKGETZONESZ = 2147750532, mips64le:ppc64le:1074008708
BLKIOMIN = 4728, mips64le:ppc64le:536875640
BLKIOOPT = 4729, mips64le:ppc64le:536875641
+BLKOPENZONE = 1074795142, mips64le:ppc64le:2148536966
BLKPBSZGET = 4731, mips64le:ppc64le:536875643
BLKPG = 4713, mips64le:ppc64le:536875625
BLKPG_ADD_PARTITION = 1
@@ -20,6 +30,7 @@ BLKPG_DEVNAMELTH = 64
BLKPG_RESIZE_PARTITION = 3
BLKPG_VOLNAMELTH = 64
BLKRAGET = 4707, mips64le:ppc64le:536875619
+BLKRASET = 4706, mips64le:ppc64le:536875618
BLKREPORTZONE = 3222278786
BLKRESETZONE = 1074795139, mips64le:ppc64le:2148536963
BLKROGET = 4702, mips64le:ppc64le:536875614
@@ -28,12 +39,15 @@ BLKROTATIONAL = 4734, mips64le:ppc64le:536875646
BLKRRPART = 4703, mips64le:ppc64le:536875615
BLKSECDISCARD = 4733, mips64le:ppc64le:536875645
BLKSECTGET = 4711, mips64le:ppc64le:536875623
+BLKSSZGET = 4712, mips64le:ppc64le:536875624
BLKTRACESETUP = 3225948787, 386:3225424499
BLKTRACESTART = 4724, mips64le:ppc64le:536875636
BLKTRACESTOP = 4725, mips64le:ppc64le:536875637
BLKTRACETEARDOWN = 4726, mips64le:ppc64le:536875638
BLKTRACE_BDEV_SIZE = 32
BLKZEROOUT = 4735, mips64le:ppc64le:536875647
+BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE = 128
+BLK_CRYPTO_MAX_RAW_KEY_SIZE = 64
HDIO_GETGEO = 769
IOC_PR_CLEAR = 1074819277, mips64le:ppc64le:2148561101
IOC_PR_PREEMPT = 1075343563, mips64le:ppc64le:2149085387