r/ProgrammerHumor • • 12d ago

Meme cacheRemembers

Post image
4.2k Upvotes

33 comments sorted by

538

u/Cronos993 12d ago

An actual programming meme??!

25

u/Express_Gradient 11d ago

I just woke up to this meme going #1 on the sub, it's crazy. I was just studying systems and I kept seeing scope for memes. i have more coming.

1

u/asato977424 6d ago

Next up: cache coherence, where every core remembers a different version of the incident.

326

u/alexforencich 12d ago

More like, an actual CPU architecture meme

91

u/Bronzdragon 12d ago

We'll take what we can get.

23

u/alexforencich 12d ago

I would say those are even more rare

1

u/uSkRuBboiiii 8d ago

VHDL and or verilog meme?

27

u/turqoise_rabbit 12d ago

in this economy?!

86

u/Sw429 12d ago

All the vibe coders can't understand this one lol

0

u/[deleted] 12d ago

[deleted] — view deleted comment

19

u/Mordret10 11d ago

Could have taken that minute to prompt the AI to take control over your Reddit account and answer in your stead in the future

14

u/JesusWantsYouToKnow 12d ago

Not just an actual programming meme, but an actual programming meme / early top gear crossover meme. Insane quality and bonus James May panel.

300

u/Sibula97 12d ago

Wasn't that basically what Spectre exploited? Does anyone know how the vulnerability was fixed?

203

u/Express_Gradient 12d ago

yes, that is exactly spectre. there were a bunch of fixes - barriers at sensitive checks, restrictive speculative memory accesses, some cpu changes, etc. spec exec is still there, but with lot more restrictions.

https://docs.kernel.org/admin-guide/hw-vuln/spectre.html

12

u/schmerg-uk 11d ago

Nitpick but the original Spectre wasn't a branch predictor exploit but a bounds check bypass.

It exploited the way the CPU speculatively fetched from RAM before checking if the data used to calculate the address of the data to be fetched relied on private data that the process shouldn't have access to. By the time the fetch was scheduled to execute, the rights check would recognise the issue and the instruction wouldn't execute in that the speculative read into a "hidden" register would be discarded but yes, the cache would hold the fact of the read.

6

u/SGVsbG86KQ 11d ago

I thought that was Meltdown?

4

u/schmerg-uk 11d ago

Ah, I think you (and OP) may be right... Meltdown exploits speculative read without branching (where the right to read is effectively not considered until after the speculative execution occurs)

uint8_t* probe_array = new uint8_t[256 * 4096];
// ... Make sure probe_array is not cached
uint8_t kernel_memory = *(uint8_t*)(kernel_address);
uint64_t final_kernel_memory = kernel_memory * 4096;
uint8_t dummy = probe_array[final_kernel_memory];
// ... catch page fault
// ... determine which of 256 slots in probe_array is cached

whereas Spectre's variant 1 bounds check bypass is very similar but it's the branch predictor that guesses that a read will be within bounds

if (x < array1_size) {
  y = array2[array1[x] * 256];
}

Spectre is considerably more difficult to exploit than Meltdown because this vulnerability does not depend on privilege escalation. The attacker must convince the kernel to run code and speculate incorrectly. Typically the attacker must poison the speculation engine and fool it into guessing incorrectly.

https://medium.com/@mattklein123/meltdown-spectre-explained-6bc8634cc0c2

My apologies ...

52

u/Legal-Software 12d ago

This takes me back to the r10k-based indigo2 that featured speculative execution but lacked cache coherency, and would silently corrupt DMA transfers. That was fun.

7

u/Express_Gradient 11d ago

silent corruption was a feature, not a bug /s

44

u/Iyemoja 12d ago

The cache holding a grudge is the most accurate part. You can roll back the branch, but you cannot unremember what it saw at 2am.

18

u/Express_Gradient 11d ago

the cache has seen things. the cache shall not forget.

1

u/a-r-c 10d ago

you cannot unremember what it saw at 2am.

computer is more like me than I thought

7

u/Majik_Sheff 11d ago

Now do rowhammer!

4

u/Express_Gradient 11d ago

thanks, I will definitely.

3

u/Patrick_Atsushi 11d ago

Well, it’s either a hit or miss, anyway.

2

u/berlin_priez 12d ago

Thank you Sir. i chuckled.

0

u/naughtee_in 11d ago

Branch: gets rolled back. Cache: "I'll remember that." Same energy as my manager during appraisal season.

0

u/Buyer_North 10d ago

wow...this reposts gets 3k+ upvotes...

2

u/razor_train 9d ago

Granted some of the upvotes were speculative.

59

u/Multidream 12d ago

Speculative execution is truly a deal with the devil

34

u/anomalous_cowherd 12d ago

Maybe we've not been in a parallel universe since 2012, we're just on a speculative path that's due for reaping any day now?

4

u/Express_Gradient 11d ago

we are all in a simulation

18

u/Multidream 12d ago

The insane benefit of being able to just drop all development of the world since 2012 as just “bad branch, deleting” may be worth it.