News for hackers. Stuff that matters.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by eloff on Tuesday July 20, 2021 @01:38PM (#27896729)
Yeah, that is frustrating since there are no platforms where that would fail today, and it's hard to imagine why we would ever want one with 256bit pointers.

We don't even use full 64bit pointers today on x64.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by fulafel on Tuesday July 20, 2021 @04:38PM (#27898981)
Maybe a fat pointer llvm target ala SoftBound running on a machine with 128 bit bare pointers, like as/400.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by est31 on Tuesday July 20, 2021 @03:57PM (#27898477)
When 16 bit computers went to 32 bit, people probably thought that one wouldn't ever need 64 bit computers either. That being said, by the time 128 bit run out we have probably boiled earths oceans :).

You could think of checked memory models where half of the 256 bit address is a 128 bit random key needed to access some allocation, or maybe even a decryption key. Similar things are done with the extra space of x64 as well.

Also, 128 bit numbers are still quite uncommon in Rust. Easy conversion of usize to them wouldn't be that useful if conversions of the other number types don't work.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by a1369209993 on Wednesday July 21, 2021 @02:16AM (#27902902)
> When 16 bit computers went to 32 bit, people probably thought that one wouldn't ever need 64 bit computers either.

People have said that about pretty much every memory size in the history of computing. The argument for 64-bit is not "2^64 bytes ought to be enough for anyone"; it's "you couldn't use more than 2^64 bytes even if you wanted to". Writing a full register worth of data every clock cycle at 4GHz works out to 32GB/s. (2^64B / 32GB/s) is just over seventeen years, to fill up a 64-bit address space, assuming you're doing no actual computation. Few computers even work for seventeen years without replacement, much less run single processes continually with no reboots.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by mgraczyk on Tuesday July 20, 2021 @02:59PM (#27897745)
The Ethereum virtual machine addresses it's storage with 256 bits, so there's one wild example. Although in this case you'd probably not want to use usize directly to represent storage.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by eloff on Tuesday July 20, 2021 @03:09PM (#27897890)
I'm not familiar with the Ethereum virtual machine, are these really memory pointers? Surely it's represented differently?
Re:size_t-to-int vulnerability in Linux’s filesystem layer by mgraczyk on Tuesday July 20, 2021 @03:59PM (#27898501)
EVM is a stack machine, and it has durable storage which is addressed using 256 bit "pointers". So you can do something like

    push x // 256 bit constant
    LOAD
    // top of stack now contains storage[x]
Re:size_t-to-int vulnerability in Linux’s filesystem layer by pornel on Tuesday July 20, 2021 @06:43PM (#27900234)
Even worse, there are platforms with >=128-bit pointers but 64-bit address space. Rust has chosen usize to be uintptr_t rather than size_t, even though it mostly uses it as if it was size_t. A ton of code is going to subtly break when these two sizes ever differ. Rust is likely already doomed on >64-bit platforms, and is going to be forced to invent its own version of a LLP64 workaround.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by TheCycoONE on Tuesday July 20, 2021 @08:50PM (#27901043)
Sorry, I'm not sure how this is a problem. On segmented architectures size_t is smaller than uintptr_t, but that just means there needs to be an allocation limit < usize::max_value.

It would have cause more bugs if they defined it the other way and people used usize to store addresses.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by dezgeg on Wednesday July 21, 2021 @04:43PM (#27911908)
"Fortunately" there will be bigger problems than Rust on 128-bit machines - lots of UAPI structures in the Linux kernel have pointer size hardcoded to 64 bits.