Since the script interpreters are not patched (anymore?), no reference
to any shell is generated by the scripts in glibc's `bin` output:
```
$ nix-store --query --references /nix/store/nmfj3a2k2kr2lypndn37x6qbd8537f9b-glibc-riscv64-unknown-linux-gnu-2.33-50-bin
/nix/store/afgfd3vl3x5zx89awn3fjayn83yl9vcy-glibc-riscv64-unknown-linux-gnu-2.33-50
/nix/store/nmfj3a2k2kr2lypndn37x6qbd8537f9b-glibc-riscv64-unknown-linux-gnu-2.33-50-bin
```
This means that it's safe to include the scripts in glibc's bin output
even in cross builds. One interesting improvement for the future could
be to split these scripts into a separate derivation and properly patch
their script interpreter (currently they are using impure /bin/sh).
`mtrace(1)` is a small Perl script that interprets and provides
human-readable output for `malloc(3)` traces.
Even though this is actually part of `glibc` itself I decided to place
this into its own package. The main reason for this is that this script
has a runtime dependency on Perl which would complicate `stdenv`
bootstrapping since we'd have to compile another Perl that doesn't depend on
the bootstrap tools that is used as runtime dependency for the
stage2 glibc.
Since this is only a dev/debugging tool, splitting this up seemed like a
reasonable choice to me.
On a leaking C program, this can be used like this:
$ env MALLOC_TRACE=$(pwd)/trace ./a.out
$ ./result/bin/mtrace ./trace
Memory not freed:
-----------------
Address Size Caller
0x0000000001875690 0x4 at 0x401151
Closes#141924
Without this patch, setting the same locale twice, e.g. like this in
NixOS:
```nix
{
i18n.supportedLocales = [
(config.i18n.defaultLocale + "/UTF-8")
(config.i18n.defaultLocale + "/UTF-8")
];
}
```
Would make the glibcLocales build fail with
```
Error: unsupported locales detected:
en_US.UTF-8/UTF-8 \
You should choose from the list above the error.
```
Add an explicit dependency on netbase for /etc/protocols
Certain functions in glibc look for files present in /etc such as getprotobyname which reads /etc/protocols.
If you are using Nix over a Linux installation, this file may not be present, and therefore it will cause errors.
- add netbase as a new package in nixpks
- add a dependency in glibc on it using postPatchPhase and substitute
the path
Fixes#124401
This enables ALSR on static executables, which makes them harder to
exploit by providing a crt suitable for static PIEs.
Does this break existing binaries? Likely not. Static-pie is only
used if explicitly enabled.
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.
This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.
`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.
The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.