Better HN
topnewbestaskshowjobs
Log inSign up

staticassertion

13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions

@insanitybit
Submissions

comment 4y ago · link · parent

I haven't watched any Netflix shows, so I really couldn't say. I just watch parliament, unedited, and sometimes BBC coverage. It's a leisure, I'm hardly an academic about it.

That said, I think you've misunderstood my post entirely.

a) If you think this system is just now creaking into life, I frankly don't know how. Again, major news very recently with Black Rod stomping in and various MPs protesting.

b) It's not that big of a deal relatively speaking. The monarchy is very clearly increasingly irrelevant, as it has been for some time. Obviously abolish that shit, but the initial post is a bit dramatic.

c) You should compare parliament to cspan sometime - our illiterate representatives don't even bother to show up.

Obviously the UK has plenty of issues, it's an interesting system to watch. Removing the monarchy might be a good step forward, obviously you should all do that. But it's not some 'creeking' 'deep state' system, it's very front and center, and it's really not your biggest problem by a longshot.

comment 4y ago · link · parent

Did you just notice you're in a monarchy? Have you never seen parliament open? You missed prorogation with the silly Black Rod nonsense?

I'm not sure how you can characterize this as some creeky system that's just showing its face now lol it's built into so much of your government, multiple times a year, including one extremely high profile case (the prorogation) only a few months ago.

Honestly, be grateful. I watch parliament for some sort of fucked up cathartic release because even the worst of your MPs have a base moral compass that would dwarf almost anyone in the US government. Just the fact that Johnson's party initiated the no-confidence is incredible, I can't imagine that happening in the US - 15% of a party turning against their party representative? Impossible here.

If the cost is some silly ceremony that is increasingly irrelevant every year, pay that cost.

comment 4y ago · link · parent

Agreed. If IDEs and alternative compilers are all building off of the spec because it's the path of least resistance, and there are no bugs for a while, the defacto standard impl is going to face serious scrutiny for parting from it.

And, as you said, proto isn't in a great position to be making crazy changes anyway.

comment 4y ago · link · parent

I guess, but like... how? Like I said, I can't really think of 24 things to do lol. I'm reminded of Dolphin, the GC/Wii emulator - people would ask for more cores to be used and they'd basically be like "for what???", they started moving stuff like audio out, eventually they made some breakthroughs where they could split more things out.

Maybe with these frameworks threads are less dedicated and instead are more cooperative, idk. Really not my area!

comment 4y ago · link · parent

Any idea what for? I feel like PoE doesn't involve that much compute other than what would be offloading to the gpu. Maps are static, and I would have assumed that mobs are primarily computed server-side based on some sort of loosely synchronized state.

I guess I could imagine a few threads for managing different 'panes', a thread for chat, a thread for audio maybe? It's hard to think of 24 independent units of work.

I'm not a game dev, just used to play PoE and curious.

comment 4y ago · link · parent

I think they typically target hypervisors because it's far more likely that that's what people will want to run on, but there's nothing fundamental stopping a unikernel from running on bare metal.

comment 4y ago · link · parent

I believe that when a file is mmap'd a page table is created for it in the . As you perform read/write on the file a fault loads the actual entries into that page table. As pages can be mapped they so too can be unmapped under pressure, without that falling back to swap (since it is already a file backed map, you wouldn't swap a file backed map to a different file after all).

There are a few relevant bits to this. You can MAP_POPULATE the file to prepopulate the entries and you can MAP_LOCKED to MAP_POPULATE + lock the pages in (unreliably). As mentioned in the man page for mmap MAP_LOCKED has some failure modes that you don't get with mlock.

https://www.man7.org/linux/man-pages/man2/mmap.2.html

I also found this page: https://eklitzke.org/mlock-and-mlockall

Oh, and this: https://access.redhat.com/documentation/en-us/red_hat_enterp...

comment 4y ago · link · parent

Seems like a case for a unikernel running on bare metal. No copying bytes across kernel/user, no context switching at all.

comment 4y ago · link · parent

Ah, ok, I assumed the issue was happening outside of the function. If the issue is actually those intermediaries being mutated, bummer.

As for copy vs deepcopy, like I said, I have no idea what the type is so I don't know that deepcopy is necessary or not.

comment 4y ago · link · parent

Love to see it. A perfect example of why this optimization can't be done automatically - in the case of `else` you're working with a mutable reference to `x` passed in, which means that now your function is mutating something it used to not mutate.

