News for hackers. Stuff that matters.
Re:F’: Flight Software and Embedded Systems Framework by zeristor on Friday February 19, 2021 @07:13PM (#26199839)
How long before Rust will be mature enough for the task?
Re:F’: Flight Software and Embedded Systems Framework by mhh__ on Friday February 19, 2021 @08:18PM (#26200406)
Keep in mind that for this kind of project you want static analysis and formal verification (model checking for example) rather than just day-to-day safety features.

I.e. the Rust this, Rust that spam is a little naive to the task at hand, even though it would be a step up from C

Re:F’: Flight Software and Embedded Systems Framework by OnlyOneCannolo on Friday February 19, 2021 @08:53PM (#26200687)
NASA even has their own sound static analyzer for memory safety. If you use something like that, and depending on the context, there isn't even necessarily a memory safety advantage to using Rust over C or C++.

https://github.com/NASA-SW-VnV/ikos

Re:F’: Flight Software and Embedded Systems Framework by gregors on Friday February 19, 2021 @09:24PM (#26200891)
It was my understanding that when formal methods were used, they were used on very small subsets of code and not used in general. I do wonder about TLA+ and would love to hear more about how they use such tools.

I know I've seen an older document that specifically prohibited use of malloc that the risk was too great. Is that still the case?

Re:F’: Flight Software and Embedded Systems Framework by mhh__ on Friday February 19, 2021 @09:31PM (#26200933)
Formal methods are indeed hard. They generally thrive on hardware, software is a wholly different kettle of fish in terms of the size of the problem (the actual methods are often similar, but hardware design generally encourages certain patterns that are easier to analyse)

I'm not related to this project or aerospace, so I can't divine more knowledge than anyone else, although I have seen many coding standards that forbid malloc after some critical time (e.g. no dynamic memory allocation after the plane is off the ground)

Re:F’: Flight Software and Embedded Systems Framework by pensono on Friday February 19, 2021 @08:51PM (#26200667)
Is C++ complex enough that it is difficult to model, and therefore hard to apply in formal methods?
Re:F’: Flight Software and Embedded Systems Framework by rurban on Saturday February 20, 2021 @12:04AM (#26201746)
The problem is not the language, the problem are unbounded loops. Like linked lists vs vectors. Termination is theoretically impossible to prove, but practically you can handle it.

Parts of the STL were formally verified. cprover (with satabs and cbmc) can handle C, C++ or Java. F' uses autogenerated classes, which helps a lot avoiding mistakes.

Re:F’: Flight Software and Embedded Systems Framework by gugagore on Saturday February 20, 2021 @10:02AM (#26204560)
Because the problem is unsolvable, there is a wide variety of "you can handle it"-ness that a language can have...
Re:F’: Flight Software and Embedded Systems Framework by pjmlp on Saturday February 20, 2021 @04:40AM (#26202947)
Case in point, while it is nice that Microsoft is now playing with Rust, it is quite far away from offering this to Windows developers, https://microsoft.github.io/microsoft-ui-xaml

Advocacy should always be tempered with a bit of hard reality check, otherwise one just ends up scaring possible adopters away.

Re:F’: Flight Software and Embedded Systems Framework by billfruit on Saturday February 20, 2021 @09:34AM (#26204343)
Yes, but C is one of the languages with the very low amounts of inherent safety. So using a language/tooling that will be offering stricter possibilities of validations of behaviour/more safeguards against unsafe behaviour would likely catch a lot more bugs earlier when they are easier and cheaper to fix.
Re:F’: Flight Software and Embedded Systems Framework by foobar33333 on Friday February 19, 2021 @07:43PM (#26200132)
Probably once people have decades of experience with it and know every single trap or quirk perfectly.

Rust almost certainly could do the job now but stakes are so high no one would take that risk when its proven that C can do it and with enough auditing and conservatism, it can be done pretty safely.

Re:F’: Flight Software and Embedded Systems Framework by bri3d on Friday February 19, 2021 @08:32PM (#26200521)
I don't think the barrier is _people_ knowing the traps, as people are always fallible and any system relying on them knowing the "traps and quirks" is fundamentally pointless. I do think the barrier is, rather, _tools_ knowing the traps. Most systems in this class, FPrime included, rely extensively on code generation and model-to-code auditing, which, while usually not formally proven (unfortunately), is battle-tested.

Now, these sorts of systems should actually be _easier_, in the long-term, to build in Rust, since the type system can enable a class of proof which simply was not historically possible, but for the time being, the tooling doesn't exist yet.

Re:F’: Flight Software and Embedded Systems Framework by gregors on Friday February 19, 2021 @09:42PM (#26200998)
Here's a pretty interesting read regarding Lisp at JPL. http://www.flownet.com/gat/jpl-lisp.html

I think the "safety" of "familiarity" vs pushing the envelope of what we can do technically are different things. We used to build brand new computers and operating systems from scratch specifically for these types of things.

The risks are indeed high for managerial staff. I worked at a large quasi-government place. "you won't ever get fired for using Microsoft, Oracle, etc" was a tagline we heard often in non-critical systems, so I imagine there would need to be some major technical reason to switch.

Now drones on the other hand... https://en.wikipedia.org/wiki/Iran%E2%80%93U.S._RQ-170_incid...

Re:F’: Flight Software and Embedded Systems Framework by cat199 on Friday February 19, 2021 @09:24PM (#26200894)
> Probably once people have decades of experience with it and know every single trap or quirk perfectly.

people were writing mission-critical C++ when C++ was new / only a few years old; with this in mind, rust is probably good to go with sufficient application/system testing

that said, since C++ & associated tooling exists, there is more of an opportunity cost since, in the context of today, there are more alternatives that could be considered

Re:F’: Flight Software and Embedded Systems Framework by carlmr on Saturday February 20, 2021 @03:16AM (#26202533)
I think this is spot on. The tooling is there for C++, but human mistakes are much more prevalent, and the discipline to apply the tooling is not a given.

There should be an industry push for certified Rust tooling, it would save the aerospace and auto industry billions. Or you could use the unsexy but also very good ADA 2012, which is already certified.

Re:F’: Flight Software and Embedded Systems Framework by pjmlp on Saturday February 20, 2021 @04:42AM (#26202960)
This is one of the reasons why NVidia went with Ada/SPARK for their security critical firmware project.
Re:F’: Flight Software and Embedded Systems Framework by sterlind on Saturday February 20, 2021 @05:57AM (#26203249)
iirc, SPARK has proof capabilities that outstrip the memory-safety guarantees of Rust. basically design by contract, where you can check loop invariants and statically verify complex preconditions and postconditions.

I suppose the workflow would be to flesh out and check the abstract design in something like Coq or (maybe) TLAPS, generate a refinement into the SPARK code contracts, then implement the functions. Since the toolchains are verified there shouldn't be much surface area for bugs left.

Re:F’: Flight Software and Embedded Systems Framework by pjmlp on Saturday February 20, 2021 @06:09AM (#26203303)
Yep, here some very good books about it, specially relevant given the main subject.

"Building High Integrity Applications with SPARK"

https://www.amazon.com/Building-High-Integrity-Applications-...

"Building Parallel, Embedded, and Real-Time Applications with Ada"

https://www.amazon.com/Building-Parallel-Embedded-Real-Time-...

"Embedded Software Development for Safety-Critical Systems"

https://www.amazon.com/Embedded-Software-Development-Safety-...

Re:F’: Flight Software and Embedded Systems Framework by otabdeveloper4 on Saturday February 20, 2021 @01:18AM (#26202090)
Use-after-free is

a) probably the least important class of bugs for this sort of thing

b) adequately solved with the existing C++ language features anyways.

So what would be the point of rewriting in Rust?

(Assume the people writing it aready have the C++ knowledge and tooling ready.)

Re:F’: Flight Software and Embedded Systems Framework by pjmlp on Saturday February 20, 2021 @04:47AM (#26202975)
c) assuming they have ISO C++ minutiae level of language understanding,

https://herbsutter.com/2020/02/17/move-simply/

Re:F’: Flight Software and Embedded Systems Framework by hctaw on Saturday February 20, 2021 @01:36AM (#26202143)
What about iterator invalidation or multiple mutable aliasing in concurrent code
Re:F’: Flight Software and Embedded Systems Framework by otabdeveloper4 on Saturday February 20, 2021 @08:45AM (#26204039)
Iterator invalidation is a kind of use-after-free.

Mutating aliased objects is, of course, usually the desired outcome and not a bug. It becomes a bug when your program's concurrency logic is not thought through, and there are no easy solutions here.

Re:F’: Flight Software and Embedded Systems Framework by bobthebuilders on Friday February 19, 2021 @07:56PM (#26200231)
Never. Rust will never be good enough to replace C.
Re:F’: Flight Software and Embedded Systems Framework by kamranjon on Friday February 19, 2021 @08:00PM (#26200264)
this is c++