Live data from Hacker News

Fil-C: Garbage In, Memory Safety Out [video]

youtube.com

101–110 of 190 posts

Re: Fil-C: Garbage In, Memory Safety Out [video]

#101

Earlier quoted context omitted.

Not the parent, but: I strongly dislike this framing of "Fil-C is better than Rust" or "Rust is better than Fil-C". This is apples-to-oranges; users will almost never be comparison-shopping between the two because they address almost entirely different problems. There are roughly two categories of Rust user: 1. People who are using Rust for application development. Most of these users write zero unsafe blocks in thei…

I’ve never said that Fil-C is better than Rust full stop . I have articulated the specific ways that Fil-C is better. And I’ve articulated the specific ways that Rust is better. You’ve enumerated some of those reasons from your perspective, though I disagree on the details. I like those kinds of conversations. We shouldn’t shy away from them as a community. They help us grow a shared understanding of the tech

Let's not shy away then. What details do you disagree on?

P.S. Also fan of your work. Competition is always good.

Re: Fil-C: Garbage In, Memory Safety Out [video]

#102

Earlier quoted context omitted.

Every one of these posts is the same. There's this weird blindness to the problems and imperfections in Fil-C --- just shouting down. It reduces my confidence in Fil-C as a whole. Rust, for all its faults, at least engages with its critics. I've long faulted Rust's use of Result over exceptions, for example, but the maintainers at least acknowledge that other options exist and each has trade-offs. Not Pizlo and his f…

If you think you like Fil-C but aren’t able to see the specific way in which it’s better than Rust (more comprehensive safety), then what is it that you’re liking?

It provides a way to improve the safety of existing code without rewriting it. It would be nice if it could solve the memory safety issues around data races too.

Re: Fil-C: Garbage In, Memory Safety Out [video]

#103
post #39

Earlier quoted context omitted.

Fil-C has access to a memory safe API called mmap with a lot of the capabilities of the mmap system call, while Rust's safe subset does not. Rust allows you to use the mmap system call unsafely, while Fil-C does not. I feel these are both big advantages for Fil-C. You'll never have to audit a Fil-C codebase to determine whether its calls to mmap are memory safe, or indeed any other calls to any API or dependency, eve…

How is Fil-C’s wrapper approach different from someone (not necessarily the Rust stdlib) implementing a safe wrapper around a particular syscall? mmap is a bit of an outlier because it is not possible to implement a fully featured safe wrapper (MAP_SHARED) in Rust. So I would be curious to see what safety guarantees Fil-C claims to provide for mmap.

mmap is a great example of Fil-C providing a unique level of safety.

You can’t use mmap in a way that corrupts memory in Fil-C

Try it. :-)

Re: Fil-C: Garbage In, Memory Safety Out [video]

#104

Earlier quoted context omitted.

Yeah what I said is true of TS and C#, but not of Go. Go’s situation is nuanced since a lot of Go code does rely on unsafe C or C++ deps, but I have no idea how generally true that is. Also Go’s protections fall apart under certain races, which isn’t true in Fil-C.

Races in Fil-C allow access to one object through a pointer to a different object if there's an attacker-controlled offset involved. Fil-C's safety guarantees therefore fail to apply in this situation.

Nonsense.

In a race, you at worst access an object you could have loaded from whatever field you were racing on.

In Go, you can bypass all protections and corrupt all of memory if you race on structs (I think).

Re: Fil-C: Garbage In, Memory Safety Out [video]

#105
post #76

Earlier quoted context omitted.

I think you should watch the linked presentation, it will show how it is "safer" than rust. Unfortunately there are performance implications, but fil-c seems fast enough to go into production for many workloads and surprisingly needs very little code changes to existing C/C++ projects which is a huge benefit.

I think Fil-C might make a lot of sense for running legacy C or C++ codebases. But for new code, it seems like it’s trying to compete with other GC languages. Take away C’s performance advantages and I don’t know why anyone would use it. Fil-C: Combining the ergonomics of C with the performance of Python!

Fil-C is much faster than Python

And it’s fun to write new code in.

Re: Fil-C: Garbage In, Memory Safety Out [video]

