I did not think they would take this decision so soon, but it is, in my opinion, the right decision to take. There will be complaints from users of memory-heavy programs running on 32-bit platforms though.
For context, this blog post shows how things break when allocation functions are allowed to create blocks of more than PTRDIFF_MAX: https://trust-in-soft.com/objects-larger-than-ptrdiff_max-by...
If one needs to allocate more than 2 GB in a single allocation, time to move to 64-bit.
time to move to (anonymus) mmap - it still has size_t as type for the size argument
I would think this would be a small one of many complaints such users would have on a daily basis.
In all of recorded history, has a malloc() call for more than 2GB ever actually succeeded anywhere? Most OSes on such platforms never supported any more than that amount of addressible memory in a user process at all.
This is fine. Honestly it's seems like mostly pedantry on modern systems, but it's clearly correct.
Yes, on OS X 10.5, and on 32-bit Linux with Glibc until two days ago.
The article I linked, written before Glibc 2.30 was released, is from a period when every Unix had been allowing “malloc(0x80000001);” in 32-bit processes until recently; only OS X had had the courage to make that allocation fail. Sorry if the article doesn't make it clear enough that this is the context it is written in, but in its defense, you only needed to try it (and still need today to try it if you didn't upgrade Glibc) to see that it succeeds. Or do you think that the Glibc developers wrote a Changelog entry to explain that they changed something that didn't actually change?
Linux's default limit on 32-bit has been 3GiB for a while, i think: https://stackoverflow.com/a/5080778/139746
Windows's limit is 2GiB by default, but this is only a default and 32-bit processes can be allowed access to more memory, up to IIRC nearly all of the theoretical maximum 4GiB for 32-bit processes running on 64-bit Windows.
I'm sure it "worked" in some sense, though I'd be really surprised if you could make that happen with a default-linked C program on any distro that ever shipped. The holes just aren't big enough. You'd need to link the app with special care, and potentially write your own dynamic loader to keep the region you wanted free. And if you do that... you might as well just mmap() the thing.
The point was that doing this with the system heap on a 32 bit system was never a serious thing. There are apps that would do management of memory spaces that large, but they didn't do it with malloc.
And even when they do, it's going to be very rare to find 2GB of contiguous unused address space. With the default executable mapping low in the first GB and the stack right below 3GB, a single library mapped around the 2GB mark can fragment the address space enough to make a 2GB allocation impossible.
I thought this was standard practice for designing C APIs taking callbacks.
> * The Linux-specific <sys/sysctl.h> header and the sysctl function have been
deprecated and will be removed from a future version of glibc.
Application should directly access /proc instead. For obtaining random
bits, the getentropy function can be used.
That's gonna break the world, a lot of code includes that header and uses the sysctl function.
This is to supplant non-reentrant shared state for node depth. Same as strtok() -> strtok_r(). Doing this with the generic closure arg is just a bonus since the callback is already present.
I frankly have never ever ever seen anyone actually configure NSS outside of the defaults.
However even the defaults on Debian and Centos are affected here, as it means that the dynamic user/host stuff in systemd also won't get picked up when something doesn't read nsswitch
It's also needed for systemd dynamic users.
If you have either of those, you will have an /etc/nsswitch.conf that requires dynamic linking :)
"The dynamic linker accepts the --preload argument to preload shared
objects, in addition to the LD_PRELOAD environment variable."?
Does one ever invoke the dynamic linker directly? Why? How?
$ /lib64/ld-linux-x86-64.so.2 /bin/true --version
true (GNU coreutils) 8.28
The electron thing was apparently an LLVM linker thing according to your sibling comment.
EDIT: the m4 patch in question: https://git.archlinux.org/svntogit/packages.git/tree/trunk/m... - apparently they still use it.
Seems that's less of a glibc breaking compatibility, and more developers relying on something outside of the guaranteed API.