[PATCH v2 0/2] liveupdate: Return -ENOTTY for unknown ioctl numbers

From: Chris Down

Date: Wed Dec 02 2026 - 17:44:46 EST


luo_ioctl() and luo_session_ioctl() return -EINVAL for a command number
outside their ops table, but ENOTTY for an in-table number whose full
command does not match. That contradicts the errno contract in
include/uapi/linux/liveupdate.h, and it means a program cannot tell an
ioctl the kernel does not have from a known ioctl with a bad argument.
It also makes isatty() on a LUO fd fail with EINVAL instead of ENOTTY.

Patch 1 returns -ENOIOCTLCMD for out-of-range numbers too. Patch 2 adds
a selftest for it.

v2:

- Name the command numbers the selftest uses, and drop 0x3f on
/dev/liveupdate, since it tests the same thing as 0xff there (Pratyush)

v1: https://lore.kernel.org/r/cover.1796194107.git.chris@xxxxxxxxxxxxxx

Chris Down (2):
liveupdate: Return -ENOTTY for unknown ioctl numbers
selftests/liveupdate: Test ENOTTY for unknown ioctl numbers

kernel/liveupdate/luo_core.c | 2 +-
kernel/liveupdate/luo_session.c | 2 +-
.../testing/selftests/liveupdate/liveupdate.c | 39 +++++++++++++++++++
3 files changed, 41 insertions(+), 2 deletions(-)


base-commit: 073b7942a9a5998875c2e65a4c243212206713c2
--
2.56.1