Skip to contentSkip to conversation

Turning on DOITM at last

DISCUSSION Demi Marie Obenour 4 participants 4 messages Jul 18 – Jul 20 Crypto API

lore
Share & tools
lore
#0 lore raw

Is it time to go ahead and turn on DOITM?

Here's my reasoning:

- If it doesn't do anything, it's a harmless no-op.

- If it does something, then that something needed to be done to protect code that handles secrets, such as crypto code.

- The overhead of switching it on and off is too high, so it's best to just leave it on all the time.

- Even people who don't care about speculative execution vulnerabilities, because they only run trusted code on a particular server, still likely need secure cryptography.

Xen already turned it on in the past.

Signature · 2 lines
Sincerely,
Demi Marie Obenour (she/her/hers)
#1 lore raw
Quoted 1 line · Demi Marie Obenour

Is it time to go ahead and turn on DOITM?

No, I don't think so.

Quoted 1 line

- If it doesn't do anything, it's a harmless no-op.

I kinda disagree with this.

There are CPUs that enumerate support for DOITM but on which it doesn't do anything. On those CPUs, every cycle spent twiddling it is a waste.

Quoted 2 lines

- If it does something, then that something needed to be done to protect code that handles secrets, such as crypto code.

I really disagree with this.

Lots of code "handles secrets". memcpy() "handles secrets".

Quoted 2 lines

- The overhead of switching it on and off is too high, so it's best to just leave it on all the time.

The overhead *is* too high. It's an MSR bit that requires a user/kernel round trip.

Quoted 3 lines

- Even people who don't care about speculative execution vulnerabilities, because they only run trusted code on a particular server, still likely need secure cryptography.

I'm not sure where speculative execution vulnerabilities came in to play here.

Quoted 1 line

Xen already turned it on in the past.

While I very much respect the Xen folks and their security posture, Xen is a very different project than Linux.

#2 lore raw

[+Cc [email protected]]

Quoted 29 lines · Dave Hansen
Quoted 1 line · Demi Marie Obenour

Is it time to go ahead and turn on DOITM?

No, I don't think so.

Quoted 1 line

- If it doesn't do anything, it's a harmless no-op.

I kinda disagree with this.

There are CPUs that enumerate support for DOITM but on which it doesn't do anything. On those CPUs, every cycle spent twiddling it is a waste.

Quoted 2 lines

- If it does something, then that something needed to be done to protect code that handles secrets, such as crypto code.

I really disagree with this.

Lots of code "handles secrets". memcpy() "handles secrets".

Quoted 2 lines

- The overhead of switching it on and off is too high, so it's best to just leave it on all the time.

The overhead *is* too high. It's an MSR bit that requires a user/kernel round trip.

Quoted 3 lines

- Even people who don't care about speculative execution vulnerabilities, because they only run trusted code on a particular server, still likely need secure cryptography.

Quoted 7 lines

I'm not sure where speculative execution vulnerabilities came in to play here.

Quoted 1 line

Xen already turned it on in the past.

While I very much respect the Xen folks and their security posture, Xen is a very different project than Linux.

The right thing to do for now is to just turn on DOITM at boot time
(https://lore.kernel.org/r/[email protected]/)
to fix the backwards compatibility break. With just one write per CPU at boot time, the overhead of writing the MSR won't really matter.

For the insecure mode to be the default, there will need to be an efficient way for userspace to enable the traditional secure mode, *and then* several years for userspace to be updated.

Unfortunately, since the hardware enabled the insecure mode by default, Linux inherited that backwards compatibility break without any explicit patch submission, and the burden is being put on people wanting to restore the traditional behavior. It should be the other way around:
the traditional behavior needs to be the default for now, and then we can discuss what needs to happen for it to be safe to enable the new insecure mode by default.

- Eric

#3 lore raw
Quoted 30 lines · Eric Biggers

[+Cc [email protected]]

Quoted 27 lines · Dave Hansen
Quoted 1 line · Demi Marie Obenour

Is it time to go ahead and turn on DOITM?

No, I don't think so.

Quoted 1 line

- If it doesn't do anything, it's a harmless no-op.

I kinda disagree with this.

There are CPUs that enumerate support for DOITM but on which it doesn't do anything. On those CPUs, every cycle spent twiddling it is a waste.

Quoted 2 lines

- If it does something, then that something needed to be done to protect code that handles secrets, such as crypto code.

I really disagree with this.

Lots of code "handles secrets". memcpy() "handles secrets".

Quoted 2 lines

- The overhead of switching it on and off is too high, so it's best to just leave it on all the time.

The overhead *is* too high. It's an MSR bit that requires a user/kernel round trip.

Quoted 3 lines

- Even people who don't care about speculative execution vulnerabilities, because they only run trusted code on a particular server, still likely need secure cryptography.

I'm not sure where speculative execution vulnerabilities came in to play here.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Xen already turned it on in the past.

While I very much respect the Xen folks and their security posture, Xen is a very different project than Linux.

The right thing to do for now is to just turn on DOITM at boot time
(https://lore.kernel.org/r/[email protected]/)
to fix the backwards compatibility break. With just one write per CPU at boot time, the overhead of writing the MSR won't really matter.

This is what Xen does, for the same reasons as you've given.

We don't even virtualise the controls for guests.

Quoted 11 lines

For the insecure mode to be the default, there will need to be an efficient way for userspace to enable the traditional secure mode, *and then* several years for userspace to be updated.

Unfortunately, since the hardware enabled the insecure mode by default, Linux inherited that backwards compatibility break without any explicit patch submission, and the burden is being put on people wanting to restore the traditional behavior. It should be the other way around:
the traditional behavior needs to be the default for now, and then we can discuss what needs to happen for it to be safe to enable the new insecure mode by default.

+1.

It's not just in Linux, it's all OSes and all userspace doing any form of sensitive operations.

Insecure by default may have been a deliberate choice on Intel's behalf, but it really is unacceptable for the wider software ecosystem.

~Andrew