Article 6S3T4 Torvalds Patch Improves Linux Performance By 2.6%

Torvalds Patch Improves Linux Performance By 2.6%

by
janrinok
from SoylentNews on (#6S3T4)

Arthur T Knackerbracket has processed the following story:

A relatively tiny code change by penguin premier Linus Torvalds is making a measurable improvement to Linux's multithreaded performance.

The code commit has the catchy name of x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user() and it's a security tweak intended to counter the types of security holes known as Meltdown flaws and Spectre attacks when they became public in 2018. Unfortunately, these problems haven't gone away. As The Register covered just last month, this type of attack remains current.

The patch is a rewrite of one originally submitted by Red Hat developer Josh Poimboeuf, which Torvalds revised to make faster. "The kernel test robot reports a 2.6 percent improvement in the per_thread_ops benchmark," he wrote in the commit.

Torvalds's version avoids using the barrier_nospec() API, which prevents speculative execution of some machine code. Speculative execution is a feature of modern CPUs that use branch prediction to try to predict what program code will be run before it's needed, so it can be run and the results cached in advance. If the prediction is correct, it saves time; if it isn't, the results are discarded. The snag is that this opens up a particular form of security issue, which boffins have been working on ever since.

Instead, where the copy_from_user() call wouldn't be allowed because of an invalid address, it uses pointer masking to return an address of all 1s.

Defending against these sorts of attacks is a necessary evil. Running web servers and the like is a primary usage of Linux, and such boxes must be locked down against every conceivable attack - even at the cost of disabling performance-enhancing features. It makes servers safer but slower. Torvalds is known for disapproving of such performance-killing measures (to put it mildly).

Read more of this story at SoylentNews.

External Content
Source RSS or Atom Feed
Feed Location https://soylentnews.org/index.rss
Feed Title SoylentNews
Feed Link https://soylentnews.org/
Feed Copyright Copyright 2014, SoylentNews
Reply 0 comments