Linux Manual Pages development
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>
Cc: "Daniël Hörchner" <dbjh@gmx.net>,
	linux-man@vger.kernel.org, "Ingo Schwarze" <schwarze@openbsd.org>,
	victorm007@yahoo.com, t.piekarski@deloquencia.de,
	linux-api@vger.kernel.org, x86@kernel.org
Subject: Re: Suggestions for an improvement to the man page "iopl - change I/O privilege level".
Date: Sun, 18 Oct 2026 13:25:17 +0200	[thread overview]
Message-ID: <atSsS8Pw9Pzixb7g@debian> (raw)
In-Reply-To: <87ecdqewg2.ffs@fw13>

[-- Attachment #1: Type: text/plain, Size: 3275 bytes --]

Hi Thomas,

> Date: 2026-10-15 18:54:21+0200
> From: Thomas Gleixner <tglx@kernel.org>
>
> On Sun, Oct 11 2026 at 19:26, Alejandro Colomar wrote:
> >> > However, as far as I can tell, all mentioned BSDs have dropped
> >> > that functionality, but NetBSD and OpenBSD retained their version
> >> > of iopl(): i386_iopl(), x86_64_iopl() (NetBSD/x86_64) and
> >> > amd64_iopl() (OpenBSD/x86_64). FreeBSD and DragonFly BSD set the
> >> > IOPL of the relevant process to 3 in the kernel, when the process
> >> > successfully opens /dev/io.
> >> > In other words, the BSD projects all preferred to drop their
> >> > versions of ioperm() in favor of continuing to provide user
> >> > programs a way to change the IOPL. It is interesting and perhaps
> >> > noteworthy that the Linux project appears to head in the opposite
> >> > direction.
> >
> > Ingo, Thomas, do you have any comments from the OpenBSD and Linux sides?
> 
> The 'iopl() is slower' comment is just voodoo as it really does not
> matter whether a syscall at setup time takes a bit longer or not. But
> 30+ years ago syscall performance bragging was part of the game :)
> 
> Though the difference between iopl() and ioperm() is not only that
> ioperm() provides a more granular control than iopl() over the I/O ports
> which can be accessed.
> 
> Up to Linux 5.4 iopl() was implemented using the IOPL bits in
> EFLAGS. Setting them to '3' allows user space to access not only all I/O
> ports via IN/INS/OUT/OUTS, but also allows user space to use CLI/STI.
> 
> ioperm() was there first (as of Linux 0.96). It allows not only to have
> more granular control over the accessible IO ports but also avoids the
> CLI/STI enablement.
> 
> iopl() followed in 0.97 and was deprecated after we changed the iopl()
> implementation in 5.5 to utilize the IOPERM bitmap, which effectively
> prevents the usage of CLI/STI in user space. Ancient X-Servers used to
> utilize CLI/STI in user space for serialization, but that code has long
> reached the ugly code museum.
> 
> Aside of the syscalls the permission bitmap can also be changed via
> X86 specific VT IOCTLs.
> 
> In all cases the caller must have RAWIO capabilities. The syscalls and
> the IOCTLs can be disabled at compile time and the security framework
> can lock them down, i.e. disable them.
> 
> So in pratice these syscalls and IOCTLs are ancient ballast and any
> modern distro should not need them anymore.

Thanks!  I'll keep the manual pages unchanged.


Have a lovely day!
Alex

> 
> Though at least in the enterprise world there have been binary only
> vendor "value add" programs which depended on them. At least that was the
> case seven years ago.
> 
> But as kernels might have the syscalls disabled or security measures
> make them unacessible at runtime, these syscalls and IOCTLs might be
> indeed just nostalgia.
> 
> My personal preference would be to just delete them, but if there is a
> legitimate use case then I prefer to have ioperm() as that allows at
> least fine granular permission checks via the syscall security controls
> instead of having the binary all or nothing iopl() mechanism.
> 
> Thanks,
> 
>         tglx
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-10-18 11:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <trinity-4d271f4c-4816-435f-b8c9-53eef0ff29c7-1786468770978@trinity-msg-rest-gmx-gmx-live-d7f776569-bpnnk>
2026-10-11 17:18 ` Suggestions for an improvement to the man page "iopl - change I/O privilege level" Alejandro Colomar
2026-10-11 17:26   ` Alejandro Colomar
2026-10-11 18:57     ` Ingo Schwarze
2026-10-11 19:10       ` Alejandro Colomar
2026-10-15 16:54     ` Thomas Gleixner
2026-10-18 11:25       ` Alejandro Colomar [this message]
2026-10-18 14:09         ` Ingo Schwarze
2026-10-18 15:54       ` Andy Lutomirski
     [not found] <trinity-ad00fce6-96e1-4b4f-8abc-98e945e01f5f-1786459267306@trinity-msg-rest-gmx-gmx-live-d7f776569-7648m>
2026-08-11 16:11 ` Alejandro Colomar

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=atSsS8Pw9Pzixb7g@debian \
    --to=alx@kernel.org \
    --cc=dbjh@gmx.net \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=schwarze@openbsd.org \
    --cc=t.piekarski@deloquencia.de \
    --cc=tglx@kernel.org \
    --cc=victorm007@yahoo.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox