all 11 comments

sorted by: hot top controversial new old
[–] 39 points 10 months ago

Bad code is bad code. We'll see more of this as rust is implemented into core software.

  • source
  • [–] 43 points 10 months ago* (last edited 10 months ago) (7 children)

    Wait, is rust supposed to have intrinsic race condition protection? I thought its big feature was figuring out freeing memory for the dev instead of relying on runtime solutions or manual instructions... If it's not supposed to magically fix possible race conditions, I don't know how this issue is the language's fault.

  • source
  • hideshow 7 child comments
  • [–] 84 points 10 months ago (2 children)

    It’s not. It’s literally code in an unsafe block. The OP is either trolling or actually ignorant.

  • source
  • parent
  • hideshow 2 child comments
  • [+] [S] -26 points 10 months ago (1 child)

    https://doc.rust-lang.org/nomicon/races.html

    Safe Rust guarantees an absence of data races

    I know that it was unsafe block in this CVE, but the irony of the situation is funny.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 64 points 10 months ago

    Not only unironic but explained in the doc you referenced:

    “However Rust does not prevent general race conditions.

    This is mathematically impossible in situations where you do not control the scheduler, which is true for the normal OS environment.”

  • source
  • parent
  • [–] 5 points 10 months ago (3 children)

    It is, in large part. The rules on ownership and borrowing mean that it is not supposed to be possible to change memory that something else can be concurrently reading from. That means you are forced to obtain references through protective mechanisms, which should protect from race conditions.

    All of that can go out of the window if you use unsafe.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 6 points 10 months ago (2 children)

    Note how the ticket cited is in an unsafe block, because it uses the OS scheduler, not its own. It is not Rust's fault.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 10 months ago

    Rust doesn't have a scheduler.
    The issue is the false assumption, that the remove operation can safely be done without taking a lock. This can be done in some specific data structures using atomic operations, but here the solution was to just take the lock. The same thing could have happened in a C code base but without the unsafe block indicating where to look for the bug.

  • source
  • parent
  • [–] 3 points 10 months ago

    Yeah, I'm not saying it's rust's fault. Restricting this to unsafe makes it a lot easier to reason about where such problems can occur.

    I just don't think anyone should give the impression that rust's memory safety is not about race conditions.

  • source
  • parent
  • [–] 7 points 10 months ago
    [–] 6 points 10 months ago

    The point is weak but I'm upvoting for the meme usage.

  • source
  • 4 comments in c/programmerhumor@lemmy.ml view that post
    [–] 27 points 10 months ago (3 children)

    If this is a real headline then the author is either incompetent regarding code and the complexity of big projects or very competent in regards to marketing and making ragebait headlines. Either of the two.

  • source
  • hideshow 3 child comments
  • [–] 10 points 10 months ago*

    It's not even about the size or complexity of the project - the code in question is wrapped in an unsafe{} block, so no one should be expecting it to have the guarantees you'd normally get from rust. It's ragebait.

  • source
  • parent
  • [–] 6 points 10 months ago (1 child)

    The headline is based on the classic Onion headline / News In Brief article used after every new mass shooting in America

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 10 months ago

    The original headline is "'No Way to Prevent This' says only country where this regularly happens". If you look closely at OP's meme, you can actually see the font changes after the "only" (baseline is slightly lower; uses lighter color; kerning of eve in "Prevent" is completely different )

    But yeah shit take anyway, just because the US is famous for shootings doesn't mean that it's any more dangerous than other country

  • source
  • parent