Linus Torvalds Cleaned Up the Intel LAM Code for Linux 6.4

erek

[H]F Junkie
Joined
Dec 19, 2005
Messages
10,929
Cool

"Back during the Linux 6.2 days at the end of last year, Linus rejected the Intel LAM code at the time for various technical issues. Intel then reworked it for Linux 6.4. This time around Linus merged Intel LAM into Linux 6.4 as this new CPU feature for letting user-space store metadata within some bits of pointers without masking it out before use. Intel LAM — like Arm TBI — can be of use to virtual machines, profiling / sanitizers / tagging, and other applications. But this time around there were some less than ideal code that he personally took to sprucing up...

Torvalds reworked around one hundred lines of code for cleaning it up.

It's fun to read Torvalds' commit messages (included in both Phoronix articles). Torvalds begins by writing that the LAM updates "made me unhappy about how 'access_ok()' was done, and it actually turned out to have a couple of small bugs in it too...""

image.jpg

Source: https://linux.slashdot.org/story/23...ds-cleaned-up-the-intel-lam-code-for-linux-64
 
I’m always amazed by Linus’s work. The Linux kernel is such a huge monster. He is able to manage the direction and big picture, and also often sees many detailed tech problems in source code. This is really extraordinary and needs great talent.
 
I love the snark he throws into the comments
With such greats as:
"We already did this part for the get/put_user() side, but 'access_ok()' did the naïve "mask and range check" thing, which not only generates nasty code, but also ended up meaning that __access_ok itself didn't do a good job, and so copy_from_user_nmi() didn't get the check right."

and
"fix a bug in the address masking (that doesn't end up mattering: in this case the fix was to just remove the buggy code entirely)"
 
With such greats as:
"We already did this part for the get/put_user() side, but 'access_ok()' did the naïve "mask and range check" thing, which not only generates nasty code, but also ended up meaning that __access_ok itself didn't do a good job, and so copy_from_user_nmi() didn't get the check right."
I mean, that one seems pretty frank and matter of fact. I don't detect any snark there, anyway. Naïve is a descriptive word, and has real meaning in programming.
 
  • Like
Reactions: erek
like this
I mean, that one seems pretty frank and matter of fact. I don't detect any snark there, anyway. Naïve is a descriptive word, and has real meaning in programming.
it was more that the last half which puts that first half into context, "which not only generates nasty code, but also ended up meaning that __access_ok itself didn't do a good job" But yes.
 
  • Like
Reactions: erek
like this
Back
Top