frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Graphene OS: a security-enhanced Android build

https://lwn.net/SubscriberLink/1030004/898017c7953c0946/
188•madars•6h ago•82 comments

Scientists may have found a way to eliminate chromosome linked to Down syndrome

https://academic.oup.com/pnasnexus/article/4/2/pgaf022/8016019
224•MattSayar•6h ago•171 comments

Inter-Planetary Network Special Interest Group

https://www.ipnsig.org
115•OhMeadhbh•7h ago•29 comments

Positron – A next-generation data science IDE

https://positron.posit.co/
126•amai•3d ago•49 comments

I wasted weeks hand optimizing assembly because I benchmarked on random data

https://www.vidarholen.net/contents/blog/?p=1160
250•thunderbong•3d ago•76 comments

AMD CEO sees chips from TSMC's US plant costing 5%-20% more

https://www.bloomberg.com/news/articles/2025-07-23/amd-ceo-su-sees-chips-from-us-tsmc-plant-costing-5-to-20-more
282•mfiguiere•1d ago•463 comments

There is no memory safety without thread safety

https://www.ralfj.de/blog/2025/07/24/memory-safety.html
285•tavianator•12h ago•265 comments

Alto turns your Apple Notes into a website

https://alto.so/
39•colinprince•3h ago•14 comments

A GPU Calculator That Helps Calculate What GPU to Use

https://calculator.inference.ai/
52•chlobunnee•5h ago•15 comments

Air Force unit suspends use of Sig Sauer pistol after shooting death of airman

https://www.nhpr.org/nh-news/2025-07-23/sig-sauer-pistol-air-force-shooting-death
130•duxup•9h ago•225 comments

PSA: SQLite WAL checksums fail silently and may lose data

https://avi.im/blag/2025/sqlite-wal-checksum/
246•avinassh•13h ago•111 comments

RE#: High performance derivative-based regular expression matching (2024)

https://arxiv.org/abs/2407.20479
32•fanf2•3d ago•5 comments

New Aarch64 Back End

https://ziglang.org/devlog/2025/#2025-07-23
76•Bogdanp•6h ago•24 comments

Visa and Mastercard: The global payment duopoly (2024)

https://quartr.com/insights/edge/visa-and-mastercard-the-global-payment-duopoly
259•bilekas•6h ago•148 comments

Use Your Type System

https://www.dzombak.com/blog/2025/07/use-your-type-system/
235•ingve•13h ago•242 comments

Revisiting Moneyball

https://djpardis.medium.com/revisiting-moneyball-074fc2435b07
68•sebg•6h ago•26 comments

Open Source Maintenance Fee

https://github.com/wixtoolset/issues/issues/8974
235•AndrewDucker•15h ago•167 comments

Information Warfare

https://yuxi.ml/sketches/posts/info-warfare/
14•mesaoptimizer•3d ago•3 comments

How Anthropic teams use Claude Code

https://www.anthropic.com/news/how-anthropic-teams-use-claude-code
120•yurivish•2h ago•94 comments

Covers as a way of learning music and code

https://ntietz.com/blog/covers-as-a-way-of-learning/
137•zdw•3d ago•75 comments

Vet is a safety net for the curl | bash pattern

https://github.com/vet-run/vet
182•mooreds•15h ago•168 comments

Intel CEO Letter to Employees

https://morethanmoore.substack.com/p/intel-ceo-letter-to-employees
209•fancy_pantser•7h ago•372 comments

Why concatenative programming matters (2012)

http://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html
52•azhenley•3d ago•13 comments

Bus Bunching

https://www.futilitycloset.com/2025/07/12/bus-bunching/
54•surprisetalk•4d ago•59 comments

Low-Temp 2D Semiconductors: A Chipmaking Shift

https://spectrum.ieee.org/cdimensions-2d-semiconductors
6•rbanffy•3d ago•2 comments

Writing is thinking

https://www.nature.com/articles/s44222-025-00323-4
283•__rito__•3d ago•118 comments

Mwm – The smallest usable X11 window manager

https://github.com/lslvr/mwm
141•daureg•3d ago•58 comments

Show HN: Nia – MCP server that gives more docs and repos to coding agents

https://www.trynia.ai/
55•jellyotsiro•13h ago•44 comments

UK: Phone networks down: EE, BT, Three, Vodafone, O2 not working in mass outage

https://www.the-independent.com/tech/ee-bt-three-vodafone-o2-down-phone-networks-outage-latest-b2795260.html
198•oger•14h ago•87 comments

The POSIX specification of vi

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/vi.html
65•exvi•3d ago•24 comments
Open in hackernews

Using uninitialized memory for fun and profit (2008)

https://research.swtch.com/sparse
34•AminZamani•4d ago

Comments

jojomodding•1d ago
Interestingly enough, Rust does not allow you to access undefined memory, not even if you do not care about the value stored there. People have been proposing a `freeze` operation that replaces uninitialized memory with garbage but initialized data (i.e. a no-op in assembly).

But there is tension about this: Not allowing access to uninitialized memory, ever, means that you get more guarantees about what foreign (safe) Rust can do, for instance.

