Better HN
topnewbestaskshowjobs
Log inSign up

_urga

1 karma · joined Dec 26, 2025 (11mo ago) · 1,106 submissions

Submissions

comment 6y ago · link · parent

The way to look at it is as a cheap instant filter, something like a bloom filter, that can protect the more expensive tests that take longer.

Your example assumes there's no hierarchy of available tests, and that this test is the only test there is.

What would really happen is those 6 false positives would be referred for a more accurate test. They might miss a day of school but not a week.

At the same time, your more accurate testing pipeline can now speed up thanks to Little's law. There's dramatically less pressure on the system and less backlog, so you have a second order effect that the more expensive slower tests also become cheaper and quicker.

But even if we gloss over all that, and we're only concerned about false positive rate, then this is still much better than no school at all, as in hard lockdown, which has a 100% false positive rate.

Finally, there's the lives saved because of earlier rapid detection and isolation, with corresponding relief for the health care system, leading to increased quality of care and resources available for more severe cases... and so on and so on.

A bloom filter can do wonders for a system, and if this test works it should do the same.

comment 6y ago · link · parent

Chaos engineering is brilliant for improving the resilience, safety and availability of a system, but I'm not sure it would help improve the security of a system to the degree that the author describes, i.e. to prevent the SoftLayer firmware hack.

We need more knowledge, more education, more auditing, more communication, and this across all levels of the stack. If we use abstraction, perhaps we need to recognize that abstraction does not absolve us of the responsibility for auditing the implementation, and that abstraction has not only value but also cost.

To make this easier across so many dimensions, we probably want to simplify our stacks and minimize our dependencies and supply chains far more drastically than we do.

There's also a cost to all this understanding, and it comes down to what the business values. Security or velocity. But perhaps you can get both, especially as you design for simpler systems.

comment 6y ago · link · parent

"Another example would be the hack of SoftLayer. Hackers modified the firmware on the BMC from a bare metal host the cloud provider was offering. This shows another mistake in having blinders on and not being conscious of the other layers of the stack and the entire system."

Does anyone know whether dedicated hosting companies such as Hetzner or xneelo reflash the firmware on server boards (and disks and everything with firmware in it) before they rent it out again?

And whether they use more forceful hardware techniques to do the reflashing, and not software to politely ask the firmware to reflash itself?

I would hope they would but I can't find any security policy showing they do, or how.

comment 6y ago · link · parent

No, the TCP_NODELAY setsockopt is not exposed by the browser.

If you only control the client then you could make your http/fetch requests as big as possible, i.e. do the Nagle algorithm yourself but at a higher level to avoid the delays, but I don't think there's not much else you can do.

Then again, if you control the server you could just run HTTP/3 to be on QUIC and then you're not on TCP any more, you would also save alot of connection handshake latency and benefit from advances in bufferbloat-sensitive congestion control algorithms much quicker.

To be fair, I would be more concerned about bufferbloat delays on small shared networks than delays due to Nagle's algorithm. Bufferbloat delays can be up to tens of seconds, and you can trigger them disturbingly easily, just have someone else in the office upload a large attachment to an email in Gmail's web client to saturate the router's send buffer, while you watch your ping times.

comment 6y ago · link · parent

If your library is already merging buffers and preventing small writes then you would still want to set TCP_NODELAY, to eliminate delays due to send/send/recv patterns where merged buffers are less than the MSS... because you know for sure that you're already doing all you can, and Nagle's algorithm can't help further except introduce delay.

comment 6y ago · link · parent

I was dealing with "Nagle's delay" only yesterday, adding "setsockopt(TCP_NODELAY)" for the alpha version of a new high-performance payments database called TigerBeetle: https://github.com/coilhq/tiger-beetle

comment 6y ago · link · parent

Sure, but the buffer cache is also part of the memory hierarchy. At every level, it's always good not to go wild with cache misses. Not that that's what you're proposing of course.

comment 6y ago · link · parent

"It is well suited for OS and driver dev though"

Rust is brilliant, but for drivers, I would go for a language with OOM safety and strict static allocation, especially for embedded environments.

comment 6y ago · link · parent

I'm with you on the mental model, but from a hardware point of view what you also don't want is hundreds of random disk seeks. I know we're almost in an SSD-only world but HDDs are still a thing and large sequential reads are always important at any level of the memory hierarchy.

comment 6y ago · link · parent

I wrote something similar but for the ZIP format, called Pure, to detect hidden buffer bleeds outside and between and within structures, amongst other anomalies. It's also amazing what you can do with a ZIP file.

Pure: https://github.com/ronomon/pure

The goal of Pure is to reduce the attack surface available for zero-days by doing the simple yet critical buffer bounds checks that most end-user application software will not, and to do this for more and more popular file formats.

The vision is that one day you can deploy Pure at your email server and get much stronger guarantees on the safety of email attachments that you open... as well as on the attachments you send out... for example that your billing software is not leaking the contents of sensitive server memory into XLSX reports that you are mass mailing to clients (Pure actually found two cases of prominent investment firms that were doing just this).

It's like type checking or linting but for everyday file formats.

comment 6y ago · link · parent

Thanks for writing this.

comment 6y ago · link · parent

"Put another way: Most of us enjoy the mental stimulation of programming, and we enjoy the mental challenges (in general). C makes us feel clever. Witness the "obfuscated C programming contest" etc."

Yep, only C makes me feel stupid (but I enjoy that experience too!).

comment 6y ago · link · parent

The first rule of C is that no one masters C, but you could try anyway and still have time to master Zig in a matter of weeks, which is a rounding error. Given that both offer a C compatible ABI, what would serve your projects better?

44.

Interview with Zig language creator Andrew Kelley [video](youtube.com ↗)

200 points · by _urga · 6y ago · 203 comments

comment 6y ago · link · parent

"Anybody can build a good chair for $10,000 or a good PC for $100,000."

And some people can build a great PC for $1,000 that runs circles around the good PC for $100,000.

There's so much more to engineering than thinking in terms of time and cost constraints. Those are real constraints, but they're not the most important.

Engineering is design. If you have good design, good insight, you can do things that people with infinite time and budget could never dream to achieve. You can start making a product that's a hundred times more powerful for a tenth of the price in a fraction of the time. If you don't have good design, good insight, then no amount of time or budget can help you.

comment 6y ago · link · parent

"optimize like a Vulcan"... classic!

comment 6y ago · link · parent

Rule 1 and 2 depend on context, whether you're working on an existing program or a new program. They can be true or false. They can really help or they can really hurt. Are you going into an existing system to do performance optimization? Sure, don't guess, measure. Are you designing a new system? Throw out those parroted premature optimization mantras... you are responsible for designing for performance upfront. You will always measure but depending on context you will design for speed first and then test your prototype with measurements. There's no way around an initial hypothesis when you're designing new systems. You have to start somewhere. That's where Jeff Dean's rule always to do back of the envelope guesses will pay off in orders of magnitude, many times over.

Rule 3 and 4 are gold and always true.

Rule 5 is the key to good design.

comment 6y ago · link · parent

Yep... there are ways to make it happen.

comment 6y ago · link · parent

Sure, and I don't disagree that uid might need to change at runtime, but here we're talking about a struct field being const.

comment 6y ago · link · parent

Something as important as "uid" should be "const".

comment 6y ago · link · parent

Play chess, and do physical exercise.

Both will develop your mental stamina, and chess especially will hone your adversarial thinking.

You may even find that your chess fitness is directly comparable to your programming fitness and vice-versa. When you're programming fit through working on some incredibly hard problems in the week (think distributed systems or file systems or algorithms), then your chess will show an improvement. And when you're playing several hours of chess a day against a good opponent, then your programming will likewise benefit and your bug count drop as you naturally start thinking further ahead.

