From: Andrey Zakharov <dedemorow@gmail.com>
To: x86@kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
hpa@zytor.com, Andy Lutomirski <luto@kernel.org>,
Kees Cook <kees@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrey Zakharov <dedemorow@gmail.com>
Subject: [RFC] x86/ioperm: boot-time switch to disable iopl()/ioperm()?
Date: Wed, 28 Oct 2026 01:09:04 +0300 [thread overview]
Message-ID: <20261027220904.15896-1-dedemorow@gmail.com> (raw)
Hi,
KSPP issue #97 (https://github.com/KSPP/linux/issues/97) asks for a way
to disable iopl() and ioperm() at boot time, so that a distro can keep
CONFIG_X86_IOPL_IOPERM enabled while system owners can still turn the
syscalls off.
I read Thomas's recent explanation in the "iopl - change I/O privilege
level" man page thread, and Andy's reply that iopl() is low maintenance.
So before writing any code I would like to ask whether such a knob is
wanted at all, or whether CONFIG_X86_IOPL_IOPERM=n and lockdown are
considered enough.
As far as I can tell, the options today are the build-time
CONFIG_X86_IOPL_IOPERM and lockdown=integrity, which also restricts
/dev/mem, kexec and other features. I did not find a boot parameter for
this in next-20261022, nor a previous series on lore (I searched for
iopl and ioperm).
If it is wanted, the change would be small:
- an early parameter, modelled on ia32_emulation= (kstrtobool() in an
early_param handler), that sets an __ro_after_init flag;
- a check of that flag in ksys_ioperm() and SYSCALL_DEFINE1(iopl) in
arch/x86/kernel/ioport.c, next to the existing capable(CAP_SYS_RAWIO)
/ security_locked_down(LOCKDOWN_IOPORT) checks, which today already
reject only requests to gain port access;
- an entry in Documentation/admin-guide/kernel-parameters.txt;
- default behaviour unchanged.
Questions:
1. Is a boot parameter wanted, given lockdown and the compile-time
option?
2. Thomas mentioned that the permission bitmap can also be changed
through x86-specific VT ioctls. Should such a knob cover those as
well, or would it be incomplete without them? I have not looked at
that code yet.
3. Which error should be returned when access is refused this way:
-EPERM, as for lockdown, or -ENOSYS, as when CONFIG_X86_IOPL_IOPERM
is disabled?
No patch yet. I will send one only if there is interest, and I am fine
with "not needed" as an answer.
Thanks,
Andrey Zakharov
reply other threads:[~2026-10-27 22:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261027220904.15896-1-dedemorow@gmail.com \
--to=dedemorow@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.