Work Text:
Zed leaned on his laptop, his eyes glazing over lines of code he'd already read at least thirty times in the past hour.
He and Ray were installed on a rooftop, with a power generator and all the equipment they could bring to the Cybercity on short notice. The hums and whirs of the machinery and the blinking lights, which ordinarily soothed him, were really taking a hit on his focus right now. Couriers, servant Others generated by their setup, were milling around them, patrolling, checking the equipment was in working order, bringing snacks and drinks and being all-around helpful.
He glanced at the cityscape around him. This land was somewhat abstract, with lots of skyscrapers with no actual purpose to them besides being tall and glowy, streets that didn't really connect places, shops with neon signs that didn't sell anything, and other details giving the general appearance of a futuristic city, without serving any actual function.
There were lines of codes in the night sky, glowing letters instead of stars, and instead of a moon, a giant white circle with an LED display reading GCC 9.0. It had changed a dozen times in the last hour. Most of the text in the sky was unreadable, gibberish that only vaguely looked like code.
According to Ray, the Cybercity had been more coherent in the past, but it had fallen into abstraction as the concept of a cyberspace had fallen away from popular consciousness. Now, as Wooble was announcing new virtual reality technologies and a new online socializing space, the Cybercity was rebuilding itself, with demolition crews taking out the old stylized towers, and replacing them with functional corporate offices.
And as power and memetic relevance was flowing into the Cybercity, threats had started flowing out again.
One of these threats, a Compiler Error that had been generated from the Gold Garden code and escaped into the city, had now gained enough power it was threatening to destroy everything that Ray had built. Zed and Ray were tracking it down.
"Can I get a sitrep?" Ray asked.
What Ray really meant was Tell me how you're doing, but they were both savvy enough to know that asking How are you holding up? in the middle of a crisis was a pretty good way to gainsay someone on accident.
"The implementation is basically done. There's still one module to fill in. Apart from that, the code compiles, the unit tests pass. I haven't had the time to set up a fuzzing suite. I'm browsing through the code for errors, but I think I've been on it for long enough that I'll miss them if there are any." Zed hadn't slept for 36 hours by that point. He opened another can of Gushing Granny Frenzy.
"Alright then, let me have a look." Zed turned the laptop towards Ray's chair. A Courier offered him a chocolate bar.
Ray read the code for all of ten seconds before frowning.
"What language is this?"
"It's Trust."
"For the love of... Zed, we've talked about this." Ray was really good at doing the "disappointed mentor" expression.
"You said we needed a language with good performance! And that we'd have to look out for memory safety errors! Well, there you go, Trust is memory-safe." Zed didn't like how defensive he was sounding.
"Yes, because I thought it went without saying that "good performance" meant you were going to write it in C, Zed. We can't afford to fiddle with a new language."
"Trust's first release was five years ago." It looked like they were going to retread the same debate again after all.
"It could be two weeks old, as far as the spirits are concerned. C is almost fifty years old. It's something most technomancy spirits can understand. You use something less than a decade old, you're just going to confuse them."
"Yes, I understand that." Zed tried to keep the strain out of his voice. They were both tired, and the conversation was getting heated as a result. "But this code isn't directly interacting with spirits. It's just making API calls to connect with the servers in the physical world. The calls to the Cybercity servers go through a C translation layer."
Ray grunted, and started typing commands in the terminal editor. As he browsed through pages of code, Zed gave a small thanks to his yesterday-self for not using emacs. This was not the time to get into an editor debate on top of this.
Zed and Ray were writing a re-implementation of Golden Garden, meant to send similar network packets that might bait the Error out of hiding. A Compiler Error -though Zed didn't like the name- was the result of a programming error of some kind in a system that had lots of power poured into it, often in the form of an Other or a Technomancer trying to travel through it. Contrary to what the name implied, it didn't always come from a compiler, and could come from runtime bugs as well.
The GG was written in C, though there was some talk of porting it to Lisp, and had large amounts of power running through it, which made it particularly vulnerable. Though Ray had been very careful writing the code, and multiple people had audited it for errors, Zed included, there was always a possibility one might slip through the cracks, hence their current situation.
Obviously, if the program that baited the Error itself had any memory errors, plugging their power reserves into that program would be like bringing a firefighter truck filled with gasoline, so Zed had decided the situation was a good use-case for the Trust language. But Ray was somewhat conservative, and didn't like having to learn anything that had been created after his thirties.
The sky shifted and had static-like glitches, like an old-time TV whose antenna was being adjusted, letters moving around and changing. Eventually it settled; the moon-display now read GCC 8.4.
Zed glanced at the Couriers. Every time the sky changed, they froze, and needed to be rebuilt with the new compiler. After a few seconds, they started moving again, going back to their tasks.
"Traits are like classes, right?" Ray asked.
"Kind of. They're also interfaces for template arguments."
"Oh. Okay, this makes sense. Alright, I think I get what your code does. But I don't see where the code handling HTTP requests is."
"It's a dependency."
Ray gave him the "disappointed mentor" look again.
"Dependencies in Trust are perfectly safe! That's where the name of the language comes from! You know they're not going to have memory errors!"
"They could have logical errors. And from what I understand of the language, there are escape hatches, so there could still be memory errors. And there could be a malicious payload planted in a sub-dependency. Which is concerning when our lives are going to depend on this code."
"I've downloaded the packages I thought I'd need on this server before we came," Zed said, pointing at one of the machines covered in neon fans. "And the code is checked. There's an open-source community reviewing popular packages at every update. I made sure every package was reviewed before downloading it."
Ray frowned. "I'm not sure that's enough. There are billions of dollars to be made, for anyone who manages to get a backdoor into the Golden Garden. How do you know one of the families didn't get a spy into your community?"
"They have a system in place to avoid this kind of attack. There are multiple reviewers per package, rotated at random. And I added wards to make sure the server wasn't compromised by practice or by Others."
Ray nodded. "That's good, but it's only ordinary paranoia. The attacks will always come from a direction you're not expecting. That's why you need to own all your code."
"Have to disagree there, Ray. Unless you want me to write my own SSL implementation. You always have to take some code on faith. At least Trust removes a huge category of exploits. The attack surface is much smaller."
Ray sighed again. "I guess I'll have to take you on faith this time, Zed. We don't have time to rewrite this code. But we're going to have to talk about what tools are appropriate for high-stakes crisis management."
Zed nodded. "Then all that's left is the Courier generator."
"Looking through it right now," Ray replied. "It looks like you're only missing this function?" He pointed at a line at the top of the screen.
"Yeah, but I'm not sure how to implement it. It takes two arrays and returns a single one if their addresses in memory are adjacent. And a lot of code in the module depends on it."
"Why can't you implement it?"
"Trust gives me a compile error if I try."
"Really, Zed? We are in hostile territory. There's a lot of technomancy power floating around. A compile error can become a Compiler Error at any point. If your compiler is that unreliable, maybe you should use a different language?"
"No, I shouldn't," Zed replied. This conversation was getting on his nerves. "Compiler diagnostics warn you about dangerous patterns. It's better to risk creating a small Error now, than a big one when we plug it into the Cybercity grid."
"I don't see what the dangerous pattern is. The function takes two pointers and two sizes, and returns a pointer with the full size only if they match. The code already exists in C. I've checked it."
"Maybe it's the one causing the errors?" Something nagged Zed's soda-sustained train of thought. A bit of memory, some bit of trivia he'd read in a blog about how LLWM handled pointers... Promenade, or something? Procession?
"Can't be. I've been running this code for years. It's running on the server right now. It's what powers the Couriers." He gestured at the automated assistants milling around the server.
Zed's thoughts connected. Provenance. Just because pointers had matching numerical values didn't mean they had the same provenance. And using two pointers with different provenance interchangeably was...
"Ray, turn the server off right now!"
Ray was old enough at this game to not do something stupid like asking "Why?", and moved towards the power generator. At the same time, the sky's format changed and fritzed, until it settled and the display read Clang 9.2. The Couriers looked at Ray and Zed, smiling. They formed a circle around the server and the generator. Some of them pulled out mouses, keyboards, and other electronic components as improvised weapons.
"Ray, the bug. It was never a Compiler Error in the first place."
As the Couriers approached, there was a deafening roar in the sky. An amalgamation of computer parts, glowing lines of code, graphical glitches and metallic glints rose above them, coalescing into a humongous shape, like a gigantic abstract drawing of a silver dragon.
Ray glanced at Zed, the question left unspoken, as they both pulled out their weapons.
"It was Undefined Behavior."