comment 6y ago · link · parent

Thanks for the excellent example of the TLS Selfie attack.

Having worked on protocols, I have found again and again that making the context explicit by cryptographically binding intent to the message is paramount.

comment 6y ago · link · parent

Where things get interesting is the mismatch between Big-O data structure complexity analysis (as typically discussed in interviews) and actually knowing about the hardware, the operating system, the memory hierarchy and things like cost of context switches and cache misses.

Some real-life practical examples: knowing when a simple O(n) linear search beats O(log n) binary search, or knowing when a multiple substring search algorithm based on a simple Rabin-Karp and L1 cached hash table lookup will outperform the theoretically more optimal Aho-Corasick.

comment 6y ago · link · parent

The backstory:

Somewhere between an HN thread on July 4 2019 (https://news.ycombinator.com/item?id=20352439) and David Fifield's generous references to @ronomon/zip on his website and in his "A better zip bomb" paper, I received an email from Maxim Vainstein, an R&D Lead at Microsoft and the head of their Product Release and Security team, asking me to port @ronomon/zip from JavaScript to C, so they could use it as a static analysis tool to scan all software released by Microsoft.

Microsoft were happy for me to licence the work under the MIT licence and so @ronomon/pure was released today. I have only a few years experience in C, and am confident there will be some fairly embarrassing flaws in the code, please let me know what you think. I am also considering a port to Zig as a safer, simpler implementation that remains C-ABI compatible for portability and easy embedding.

At present, Pure does exhaustive file format checks on zip files, but I want to expand Pure as an open-source static analysis tool for more file formats, starting with MS-CFBF Office files. This recent paper in VirusBulletin shows some staggering results for static analysis to detect 90% of zero-day exploits in Office formats (see the table at the end): https://www.virusbulletin.com/uploads/pdf/magazine/2019/VB20...

I think email might prove to be the perfect place where something like Pure could be put to good use, where a combination of policy (no executables, no macros) and static analysis on the remaining file formats can narrow the gap and obviate the need for machine learning or CVE-laden antivirus, protecting whole groups of users through an opt-in "please defend me from malware email attachments" mode, without requiring buggy software vendors to improve the quality of their software. At the same time, it's moving away from Postel's Law and helping to enforce and uphold open standards and debug software with fail-fast feedback.

Email is the number one delivery vehicle for malware but most email providers don't have the open-source tools available to protect their users. My hope is that independent email providers such as Hey and Fastmail will consider sponsoring work on new file formats in Pure and come on board to encourage adoption.

55.

Pure: A Static Analysis File Format Checker(github.com ↗)

1 points · by _urga · 6y ago · 1 comment

comment 6y ago · link · parent

That's a nice riff on the original:

"Again I saw that under the sun the race is not to the swift, nor the battle to the strong, nor bread to the wise, nor riches to the intelligent, nor favor to those with knowledge, but time and chance happen to them all." —Ecclesiastes 9:11

To understand where Ecclesiastes is coming from:

In the wisdom literature, books like Proverbs will typically state the common case and it's Ecclesiastes that will state the exception. This keeps the wisdom literature balanced as a set of principles, not rules.

The Hugh Keough quote is a great summary then of the main point, which I won't restate.

comment 6y ago · link · parent

Thank you antirez!

I started using Redis around 2010 and I learned to appreciate so many things from you along the way:

* Data structures are fun.

* In-memory is fast and can be safe!

* Append-only logs are awesome.

* Databases can be more than MySQL.

* Complexity analysis is worth making clear in the documentation.

* Hybrid L1 cache-friendly data structures beat complexity analysis for small data.

* There are only so many hours you can work in a day.

* It's cool to sit by the pool.

* It's cool to have a screen name.

* Above all, code is poetry, not dependencies.

comment 6y ago · link · parent

Do Hetzner or xneelo reflash the firmware on server hardware when they recycle them across users?
12345
37