Freedom should be achieved in different ways. Please don't make freedom and security contradictions.
Freedom should be achieved in different ways. Please don't make freedom and security contradictions.
unsafe { … }
Someone should invent such a thing.Edit: …yeah, I was being tongue-in-cheek. This is exactly what Rust provides.
http://doc.rust-lang.org/rust.html#unsafety
"...When a programmer has sufficient conviction that a sequence of potentially unsafe operations is actually safe, they can encapsulate that sequence (taken as a whole) within an unsafe block. The compiler will consider uses of such code safe, in the surrounding context…"
> I want my function to be marked as unsafe as well (because it is)
This misunderstands the nature of `unsafe`. `unsafe` means "I promise that this is actually safe, even thought it can't be inferred." Take, for example, a type which has mutable, shared state, but enforces all access through a mutex[1]. This type presents a safe interface, but the compiler can't know that it's safe, so you have to use `unsafe` internally.
1: http://static.rust-lang.org/doc/master/std/cell/struct.RefCe...
Pretty much every function is going to be transitively running unsafe code, since the core libraries use it to implement the base primitives.
unsafe fn foo() { ... }
Any function marked as such is then allowed to call other unsafe functions: unsafe fn bar() { foo(); }
But there is a way to break the chain, which is to use an `unsafe` block without marking your function as unsafe: fn qux() {
unsafe {
bar();
}
}
That said, it's incorrect to think that Rust is any more unsafe than any other language because of this; most languages simply defer this behavior to their FFI. By pulling it into the language itself, Rust is actually safer than e.g. calling C from Python, because Rust can do the low-level fiddling while still retaining at least some of the safety checks of normal Rust code. Even unsafe Rust is safer than C.This is an important point. `unsafe` blocks only let you do a few extra operations[1], not anything you want. A lot of safety checks still happen inside of unsafe blocks.
1: http://static.rust-lang.org/doc/master/rust.html#behavior-co...
[1]: http://doc.rust-lang.org/master/rust.html#behavior-considere...
Consider, in a "type safe" law system, intent doesn't matter. Only what you did. Now, look at the laws that run on that principle.
Now, I personally think this is probably orthogonal to type safe programs. But I'm not completely convinced, yet. Type safe programming seems hamstrung by the fact that a type system only really protects that which is specified in the type system. Which seems to mean you can't easily have a variety of ways to do things, as ultimately the type system has to grow to encompass all of the system.
Now, I grant I'm probably just soured by some bad systems in the past where a change to one part required a rework of the entire system.
Also, IME, type safe languages don't hobble me as a programmer. However, the systems and things I work on (and am trying to get work on) have generally well considered specs associated with them. Be it radio protocols, file formats, or whatever. A type safe language (haskell, sml, ocaml, ada, rust (it seems, not explored it much yet), etc.) can really help with these projects. Instead of needing a dictionary translating what magic # 134 means if it's used in this context (god, these old fortran programs break me), we can actually specify things in code in sane, clear ways that map from spec/design to code cleanly. OO, in theory, can help us with this, but it also adds a lot of overhead to create a ton of classes when really we want integers that the compiler knows some are meant to be temperature and some are meant to be pressure. If you start adding temperature and pressure, it flags it. If there's some formula where that actually makes sense, you deliberately, intentionally, explicitly handle the conversion. This is a good thing. Slightly more verbose code, but such a boon for mainenance and v&v work.
> Freedom should be achieved in different ways. Please don't make freedom and security contradictions.
In an ideal world, they wouldn't be. Unfortunately that's not how it is in reality.
This guy wants to intentionally leave software exploitable, ready to be unknowingly hacked by criminals or governments, and call it freedom. And he gets upvoted for it!
Also, it seems that "criminals" are the new "terrorists".
Available information indicates that NSA used various coercion tactics to ensure cooperation from various companies and that it has the methods to ensure hardware modifications in its own interests.
So the damage to NSA from improving security too much is less than damage to my ability to use the computing device I have paid for as an actual computing device.
Of course we should also consider smaller threats.
But the better the platform is locked down, the less limitations there ae for advertiser-friendly platform design, which makes people expect a lot of permissions requested by applications, so phishing and trojans become easier.
The problem here is about the effects of scale: it is hard to produce just a few thousands phones with good specs.