#106

Earlier quoted context omitted.

Races in Fil-C allow access to one object through a pointer to a different object if there's an attacker-controlled offset involved. Fil-C's safety guarantees therefore fail to apply in this situation.

Nonsense. In a race, you at worst access an object you could have loaded from whatever field you were racing on. In Go, you can bypass all protections and corrupt all of memory if you race on structs (I think).

> In a race, you at worst access an object you could have loaded from whatever field you were racing on.

Suppose a pointer ptr is initialized to foo and transitions once to bar; suppose also that x is attacker-controlled. Then,

  T1: T* p = ptr; if (p == bar) p[x] = 7
  T2: ptr = bar
A program can observe p == bar (testing the address bits) but still permit a write to foo through p (allowed by the stale capability bits after offset by attacker-controlled x), allowing T1 to perform an unexpected mutation of foo.

No, you do not always trap in this scenario, as you've claimed repeatedly on X. You perform the capability check after combining p and x. If an attacker sets x == foo - bar, then p[x] refers to memory inside foo even if p == bar.

Because (for understandable reasons) you don't insert a memory barrier between a write of a pointer's address bits and its capabilities, use two-word atomic accesses, STM, or in any other way synchronize writes to pointer addresses and capabilities, programs with data races can observe arbitrary combinations of linear addresses and capabilities that go along with them.

Plenty of exploit chains have had humbler beginnings.

This access-foo-through-pointer-to-bar scenario can't happen in Java. It can't happen in CHERI. It can happen in Fil-C. Yes, T1 at one time had a capability on foo, but the programmer intent is clearly to mutate only bar, and Fil-C allows an execution that mutates foo instead.

Elsewhere, you've claimed such executions cannot be exploited. I am skeptical of this claim given previous exploits that began by the camel poking its nose through similarly innocuous-seeming holes in the tent.

Fil-C cannot fully protect C programs from exploitable memory corruption caused by violations of the C virtual machine. 99.9% of practical ones? Sure! Fil-C is good stuff. But there are holes (not only here, but for arenas, intra-object corruption, etc.), and these are holes that safe Rust prevents. Fil-C and Rust rules prohibit different (but mostly overlapping) classes of exploit.

Could you define Fil-C's behavior as "memory safety"? Sure. You can define words to mean anything. You cannot, however, define Fil-C as something that just deletes the security implications of bugs in existing C programs. Does it mostly achieve this goal? Sure. Does it supply comprehensive coverage? No! It's a hardening tool, not a panacea, and it would behoove you to represent it as the useful tool it is, not magic pixie dust that makes C safe.

Please stop ruining a tool as good as Fil-C by claiming it does things it does not and cannot.

> In Go, you can bypass all protections and corrupt all of memory if you race on structs (I think).

This is my understanding as well. I'm glad we agree, opinions on Fil-C memory model counting as "safe" aside, that Go is awful.

Re: Fil-C: Garbage In, Memory Safety Out [video]

#107

Earlier quoted context omitted.

I’ve never said that Fil-C is better than Rust full stop . I have articulated the specific ways that Fil-C is better. And I’ve articulated the specific ways that Rust is better. You’ve enumerated some of those reasons from your perspective, though I disagree on the details. I like those kinds of conversations. We shouldn’t shy away from them as a community. They help us grow a shared understanding of the tech

Let's not shy away then. What details do you disagree on? P.S. Also fan of your work. Competition is always good.

Rereading your post, I think I just disagree on two things:

I don’t think Rust users can be trivialized into the “two kinds” that you list, and if one of the kinds is “app developer” then I bet you there are apps where Fil-C’s value proposition is exactly right, except just the fact that Fil-C is so new and immature. Say you want to ship a native UI. Using GTK from fil-C is fantastic.

And I specifically disagree with:

> it does not free the developer from the difficulty of having to manually write memory-safe C code; their program will just crash if they get it wrong.

When I write new code in Fil-C, I just lean into the GC all the way, which makes programming in C and C++ so much nicer. I don’t ref count, I don’t use smart pointers, I don’t free and I don’t delete. It makes these languages so much nicer!