A "safe" way to do this is still straightforward, I think.

    from copy import copy
    def _forward(self, x, context=None):
        x = x.contiguous() if x.device.type == 'mps' else x
        x = copy(x)
        x += self.attn1(self.norm1(x))
        x += self.attn2(self.norm2(x), context=context)
        x += self.ff(self.norm3(x))
        return x
It could be faster but I don't know what `x` is and I'm not going to guess. Also, `copy` may not be sufficient, `deepcopy` may be necessary - again, I don't know what `x` is so I can't figure that out. Pls use type annotations :)

comment 4y ago · link · parent

This isn't a Python issue, this is a "I'm copying when I don't need to" issue. As I mention elsewhere, you can write this sort of "bug" in almost any language pretty easily (as I demonstrate with Rust).

This isn't a case of "The Python interpreter is bad" it's just that the code is doing what the user asked it to do - create a completely new copy of the data, then overwrite the old copy with it. Immutable operations like this are slow, mutating the value (what += does) is fast.

Granted, a compiled language could recognize that you're doing this, but it also might not - is `+` and `+=` semantically identical such that the compiler can replace one with the other? Maybe? Probably not, if I had to guess. The correct answer is to just use the faster operation, as it is with all language.

I don't know the type of `x`, but I'd suggest another optimization here would be to:

a) Preallocate the buffer rather before mutating it 3x (which is still likely forcing some allocations)

b) Reuse that buffer if it's so important, store it in `self` and clear it before use.

comment 4y ago · link · parent

I don't think this is an operator overloading thing? It's just that `x = y + x` is equivalent to

    z = y + x
    x = z
Basically, creating an object `z` just to throw it away.

`x += y` just adds y to x directly without any intermediary.

You could write this in any language pretty easily. For example, in Rust:

    let x = "abc".to_string();
    let y = "123".to_string();
    let x = x + &y;
as opposed to the more efficient:

    let mut x = "abc".to_string();
    let y = "123".to_string();
    x.push_str(&y);
It's just using an operation to mutate in place vs an immutable operation.

comment 4y ago · link · parent

Sure, I think all developers, virtually regardless of domain, should strive for higher quality software. The bar is really low. But the fight I choose is memory safety in cases where end user security will be harmed without it - to me, that's such a pathetically low bar already, surely people can't argue against it (they can and they do lol I hate this industry tbh).

comment 4y ago · link · parent

Yeah, to be clear, some domains are different. Gaming is one example of a domain where "best effort" memory safety is perfectly acceptable. Would I prefer full memory safety? Sure, but we don't see games as an attack vector in the wild very often and there are good reasons for that.

If someone wants to build a game in a language that's best-effort memory safety go for it. Similarly, CLI applications are often never called from an untrusted context and often provide semantic power that is equivalent to code execution anyways, so again I'd love to see memory safety, but I'm not going to care that much.

But these are exceptions - you'd still want to way whatever you're getting from memory-unsafe-language-X against just using a memory safe language. The default should be memory safety. Given that we have Go, Rust, Java, and more, there are few situations where memory safety isn't an easy option. Not zero, just few.

comment 4y ago · link · parent

Nope, didn't miss that, have been a part of rust since 2014. I don't consider any of that harassment at all, let alone harassment with regards to other languages. I'm not going to reshash the discussion as this happened years ago, geofft summarizes things pretty well in that thread, but this has all been discussed to death anyways. And, again, that's still not an example of Rust users "harassing" anyone for using other languages.

comment 4y ago · link · parent

This is exactly the way I see it. I view the bar for developer responsibility to be much higher than some others do. I suspect it's because I come from the world of information security where we deal very directly with the consequences of not having a higher bar.

To me, the idea that a new language would be anything other than entirely memory safe, unless it is very domain specific to areas where that's not important, is just another example of developers lowering the bar. And I'm fine calling that out and being called a zealot or whatever.

comment 4y ago · link · parent

Never seen this.

comment 4y ago · link · parent

God some people are so whiny. I bring my own soap to the hotel and I just ignore the soap that's there.

I realize that's not the point, but damn.

comment 4y ago · link · parent

I kind of took the opposite away from this work. I think that after digging into Firecracker it was clear that exploitation of Rust code is extremely difficult.

comment 4y ago · link · parent

TBH none of the kernel really gets designed with security in mind. It's a couple of people constantly trying to play catch up to get shit right where they can.

