3 ms·
> Patching around them is a game of whack-a-mole. C++ cannot fix Posix. Rust cannot fix Posix. Rust cannot “fix Posix”, but the stdlib (and others) can definit
by littlestymaar 5y ago
> Patching around them is a game of whack-a-mole. C++ cannot fix Posix. Rust cannot fix Posix.
Rust cannot “fix Posix”, but the stdlib (and others) can definitely work around its quirks. See how this[1] library sidesteps a thread-safety issue when using localtime_r(3).
https://github.com/x-hgg-x/tz-rs https://github.com/x-hgg-x/tz-rs
- ncmncm 5y agoIt is sometimes possible to work around "quirks", particularly when no malice is intended. When it is a question of security, and fending off attackers, the most obvious fix is rarely any kind of fix at all. Attackers can see what you did, and simply step around it. Bragging about how you put in your broken fix and somebody else didn't tends to attract what may be unwelcome attention.
- tialaramex 5y ago> Bragging about how you put in your broken fix and somebody else didn't tends to attract what may be unwelcome attention. The specific thing being fixed here was a TOCTOU race and thus the fix is just to hold on to the thing being checked so you can use the same thing and eliminate the race. Well, of course I say "just" but it was a lot of work.
- littlestymaar 5y agoYou obviously have no idea what you're talking about. There is no attacker involved in this discussion: the entire purpose of Rust is to prevent the user to use a dangerous method without opting into unsafe. If The user opt into unsafe, there maybe a way for an attacker to exploit a user's mistake, but as long as the user doesn't they'll be safe, because what Rust does is forbidding the user to shoot themselves in the foot.