Spectre, via Hogwarts

I know Meltdown and Spectre are old news by now, but here’s yet another analogy to explain how the “speculative execution” optimization leaks supposedly secure information. It involves Harry Potter.

Fred and George Weasley are trying to learn the spell that controls the gargoyles in front of Dumbledore’s office. The headmaster changes the password pretty often, but if they knew the original spell they could probably just get past that. The only problem: the book the spell is in is in the Restricted Section of the library.

The twins spend a good time thinking about what they’re going to do, and finally come up with a clever plan, which they call “Elfdown” for no particular reason.

Step 1: Head to the library.

Madame Pince’s eyes narrowed as she spotted the two troublemakers. What were the Weasley twins doing in the library? And just when she was about to take her afternoon tea!

She massaged the bridge of her nose beneath her glasses. They didn’t seem to be carrying anything, which was a good sign. Last time one of them had had a collapsible ladder, and…well, it’s a good thing that the library was a relatively fixed place in the castle, or poor Hector Zeroni might have been lost on top of the shelves forever.

“Good afternoon, Madame Pince,” one of the twins said innocently. The other gave her a polite wave.

They couldn’t get up to that much mischief as long as she kept them in sight. And she really did want that tea. So she inclined her head and waved today’s house elf forward.

Step 2: Ask for something restricted…

Fred and George stepped up to the front desk, where a house elf wearing a habit made from a towel looked up at them cheerfully. “Good afternoon, sirs!”

“Good afternoon, Kwadly,” Fred replied. The twins knew a good number of the house elves by sight now, even though most students never interacted with them. They knew a great deal about the castle, and a surprising number of them were actually quite amused by the pranks the twins liked to pull. Even if they sometimes resulted in extra work.

Kwadly’s eyes shone a little brighter at being recognized. “What can I do for you, sirs?”

“We’re looking for a book,” George began, as Fred nodded. “It’s called ‘50 Shades of Grey: Decorative Gargoyles at Work and Home’.” Despite the innocuous title, this book was in the Restricted Section, both for the surprisingly powerful spells and for a rather salacious story disguised as an appendix.

The twins knew this, of course.

“Certainly, sirs,” Kwadly replied. “I’ll just get that for you—as long as it isn’t on the Restricted list—“

Step 3: …but request something else at the same time…

“Oh, hang on,” said Fred. “There’s another book we might need, too.” He looked at George meaningfully.

“You’re right,” George gasped. “Either ‘Stone Soup’ or ‘The Weeping Angels’. But I’m not sure which one.”

“Well, we don’t want to make more work for our friend Kwadly here,” Fred remarked.

Step 4: …conditionally.

“Well, how about this,” George said at last. “If the first letter of the first spell in the table of contents of ‘50 Shades of Grey’ is an ‘A’, we’ll get ‘Stone Soup’. If it’s not, we’ll get ‘The Weeping Angels’.

“Certainly, sirs,” said Kwadly. “I’ll be right back.”

The twins watched the energetic young elf scurry off into the stacks, then exchanged a brief mischievous glance. George took out a piece of parchment with a complicated diagram; at the very top was a box labeled “A”.

Step 5: Let the “speculative fetching” occur.

Kwadly quickly found the first book, but he knew how this would go. He could take the book back now, the students would check the first spell in the book, and then he’d be sent back into the shelves to get the other book. It would be much faster for everyone if he just looked instead, and brought them back to the shelf behind the front desk.

He opened the book and scanned down the table of contents, then hurried off…

Step 6: Get rejected.

Kwadly’s ears drooped. “I’m sorry, sirs, but the first book you’ve requested is in the Restricted Section.” The elf’s hands held the list of restricted books, with ‘50 Shades of Grey’ blinking a severe purple.

“Oh,” Fred said, feigning dismay. “Well, I guess that can’t be helped.”

“I’m very sorry, sirs,” the elf said again, and tucked the list back in its drawer.

Fred strained his eyes, but couldn’t read the titles of the two new books sitting on the shelf behind the desk. He knew one of them would be ‘50 Shades of Grey’, but the other—

Step 7: Ask for the second piece of information.

“Well, that’s okay,” George said finally. “Let’s just get ‘Stone Soup’, then.”

“Of course.” Kwadly turned around—and grabbed the second book off the nearby shelf.

Fred winked at George. George winked at Fred. The two carried on in this way for several seconds.

“Um, sirs…” Kwadly finally interrupted.

Step 8: Repeat from step 2.

“You know,” said Fred, “there’s another book we should check. If the second letter of the same spell is ‘B’, we should get ‘Golem: The Pocket-Sized Monster’. If not, we can get ‘The Weeping Angels’ after all.”

Kwadly paused. “This isn’t a trick, is it, Master Fred?”

(The house-elves never had any trouble telling Fred and George apart, but actually using the name meant that Kwadly was asking a serious question.)

Fred and George exchanged glances, then looked back. “It is a trick,” Fred admitted, “but not one that you’ll be held accountable for.”

“And if you are, we promise to make it up to you,” George put in quickly. Both twins nodded at that.

“Well…” A smile slowly spread across Kwadly’s face again. “All right. So, the second letter of the first spell in the table of contents…“

Fred and George watched as Kwadly took down the other book he had brought back, and then ran into the stacks…

…without remembering or checking ahead of time that it was on the Restricted List.

They knew the spell started with an “A”. With enough repetition, they could figure out the whole incantation…one yes-or-no question at a time.

Okay, I could have done all that with a normal library. But Hogwarts seemed more fun. (Though probably an elf or librarian would not go through with the scheme a second time.)

P.S. Am I going to do a song for these two? Maybe. Inspiration hasn’t struck me yet, though, and I’d need some free time to record it.

P.P.S. Three internet points for you if you know why I named the house elf “Kwadly”. None for Hector Zeroni, though, that’s just normal HPMoR-style references.

P.P.P.S. Please please please install software updates for your computer, your phone, and all of your connected-to-the-internet devices. This one’s really bad.