comment 4y ago · link · parent

Fundamentally, yeah sure, it can do whatever it wants. It just doesn't right now.

comment 4y ago · link · parent

I assume it's not using seccomp, which Docker uses, although seccomp is not Docker specific and you can go grab their policy.

comment 4y ago · link · parent

Definitely. It could have very easily gone the other way - AFAIK that guard page was not to defend against this sort of issue. What's great is that Firecracker now does have explicit guard pages that they allocate in response to this, which to me indicates that they're not just a project that patches a vulnerability but thinks through how to protect against classes of vulnerability.

comment 4y ago · link · parent

Well, we attacked Firecracker and this is what we got haha not every attack is going to lead to a full end to end, reliable exploit, although we've posted those in the past too.

The key here wasn't to produce an exploit. That would have been interesting, but ultimately not the entire goal. The key was to understand "how do we use Firecracker in the safest possible way for our use case?". To do that we picked one of the CVEs that looked like it could be exploitable and dug into it.

We learned a ton about Firecracker and KVM and walked away with some mitigations we can implement such that even if the bug had been exploitable the attacker would have more hurdles to jump through. Specifically, we'll be working to harden the guest operating system such that the untrusted code will have a difficult time escalating to root/kernel, which is a prerequisite for this sort of attack.

comment 4y ago · link · parent

I'm not sure what you mean with regards to eBPF but the difference between a container and a VM is massive with regards to security. Incidentally, my company just published a writeup about Firecracker: https://news.ycombinator.com/item?id=32767784

comment 4y ago · link · parent

Reminds me of Supernatural's Crowley optimizing hell to just be one big line where everyone just has to stand and wait. The simpler solution.

comment 4y ago · link · parent

Well, even today, if the attacker modifies the permissions it will require a re-acknowledgement. Google can also do things there, like if the extension is tied to a key (as it should be), tell developers that they are required to not provide that key to anyone else, even if they sell / transfer ownership of the extension. Instead, the new owner should register a new key, which can trigger review/ scrutiny.

Key + 2FA means the attacker has to have code execution on a developer's machine in order to publish an update (via the local session token, which you should make short lived). And Google could require a FIDO2 token if you want to bypass the "alert users that this thing uses lots of permissions".

There's a lot of stuff I'd be working on to avoid having to remove developer power.

edit: K I've been rate limited by HN so I can no longer reply for today, but them's my thoughts.

comment 4y ago · link · parent

Google AdSsense has always been able to bypass adblockers, as other advertisers have worked to do. At least in the "they could if they tried", they obviously have the technical prowess. But they haven't because that would be a scandal and invite scrutiny that they likely want to avoid - they own a massive part of the market without resorting to such things, it's not yet in their interest to do that.

So yes, as I said, maybe this is step 1 in a longer term plan to completely remove adblockers. Maybe one day so many people will rely on adblockers that Google is forced to take a drastic measure.

I personally don't expect that to be the case any time soon, but that's really not based on much.

comment 4y ago · link · parent

Yeah, so I'm against V3 mostly because I think that the pros of developers having power outweigh the cons of potential malicious extensions. I personally would have preferred rethinking a few other areas first:

1. Auditability - both in terms of the code and the behaviors

2. Improved permissions - could we have split WebRequest up?

3. Improved performance - could we have leveraged new APIs, like the declarative API, for improved performance? What about compiling to wasm? Or new APIs?

4. Capabilities/ Sandboxing - Within an extension could we slice out capabilities?

5. Improved UX around permissions. Surfacing the permissions and performance implications of extensions would be worth exploring and aided by any ability to slice up permissions more.

Chrome could even create 'sanctioned' extensions that wouldn't trigger scary popups in order to make it that much clearer when something is scary - something like "if you publish your extension such that it is digitally signed, you use 2FA or whatever, you have good standing with us, blah blah blah, we will waive that popup". IIRC Firefox did this to lower their review burden, NoScript was one of the ones on the list I think, but that would have been many years ago and I don't know if it has changed since.

That said, I don't think V3 is the end of the world. I would have preferred the other options, and I bet some people at Google explored them too and know much more about why they are/aren't viable, but I'm OK with V3. I don't really think that Google Adsense is driving this decision at all nor do I expect it to benefit them, at least not in the short/medium term.

comment 4y ago · link · parent

That's an interesting point, but I think it may also speak to the fact that v3 isn't that restrictive other than for very specific use cases.
1
282930
164