Also, Fil-C’s guarantee that it will panic on OOB or if a race goes badly means I spend basically zero time debugging memory safety issues. The reliability of the failures totally changes the dev experience for the better.

That’s subjective obviously. Some folks swear by type systems like Rust’s to catch as many issues as possible. That’s just not how I roll.

All of that said - the reason to use rust and not Fil-C is performance and memory usage. Fil-C isn’t there yet, except for maybe a small handful of cases (like BLAKE3 and xzutils, where the overhead is basically zero for some reason … we’ll probably because I did a lot of compiler opts and sometimes you get lucky and they sort of all hit)

Re: Fil-C: Garbage In, Memory Safety Out [video]

#108

Earlier quoted context omitted.

Let's not shy away then. What details do you disagree on? P.S. Also fan of your work. Competition is always good.

Rereading your post, I think I just disagree on two things: I don’t think Rust users can be trivialized into the “two kinds” that you list, and if one of the kinds is “app developer” then I bet you there are apps where Fil-C’s value proposition is exactly right, except just the fact that Fil-C is so new and immature. Say you want to ship a native UI. Using GTK from fil-C is fantastic. And I specifically disagree with…

> Also, Fil-C’s guarantee that it will panic on OOB or if a race goes badly

Fil-C as currently implemented does not guarantee panics on unsafe accesses due to races. You dodge the problem by using a private definition of safety under data race that permits program executions nobody would expect.

Re: Fil-C: Garbage In, Memory Safety Out [video]

#109

Earlier quoted context omitted.

Rereading your post, I think I just disagree on two things: I don’t think Rust users can be trivialized into the “two kinds” that you list, and if one of the kinds is “app developer” then I bet you there are apps where Fil-C’s value proposition is exactly right, except just the fact that Fil-C is so new and immature. Say you want to ship a native UI. Using GTK from fil-C is fantastic. And I specifically disagree with…

> Also, Fil-C’s guarantee that it will panic on OOB or if a race goes badly Fil-C as currently implemented does not guarantee panics on unsafe accesses due to races. You dodge the problem by using a private definition of safety under data race that permits program executions nobody would expect.

I define memory safety in terms of capabilities, which is a mainstream definition.

The worst that can happen in a race is that you read or write an object that would have been accessible even in the absence of races.

The thing that makes races hard to debug in C or C++ is memory corruption; that doesn’t happen in Fil-C

Re: Fil-C: Garbage In, Memory Safety Out [video]

#110

Earlier quoted context omitted.

Nonsense. In a race, you at worst access an object you could have loaded from whatever field you were racing on. In Go, you can bypass all protections and corrupt all of memory if you race on structs (I think).

> In a race, you at worst access an object you could have loaded from whatever field you were racing on. Suppose a pointer ptr is initialized to foo and transitions once to bar; suppose also that x is attacker-controlled. Then, T1: T* p = ptr; if (p == bar) p[x] = 7 T2: ptr = bar A program can observe p == bar (testing the address bits) but still permit a write to foo through p (allowed by the stale capability bits a…

The “bug” in your example hinges on this:

> if (p == bar)

It is not in scope of memory safety to make sure that logic not related to memory accesses works as you expected.

In Fil-C, the integer pointer value (the intval) is not trusted. You could get it wrong with things more sexy than races (integer overflows or just plain bad math). Fil-C just guarantees that your accesses obey the capability model, which is true in your example - the only object the program can access is whatever object the capability you loaded points to.

You’re being disingenuously imprecise when you use this framing:

> access-foo-through-pointer-to-bar

In fact, you can only access foo if bar’s capability referred to foo, and that can only happen if the thing being raced on (the pointer in shared memory) had a prior store to it that had foo’s capability.

Hence, this isn’t an arbitrary memory access. This is a memory access that obeys the capability model. It’s a memory access that would have been possible even if the program had no race.

> Please stop ruining a tool as good as Fil-C by claiming it does things it does not and cannot.

You are mischaracterizing the issue to make it seem like it’s a memory safety issue, when it’s not. I think that is doing more damage than anything I have said

Post reply on HN