13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions
comment 7y ago · link · parent
I could probably automate it for a struct with a macros so that the API was autosandboxed. Also, it was purely an experiment and is not particularly safe - secrets in the "broker" process would leak to the client, for example. I had plans to deal with at least some of these issues using a build.rs to generate a separate binary that could be exec'd but I stopped caring.
I wonder how this sandboxapi gets around that?
The reason I didn't bother was because I found that constructing the sandbox was the hard part, not executing the code in it - how do you detect what the code needs to do in the sandbox? You end up too tight or too loose.
Also, performance is miserable if you have to fork/exec every single time. So you may be tempted to cache the process across executions but that comes with its own pains. Again, curious how this is dealt with in sandboxapi.
Personally, I want to see sandboxing support at a language level. I imagine a language, perhaps like Pony, which has isolated units of execution that connect via some form of RPC/message passing. With a type system that "taints" types based on actions, basically a capability type that propagates upwards, you could generate seccomp filters for every unit of execution. Pony seems like it's actually not far from this, from what I could tell.
Sandboxing in a language like this is a matter of moving the execution unit out of process, which shouldn't be that hard.
comment 7y ago · link · parent
It's S3 -> SNS -> SQS -> Lambda
This gives me:
* Persistent events on s3, for replayability
* Multiconsumer for SNS
* Dead letters, retries, etc via SQS
Maybe from a latency perspective this is slow, but my system can tolerate latency at the level of minutes, so I'm really doubtful that my messaging system will matter.
Most time is spent downloading payloads in S3 as far as I know. I batch up and compress proto events to optimize this.
I haven't tried scaling out my system but I'm confident that message passing is the least of my concerns.
comment 7y ago · link · parent
That said,
> I have yet to see some convincing proof of that
There is no proof, but I can point you to research.
pdf warnings: https://jimgray.azurewebsites.net/papers/tandemtr85.7_whydoc...
This paper is fundamental to reliability, and describes two primitives for building reliable systems - transactions, and the "persistent process" (spoilers: it's an actor).
And here's Joe Armstrong's thesis. The first 3 chapters are quite relevant and will point you to further research
http://erlang.org/download/armstrong_thesis_2003.pdf
> besides that Ericsson router from 20 years ago that ended up being rewritten in C++.
This is missing some important information. Erlang is still used at the control plane/ orchestration layer, for exactly the reasons I've described.
> This still doesn't prove that there are no languages that can do a better job at it than Erlang.
Didn't say otherwise.
> 99.99% of extremely reliable software today runs on non Erlang: C, C++, Java, you name it.
Sure, but who cares about Erlang? The real money's in isolated persistent processes aka actors, and I bet most reliable software is built on those, whether language provided or not. See AWS's cell based architecture, which is just the actor model with discipline attached. Or all of microservice architecture.
> Finally, in my experience, writing supervisors in Erlang is just as painful, and if not harder, than writing resilient code based on exceptions in Java or C++.
That's ok.
comment 7y ago · link · parent
Certainly some games are already quite pricey as there are fewer and fewer copies out there (check out prices for SSBM).
comment 7y ago · link · parent
I don't disagree. To be clear, I'm a type safety zealot.
> You will eventually be paying for that when the first major refactor comes - if it comes, that is.
This is fine but not relevant. Erlang, for example, just assumes you'll fuck up the refactor. Actors are isolated interfaces and you can not share state - so a failure in one actor can not impact other actors directly.
It's fine to say that static types are better but if you read about Erlang you may find the approach very compelling - Erlang's managed to provide the basis for extremely reliable systems, without types.
And as I said, it is not either or. You can build power supervisory structures and statically type your code if you like, but no languages really do it, so you have to reach outside of the language (like using a distributed queue/ microservice approach).
comment 7y ago · link · parent
Projects like this are also critical - tons of media running on proprietary hardware/software will be lost without projects like this. Think about DOSBox, or even just Flashplayer games, or how rare an n64 is. All of the art produced on these platforms will be lost unless we build software to run it.
Emulators are also, generally, ~5-10 years behind the consoles. At that point the consoles themselves are likely deprecated in favor of the next platform. PS3 has been out for 13 years. Do you really believe this code will negatively impact sales of games, when it's usable nearly 2 decades after release?
*edit
And a side note - I believe PCSX2 was the first program I ever compiled, as a teenager. It was at least some part of what interested me in computers - I wanted to know why some games were slow or fast, or what role the GPU played. Emulators are some of the coolest projects out there, I think, and posts about their implementation seem very fitting for HN.
comment 7y ago · link · parent
Types can be thought of as a way to defensively program - encode what you can to avoid runtime errors. At minimum this means you have to think about your constraints - we may both agree that that's a fine tradeoff, but it's a tradeoff nonetheless.
Erlang, an actor based system, does not do this. Instead, it assumes that even if you added types youd run into failures and any reliable system should spend its efforts not trying to avoid that but to deal with it.
Erlang allows you to instead encode failure modes in an extremely resilient way (supervisory trees) and to trivially move code across networks to avoid hardware failures.
Languages like Python, in my opinion, are the worst of both worlds. Python encourages lots of shared mutable state but, until recently, offered very little static analysis. Time was instead spent on testing code - something that I do not believe it does any better than Erlang or a statically typed language.
To me, the answer is sort of... why not both? We can use actors and supervisory trees and static types. As an example, I write Rust services that execute on AWS lambda in response to queue events. I get state isolation and all of the good bits of the actor model, and static types.
Pony is a more fine grained solution, offering static types and in-process actors.
comment 7y ago · link · parent
Alan Kay's view of OOP is mostly just the actor model. But the actor model, like OOP, does not tell us how to actually build programs. "When do I use an object?" is a question OOP does not answer, "When do I use an actor?" is similarly not answered by the actor model.
Service Oriented Architecture is also effectively the actor model, but with a focus on the persistent process abstraction.
What Microservices does is take the actor model and say:
* Here's how you figure out where the actor abstractions should go, how large they should be, and patterns for interaction
Where microservices soooort of diverges is in its lack of discouragement of synchronous communication. But if you build your microservices using queues, I think you get the right sized actors with all of those benefits, without going down a rabbit hole of trying to structure every single bit of logic as an actor.
AWS's "Cell Based Architecture" is also just actors, but with its own set of patterns for how large to build them.
comment 7y ago · link · parent
Go is 10 years old, scala is 16 - 60% older, and it was built on top of the JVM, which is much older than that.
I feel like that's worth mentioning, because it seems like Go has more momentum - maybe there's data that shows otherwise though, like trends in Redmonk over time. I had a quick look and didn't see an easy way to get that. I'd be happy to be proven wrong, it's just the impression I get.
comment 7y ago · link · parent
A bit of the algorithm is described here: https://insanitybit.github.io/2019/03/09/grapl
More specifically Grapl defines a type of identity called a Session - this is an ID that is valid for a time, such as a PID on every major OS.
Sessions are tracked or otherwise guessed based on logs, such as process creation or termination logs. Because Grapl assumes that logs will be dropped or come out of order/ extremely delayed it makes the effort to "guess" at identities. It's been quite accurate in my experience but the algorithm has many areas for improvement - it's a bit naive right now.
Happy to answer more questions about it though.
Based on what you seem to be interested I'd like to recommend CloudMapper by Scott Piper.
comment 7y ago · link · parent
https://github.com/insanitybit/grapl
> I’d have the readme on Github, and often in an hour or maybe a few I’d be up and running when I started on a new project.
I can deploy all of my services with one command. It's trivial - and I can often just deploy the small bit that I want to.
I don't use K8s or anything like that. Just AWS Lambdas and SQS based event triggers.
One thing I found was that by defining what a "service" was upfront, I made life a lot easier. I don't have snowflakes - everything uses the same service abstraction, with only one or two small caveats.
I don't imagine a Junior developer would have a hard time with this - I'd just show them the service abstraction (it exists in code using AWS-CDK)[0].
> This in contrast to my standard consolidated log, and lets not forget my interactive terminal/debugger for when I wanted to go step by step through the process.
It's true, distributed logging is inherently more complex. I haven't run into major issues with this myself. Correlation IDs go a really long way.
Due to serverless I can't just drop into a debugger though - that's annoying if you need to. But also, I've never needed to.
> But now to really test my service I have to bring up a complete working version of my application.
I have never seen this as necessary. You just mock out service dependencies like you would a DB or anything else. I don't see this as a meaningful regression tbh.
> That is probably a bit too much effort so we’re just going to test each piece in isolation, I’m sure our specs were good enough that APIs are clean and service failure is isolated and won’t impact others.
Honestly, enforcing failure isolation is trivial. Avoid synchronous communication like the plague. My services all communicate via async events - if a service fails the events just queue up. The interface is just a protobuf defined dataformat (which is, incidentally, one of the only pieces of shared code across the services).
Honestly, I didn't find the road to microservices particularly bumpy. I had to invest early on in ensuring I had deployment scripts and the ability to run local tests. That was about it.
I'm quite glad I started with microservices. I've been able to think about services in isolation, without ever worrying about accidental coupling or accidentally having shared state. Failure isolation and scale isolation are not small things that I'd be happy to throw away.
My project is very exploratory - things have evolved over time. Having boundaries has allowed me to isolate complexity and it's been extremely easy to rewrite small services as my requirements and vision change. I don't think this would have been easy in a monolith at all.
I think I'm likely going to combine two my microservices - I split up two areas early on, only to realize later that they're not truly isolated components. Merging microservices seems radically simpler than splitting them, so I'm unconcerned about this - I can put it off for a very long time and I still suspect it will be easy to merge. I intend to perform a rewrite of one of them before the merge anyways.
I've suffered quite a lot from distributed monolith setups. I'm not likely to jump into one again if I can help it.
[0] https://github.com/insanitybit/grapl/blob/master/grapl-cdk/i...
comment 7y ago · link · parent
I'm not going to outright call this "cheating", but most of the time, virtually unconditionally, when Python is fast it's because it isn't Python, it's C.
It definitely feels worth noting that Python is radically slower than other languages, and the main "tool" it provides for improving performance is to rely on another language entirely.
comment 7y ago · link · parent
It is / was an extremely popular game, they probably figured:
* We can make some money
* Users love this garbage anyways
I haven't been a Windows user for years, but Windows 10 looks fairly impressive - especially from a security standpoint.
comment 7y ago · link · parent
My claim is that Chrome is an interesting case study in the most hardened user-facing C++ codebase in the world being hacked because of memory unsafety.
I also think that the strawman argument you've made is extremely weak for other reasons. This whole "insecure by design" thing is nonsense - everyone stating this seems to not understand that multitenant systems have existed for ages, under far more difficult constraints. An example - AWS Lambdas colocate your code with other companies' on the same hardware - if this were such an impossible task, that wouldn't be possible.
But again, my argument is not about browsers, or even much about languages, and is merely me pointing out an interesting case where memory unsafety was the root cause of an attack, despite great efforts.
comment 7y ago · link · parent
I listed a subset of the things Chrome does to help mitigate the fact that C++ bugs will make it out. It's because they don't trust C++ that this is the case.
What is interesting is that, in the case of the first itw exploit, the root case appears to be memory safety. That despite the many millions invested, memory safety was still what an attacker went after and managed to leverage into an exploit against users.
That's all.
comment 7y ago · link · parent
comment 7y ago · link · parent
Seems like UAF in C++? So, yes, I feel comfortable blaming C++.
Anyways, I didn't mention memory safe languages in my post, and I'm not even suggesting that Google did anything wrong, or should change their posture in any way. They've been extremely successful.
comment 7y ago · link · parent
It's a very literal one.
I think I've been very open about what an accomplishment they've made, and how proud they should be to have kept Chrome users safe for all of these years.
It is exactly because their efforts to secure Chrome are so impressive that I think this event is interesting.
None of what I've said is about Rust or even a suggestion that they shouldn't keep doing what their doing. One ITW exploit in a lifetime of a product is a great track record.
It is merely interesting to observe when herculean efforts fall down.
comment 7y ago · link · parent
I don't consider those on the same level as memory unsafety, personally, but it's not really a meaningful comparison because I'm not going to dig around for numbers and mitigation techniques.