thrance•1d ago
True of safe rust only. You can always fall back to unsafe rust, allocate a chunk of bytes and write/read to it as you wish.
stouset•1d ago
Even in unsafe Rust, this is undefined behavior.
LoganDark•1d ago
You're allowed to trigger as much undefined behavior as you wish. It makes the program meaningless of course, but it's not like it stops you.
kmeisthax•1d ago
My impression was that there was some kind of optimization in LLVM that relied on being able to assume values were never undef[0], which is why undefined memory access was always illegal in Rust[1].

Putting that aside, a deliberate "read uninitialized memory with bounded UB" primitive like freeze would only work for types where all possible bit patterns are valid. So no freezing chars[2], references, or sum types. And any transparent wrapper type that has invariants - like, say, slices, vecs, strs, and/or range-restricted integer types - would see them utterly broken when frozen. I suppose you could define some operation to "validate" the underlying bit pattern, but I'm not sure if that would defeat the point of reading uninitialized memory.

[0] LLVM concept that represents uninitialized memory, among other things.

[1] I believe a few other unsafe Rust concepts are actually leaky abstractions around LLVM things

[2] Rust's char must hold valid UTF-8 and will UB if you stick surrogates in there

NobodyNada•1d ago
> there was some kind of optimization in LLVM that relied on being able to assume values were never undef

It's true that LLVM has restrictions on what you can do with undef/poison memory, but LLVM also supports the "freeze" operation that comes up in the Rust discussions (which transforms an undefined value into an arbitrary, well-defined value). It would certainly need to be unsafe to avoid violating invariants like you mentioned, but "LLVM" isn't the blocker to supporting this.

Rather, there are more subtle problems with reading from initialized memory -- for example on Linux, a heap allocator might use MADV_FREE on free memory, which hints to the kernel that a page contains freed memory and the operating system is not required to preserve its contents until the application writes to it again. This means the following sequence of events is possible:

- An application frees some memory, and the heap allocator invokes madvise(MADV_FREE) on the address range.

- The application makes a heap allocation, obtaining a pointer to the free'd memory.

- The application freezes the uninitialized memory and reads from it.

- Due to memory pressure, the kernel decides to reclaim the free'd memory. It unmaps it from the process and uses it somewhere else.

- The application accesses the first allocation again, and sees that its value has now changed to all-zeroes.

Thus, we can see that "freezing" arbitrary memory can't actually be implemented on real-world systems -- the contents of uninitialized memory really can change out from under you until you write to that memory.

It would be possible to implement a "by-reference freeze" that copies a MaybeUninit<T> to a new location, but introducing this functionality still has the downside that you can write a Heartbleed bug without invoking undefined behavior, which is what makes it controversial.

dooglius•1d ago
Seems like the heap allocator has a bug if it doesn't handle invalidating the free hint before it returns it to the application. This does raise the question of why MADV_FREE works on the basis of writes rather than accesses -- there are PTE bits for both cases right, and it would have been just as easy to have any access cancel the free hint? (I am assuming x86 here.)
dzaima•18h ago
That could be classified as a bug if it was decided that the allocator must guarantee that uninitialized memory is readable as a consistent value. Otherwise, making the allocator clear the hint is just unnecessary work.

Clearing the hint on read would probably be more sane, but would mean many more potential situations of unnecessarily losing it (GC doing unnecessary scanning, doing a heap dump, debuggers trying to read it, other sorts of memory scanning)

joseluis•1d ago
Just a nitpick. Rust's char is really a 21 bit unicode scalar value (a code point without surrogates) using a 32-bit representation and indeed there are a lot of invalid char values in a 32-bit space. Utf-8 is a different encoding format for code points using variable width (1-4 bytes per).
Sesse__•1d ago
An elegant optimization, but how would you intersect two of these efficiently? It sounds like you'd need to iterate over the entire dense vector and do a sparse-vector check for each and every value (O(m) with a very high constant factor). Either that, or sort both sparse vectors (O(n log n)).
dooglius•1d ago
Why would iterating over the dense vector be O(m) rather than O(n)?
Sesse__•19h ago
Sorry, I meant iterating over the sparse vector, not the dense vector (I find the nomenclature in the article somehow inverted).
dzaima•18h ago
Wouldn't it be just a trivial O(n) of a loop of "for (x in dense vector of one set) { if (is x a member of the other set) add to result; }"?
Sesse__•16h ago
True. The constant factor is nasty, though, compared to the 256-bits-per-instruction of normal bit sets.
dzaima•14h ago
Right; generally the constant factors of this approach are horrible though, can't think of any situation where it'd be worth it on systems with, well, cache (or a TLB for that matter, which is even worse off with the sparse memory usage).
dooglius•1d ago
One thing worth pointing out is that Linux makes it pretty difficult for userspace to access uninitialized memory; the MAP_UNINITIALIZED flag for mmap has to be specifically configured but generally isn't, so the memory does get zeroed at some point. Best you can hope for is that your heap allocator re-uses some un-munmapped memory. The kernel will zero pages on-demand, which helps, but you're still paying a cost for that zeroing.