3 comments

  • andai1 hour ago
    Why isn&#x27;t fil-C ABI compatible with C?<p><a href="https:&#x2F;&#x2F;fil-c.org&#x2F;runtime" rel="nofollow">https:&#x2F;&#x2F;fil-c.org&#x2F;runtime</a><p>Apparently this was done intentionally. The rationale given is that we don&#x27;t want to allow non-safe C to be used in fil-C programs. Fair enough.<p>But why should we prevent fil-C programs to be used from Rust (or C, for that matter)?<p>I don&#x27;t understand much about compilers, but I guess allowing one would also allow the other? i.e. it&#x27;s not possible to make fil-C ABI compatible with C (so that it can be more easily called), while also not letting you use call C from it?
    • ameliaquining1 hour ago
      You&#x27;re looking too much at the complete memory safety goal; the important part here is the interop non-goal. Designing a foreign function interface between Fil-C and regular C, in a way that upholds both languages&#x27; expectations about the environment the code&#x27;s running in, is a very difficult problem and nobody seems to have much of an idea of how such a thing could work.<p>I worry that this same problem will doom the extern &quot;Fil-C&quot; idea that this post advocates. Zig is not really an encouraging precedent because Zig&#x27;s proposed memory-safe mode adds runtime checks to everything just like Fil-C does, whereas the post author wants to avoid those checks for Rust code that&#x27;s already statically known to be memory-safe. That said, it&#x27;s possible I&#x27;m missing something.
    • Georgelemental1 hour ago
      It&#x27;s also because Fil-C calls need to carry along a bunch of extra information, to support the safety checks
      • sheepscreek1 hour ago
        Yes and AFAIK any fil-C program needs to be linked against fil-C compiled libraries, such as libc&#x2F;musl&#x2F;etc. I too would like to know what other challenges exist in making this process more automated.
      • pizlonator57 minutes ago
        Correct
  • pornel1 hour ago
    There is a solution that Mozilla uses in prod for legacy C codecs:<p><a href="https:&#x2F;&#x2F;rlbox.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rlbox.dev&#x2F;</a><p>It&#x27;s not a replacement for Fil-C&#x27;s role as a precise ASAN&#x2F;Valgrind, but it works great if you want to call a C library without letting it freely spray caller&#x27;s memory.
    • pizlonator58 minutes ago
      Yeah rlbox is great.<p>Fil-C is more precise than valgrind or asan. Valgrind and asan will allow a buggy access (like an OOB) to succeed if the resulting address is valid at all - which is useless from a security enforcement perspective since clobbering valid addresses is what the attacker is trying to do.<p>Fil-C only allows an access to succeed if it’s in bounds of that pointer’s capability. That is a useful level of precision for security, since it prevents the attacker from clobbering the addresses of their choice.
  • Wleddzig1 hour ago
    [flagged]
    • ameliaquining1 hour ago
      Can you please link to specific false statements and explain why they&#x27;re false?