Skip to content

sys/linux: add syzkaller defintions to fuzz ublk driver#7039

Open
tejavojjala wants to merge 11 commits intogoogle:masterfrom
tejavojjala:google-ublk
Open

sys/linux: add syzkaller defintions to fuzz ublk driver#7039
tejavojjala wants to merge 11 commits intogoogle:masterfrom
tejavojjala:google-ublk

Conversation

@tejavojjala
Copy link
Copy Markdown

@tejavojjala tejavojjala commented Apr 2, 2026

No description provided.

@tejavojjala tejavojjala marked this pull request as ready for review April 2, 2026 18:56
@tejavojjala tejavojjala force-pushed the google-ublk branch 5 times, most recently from 8f35a37 to a6e1b67 Compare April 3, 2026 09:02
"syz_io_uring_submit": alwaysSupported,
"syz_io_uring_complete": alwaysSupported,
"syz_ublk_setup_io_uring": linuxCheckUblkSupported,
"syz_ublk_add_dev": linuxCheckUblkSupported,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these depend on fd_ublk_ctrl and fd_ublk_ctrl is only obtained by opening /dev/ublk-control, I think you might not need these code changes. Syzkaller will automatically determine that fd_ublk_ctrl cannot be created and should disable all syscalls that depend on it.

See e.g. https://github.com/google/syzkaller/blob/master/pkg/vminfo/syscalls.go#L194

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I don't add these, I see this panic error when running syzkaller

Do you happen to know how to resolve that


#if SYZ_EXECUTOR || __NR_syz_ublk_setup_io_uring || __NR_syz_ublk_setup_queues

static long syz_ublk_setup_io_uring(volatile long a0, volatile long a1, volatile long a2, volatile long a3, volatile long a4)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this one could also be a syzlang description? Compared to other new pseudo syscalls, syz_ublk_setup_io_uring seems to do little on top of the already existing syz_io_uring_setup.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, didn't get what you mean by that

@tejavojjala tejavojjala force-pushed the google-ublk branch 3 times, most recently from 1d16e62 to 0986cc0 Compare April 10, 2026 01:54
@pimyn-girgis
Copy link
Copy Markdown
Collaborator

@tejavojjala I don't believe you're in the contributors file, please sign the Google CLA if you haven't already, and add your name to the file as a first commit
https://github.com/google/syzkaller?tab=contributing-ov-file

@tejavojjala
Copy link
Copy Markdown
Author

@tejavojjala I don't believe you're in the contributors file, please sign the Google CLA if you haven't already, and add your name to the file as a first commit https://github.com/google/syzkaller?tab=contributing-ov-file

Missed it. Done.

Teja Vojjala added 10 commits April 10, 2026 17:22
The existing io_uring_sqe type only 64 bytes of data.
For ioring_op_uring_cmds, 128 bytes are used to support 80 bytes
of uring cmd data
ublk needs IORING_SETUP_SQE128 | IORING_SETUP_CQE32 to work
Without this, the cmds would just fail and fuzzer wastes time
All ublk ctrl commands operate on a particular device.
Instead of submitting control commands with random device ids
using syz_io_uring_submit, its better to record the ublk dev id
as a resource using a custom syzcall.

This also lets us capture the fuzzer generated dev info which we
can use in subsequent syzcalls
I added customer syzcalls to initialize queues and process IO on it

The queue initialization complex is pretty complex and it would be
very hard for the fuzzer to get it right due to the mmap setup and
submitting and SQE with appropriate details for every slot in queue
to indicate ublk readiness of the queue

Also, we need to provide a custom syscall to process io on queue.
Once cqe is advanced, we need to send a response back to make progress
It can be hard for fuzzer to figure out the flow by itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants