Commit Graph

455 Commits

Author SHA1 Message Date
piegames
ae207af82b treewide: More string indentation fixes
Follow-up on #350296 with the packages that cause big rebuilds and need
to go through staging.
2024-10-23 21:52:18 +02:00
Artturin
f0e657f3b1 Merge branch 'master' into staging-next 2024-09-25 06:05:01 +03:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Maximilian Bosch
5f04a666d3
glibc: 2.39-52 -> 2.40-36
Announcement: https://sourceware.org/pipermail/libc-announce/2024/000042.html
2024-09-15 15:36:44 +02:00
Jade Lovelace
5dfdb09561 tree-wide: remove eelco as maintainer from things he no longer maintains
While preparing this change, I read the git blame on all of the files I
touched. I saw a working lifetime of building this system which we use
every day and love dearly and keep maintained ourselves. I saw commits
from a 14 year range between 2003 to 2017!! I could not be more thankful
for Eelco's work on building large parts of the foundation of nixpkgs
that all of us rely on now.

However, the end date of that range of the files I looked at the blame
on was 2017. I did not see surviving code from any newer date than that.
Looking at the Git logs, Eelco has been working on other things, and
that's totally fine.

However, it means that our maintenance metadata is out of date on a lot
of packages, and *that*'s the reason I am submitting this change. There
are a lot of packages that don't have anyone with their name on them to
be pinged if they need attention, even if they have had recent activity
(although it is never clear if recent activity was just someone fixing
it because ZHF or because the package actually matters to them).
There are a lot of packages with storied history that maybe don't need
to be in the set anymore at all since they have not been touched in
years; or maybe they are simply finished.

Empty maintainer lists should be a sign that we need to figure out who
maintains it or potentially remove it if it has rotted, and allowing the
maintainer list to be empty if it is already not maintained is part of a
healthy repository ecology.

Either way, I would like to have the maintenance metadata not mislead
anyone into sending Eelco emails about packages he doesn't, in practice,
work on anymore. I have not removed his name from everything; there are
some things that he is the upstream for or has worked on more recently,
for instance, like Nix, which I have left alone.
2024-08-21 01:17:45 -07:00
tomberek
6f0fa65707
Merge pull request #332167 from ExpidusOS/fix/pkgsllvm/glibclocales
glibcLocales: fix building with llvm
2024-08-16 01:41:41 -04:00
Tristan Ross
ead097db7f
glibcLocales: format 2024-08-05 21:37:09 -07:00
Tristan Ross
e9211c2189
glibcLocales: fix building with llvm 2024-08-05 21:36:57 -07:00
Emily
8a837af302
Merge pull request #326819 from risicle/ris-shadowstack
cc-wrapper: add support for `shadowstack` hardening flag
2024-07-28 19:07:52 +01:00
Randy Eckenrode
2c54952847
darwin.apple_sdk.frameworks: remove NIX_COREFOUNDATION_RPATH hook
Darwin no longer supports switching between CoreFoundation implementations as of https://github.com/NixOS/nixpkgs/pull/265102. The setup hook is vestigial and was mostly harmless until https://github.com/NixOS/nixpkgs/pull/329526 was necessitated to fix build failures on staging-next https://github.com/NixOS/nixpkgs/pull/328673.

The correct fix is to remove the hook. It’s not used by the 11.0 or 12.3 SDKs. This makes the 10.12 SDK a bit more like the other SDKs.
2024-07-26 12:41:45 -04:00
Robert Scott
3ebc7bbf61 glibc: add option enableCETRuntimeDefault to runtime-enable CET by default
this appears to have been added to glibc because of the number
of packages in some distributions that were built with CET enabled
before a CET enabled machine was available to test for breakage
with.

we don't have that problem to such an extent and users of hardened
systems will likely want to enable this by default.
2024-07-14 21:25:48 +01:00
Alexis Hildebrandt
f8c4a98e8e treewide: Remove the definite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"([Tt]he)? ' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Tt]he (.)/\1\U\2/'
2024-06-09 23:08:46 +02:00
Alexis Hildebrandt
bf995e3641 treewide: Remove ending period from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*".*\.";' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*)\.";/\1";/'
2024-06-09 23:04:51 +02:00
Thomas Gerbet
0ff673ac59 glibc: 2.39-31 -> 2.39-52
Fixes GLIBC-SA-2024-0005 (CVE-2024-33599), GLIBC-SA-2024-0006 (CVE-2024-33600),
GLIBC-SA-2024-0007 (CVE-2024-33601) and GLIBC-SA-2024-0008 (CVE-2024-33602).

https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0005;h=a59596610a0ea74d905a2452fc50283dad58e115;hb=HEAD
https://sourceware.org/git?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0006;h=d44148d3d97bddac42450649032ebbd96b59062e;hb=HEAD
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0007;h=b6928fa27a69e325624b1a395ecb1bbba537ad80;hb=HEAD
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0008;h=d93e2a6f0bf084df419efadee2d1a48c4f9003d7;hb=HEAD
2024-05-06 22:23:12 +02:00
Thomas Gerbet
5ffabd61d0 glibc: 2.39-5 -> 2.39-31
Fixes GLIBC-SA-2024-0004 (CVE-2024-2961).
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0004;h=23a8115d63218b5e8985ecdfcc471632e347b225;hb=refs/heads/master
2024-04-17 21:37:05 +02:00
Maximilian Bosch
dd8e61da4a
Merge pull request #303868 from Ma27/glibc-case-insensitive-fs-build
glibc: allow (cross)-build on case-insensitive fs
2024-04-14 08:09:23 +00:00
Maximilian Bosch
0897e8b6db
glibc: allow (cross)-build on case-insensitive fs
...such as APFS.

The problem here is that a change inside the 2.39 patchset creates a
file `ADVISORIES` and also contains a directory `advisories/` and both
are considered the same file on APFS.

Reproducible with `nix-build -A pkgsCross.gnu64.stdenv.cc` on a
`aarch64-darwin` host.

Hence, excluding the file from the patchset as it is non-functional anyways.

Closes #303193
2024-04-13 19:25:30 +02:00
Robert Scott
da25f95bf4 glibc: expose enableCET as overridable argument, default "permissive"
this should be a gentler way to introduce CET-compiled
binaries into general usage
2024-03-24 13:43:27 +00:00
Vladimír Čunát
ddc361cfca
Merge #287594: glibc: 2.38-44 -> 2.39-5
...into staging
2024-03-24 06:41:49 +01:00
stuebinm
ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00
Maximilian Bosch
8b24908a76
glibc: 2.38-44 -> 2.39-5
Announcement: https://lists.gnu.org/archive/html/info-gnu/2024-01/msg00017.html

This release seems relatively harmless in terms of potential fallout.
Most notably is the removal of `crypt(3)` in favor of libxcrypt which
we've done already and compatibility from ISO C2X.

Also decided to drop the old *.gz approach in favor of inlining the
patch with the changes from the release branch directly: it's relatively
small in contrast to certain lockfiles in this repo and having a textual
version makes reviews & diffs easier. See also
https://github.com/NixOS/nixpkgs/pull/258972#discussion_r1454962456 for
more context.
2024-03-02 19:01:45 +01:00
Mario Rodas
d4b73625ba
Merge pull request #285514 from trofi/glibc-no-cet-on-i686
glibc: enable `cet` only on `x86_64` (skip `x86_32`)
2024-02-01 18:19:41 -05:00
Sergei Trofimovich
e447b1533e glibc: enable cet only on x86_64 (skip x86_32)
`glibc-2.39` improved `--enable-cet` detection on unsupported platforms
and `./configure` will start failing as:

    glibc> configure: error: "CET is only supported on x86_64 or x32"
2024-02-01 09:48:19 +00:00
Thomas Gerbet
7f8349fd48 glibc: 2.38-27 -> 2.38-44 and patch for glibc possible memory corruption in qsort()
Fixes CVE-2023-6246, CVE-2023-6779, and CVE-2023-6780

Advisories from Qualys:
https://www.qualys.com/2024/01/30/cve-2023-6246/syslog.txt
https://www.qualys.com/2024/01/30/qsort.txt

Upstream advisories:
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0001;h=28931c75ae018cc398344af80e6be6ab6e1874b7;hb=6cdc44214253a74e7140d75a7ebfc900820a5fa8
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0002;h=940bfcf2fcb760505ec59d84b94250aaf49c3be9;hb=6cdc44214253a74e7140d75a7ebfc900820a5fa8
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2024-0003;h=b43a5150ab1b0cc4ef2cabf5bf792428389f5e37;hb=6cdc44214253a74e7140d75a7ebfc900820a5fa8
2024-02-01 00:32:04 +01:00
Peder Bergebakken Sundt
f41aba3739 treewide: remove unreferenced patch files
Found with `fd \\.patch$ pkgs/ -x bash -c 'rg -F "{/}" pkgs/ -q || echo {}'`
2023-12-01 06:11:20 +01:00
Connor Baker
2b47345ff5 glibc: add NVCC include guards to fix ARM CUDA compilation 2023-11-06 00:53:11 +00:00
Vladimír Čunát
4d86c20f10
Merge branch 'master' into staging-next
Fixes an issue blocking staging-next-small evaluation.
2023-10-26 11:41:00 +02:00
Adam Joseph
b4371a5cea glibc: weaken host==build check to canExecute 2023-10-26 06:12:33 +00:00
Adam Joseph
27a73cd176 glibc: use (lib.getBin pkgsBuildBuild.glibc) to generate locales
This is an alternative resolution of the problem identified in

  https://github.com/NixOS/nixpkgs/pull/259964

which stated that "glibc depends on buildPackages.glibc for locale
things.  buildPackages.glibc depended on buildPackages.libgcc,
which, since it's GCC, depends on the target's bintools, which
depend on the target's glibc, which, again, depends on
buildPackages.glibc, causing an infinute recursion when evaluating
buildPackages.glibc when glibc hasn't come from stdenv (e.g. on
musl)."

The fact that we use pkgsBuildHost.glibc instead of
pkgsBuildBuild.glibc to generate the locales has always been a gross
hack.  If we simply remove the gross hack the circularity goes away.
2023-10-26 06:12:33 +00:00
Maximilian Bosch
7cd09e8073
Merge pull request #254334 from jiegec/glibc-libutil
glibc: use libutil.a when libutil.so.1 is unavailable
2023-10-10 09:23:07 +02:00
Maximilian Bosch
8bc5104a6e
treewide: refactor .attrs.sh detection
When specifying the `builder` attribute in `stdenv.mkDerivation`, this
will be effectively transformed into

    builtins.derivation {
      builder = stdenv.shell;
      args = [ "-e" builder ];
    }

This also means that `default-builder.sh` is never sourced and as a
result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct
location[1].

Also, we need to source `.attrs.sh` to source `$stdenv`. So, the
following is done now:

* If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it.
  Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage
  (see previous commit for more context), so prefer the environment
  variable if possible.

* Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this
  can happen.

* If neither applies, it can be assumed that `__structuredAttrs` is
  turned off and thus nothing needs to be done.

[1] It's possible that it doesn't exist at all - in case of Nix 2.3 or
    it can point to a wrong location on older Nix versions with a bug in
    `__structuredAttrs`.
2023-10-04 18:36:57 +02:00
edef
caa3d9d75d
glibc: 2.38-23 -> 2.38-27
Fixes CVE-2023-4911.

Change-Id: I154c79a7c6822051903ef15c547c3567691b1457
2023-10-04 14:19:15 +02:00
Maximilian Bosch
8348b18c09
glibc: 2.38-0 -> 2.38-23
Fixes CVE-2023-4806 & CVE-2023-4527.
2023-09-24 15:13:26 +02:00
Maximilian Bosch
e86152986c
glibc: 2.37-39 -> 2.38-0
Announcement: https://sourceware.org/pipermail/libc-alpha/2023-July/150524.html

So far this looks surprisingly good, I managed to build the stdenv
on `aarch64-linux` and got up to building `zfs` and `nix` on `x86_64-linux`.

The patchset is still empty because the latest commit on the release branch is
the one the 2.38 tag points to. I added an empty file though to keep
things consistent.

Also applied the new version of the DT_HASH fix from ArchLinux[1]. This
one's a way easier version than before because it doesn't contain the
autoconf changes, but only hardcodes the desired ld flags. It was
already confirmed that this patch is sufficient to fix the underlying
problem[2].

[1] e54d98e2d1 (7b1bfda0391ff4c2662e04a5e193c37e233a0738)
[2] https://github.com/ValveSoftware/Proton/issues/6051#issuecomment-1666055553
2023-09-24 15:10:19 +02:00
Thomas Gerbet
b23e08124d glibc: 2.37-8 -> 2.37-39
Includes fixes for CVE-2023-4527 and CVE-2023-4806

https://sourceware.org/bugzilla/show_bug.cgi?id=30842
https://sourceware.org/bugzilla/show_bug.cgi?id=30843
2023-09-23 14:25:12 +02:00
Jiajie Chen
9ced81cfbd glibc: use libutil.a when libutil.so.1 is unavailable
On some platforms (e.g. loongarch64-linux), libutil.so.1 is not built in
glibc (see glibc login/Makefile), only a dummy libutil.a is provided.
Do not symlink libutil.so but copy libutil.a to glibc.out if
libutil.so.1 does not exist.
2023-09-10 13:38:00 +08:00
github-actions[bot]
df770ba961
Merge master into staging-next 2023-08-15 06:01:24 +00:00
Adam Joseph
64046f0191 glibcCross: use a libgcc built separately from gcc
### Summary

This PR completely and finally solves the gcc<->glibc circular
`buildInputs` problem, for cross compilation.  The same technique
can be applied to native builds in the future.

Closes #213453

 ### Motivation

Prior to this PR, we had the following circular `buildInputs` problem:

1. gcc has glibc in its `buildInputs`

   - a compiled copy of glibc must be present before building gcc;
     if it isn't, gcc cripples itself (`inhibit_libc`) and refuses
     to build libgcc_s.so

2. glibc has libgcc_s.so in its `buildInputs`

   - glibc `dlopen()`s libgcc_s.so in order to implement POSIX
     thread cancellation.  For security reasons `glibc` requires
     that the path to `libgcc_s.so` is [hardwired] into `glibc` at
     compile time, so it's technically not a true dynamic link -- it
     just pretends to be one.

3. libgcc_s.so is built in the same derivation as gcc

   - libgcc_s.so is built as part of the gcc build process

We must cut one of these three links in the loop.

 ### Previous Attempts

Previously https://github.com/NixOS/nixpkgs/pull/238154 had
attempted to cut link (1) by building `gcc` without `glibc`, and
using the `libgcc_s` which emerges from that build.  Unfortunately
this just doesn't work.  GCC's configure script extracts quite a lot
of information from the glibc headers (which are a build artifact --
you can't just copy them out of the source tarball) and various
`./configure`-driven linking attempts.  If `glibc` isn't around at
build time you wind up with a `libgcc_s.so` that is missing various
unwinder features (see https://github.com/NixOS/nixpkgs/issues/213453
for the most problematic one).

Musl "cuts" link (2), or rather never creates it in the first place.
["Cancellation cleanup handling in musl has no relationship to C++
exceptions and unwinding... glibc implements cancellation as an
exception"](https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-cancellation).
IMHO Musl made the smarter decision here.  It is incredibly rare to
find a codebase that uses both POSIX thread cancellation *and* C++
exceptions.  I have never seen a codebase that uses both *and*
expects them to be aware of each other, and I would be astonished if
one existed.  Glibc paid an immense cost in complexity for something
nobody has ever used.

 ### Changes Made

This PR cuts link (3): instead of building libgcc_s.so as part of
gcc, we build it separately from gcc.  Now there is a strict acyclic
graph of `buildInputs`:

```
 gccWithoutTargetLibc
 |
 +--->glibc-nolibgcc
 |    |
 |    v
 +--->libgcc
 |    |
 |    v
 +--->glibc
 |    |
 |    v
 +--->gcc
```

In other words, there's a simple linear `buildInputs` chain
`glibc-nolibgcc` `->` `libgcc` `->` `glibc` `->` `gcc` where all
four packages are compiled by (and therefore have as a
`(native)BuildInput`) `gccWithoutTargetLibc`.

`gccWithoutTargetLibc` and `glibc-nolibgcc` are strictly
bootstrapping artifacts; nothing else has them as a `buildInput` and
they shouldn't appear in the closure of any final deployment
packages.  `glibc-nolibgcc` lacks `libgcc_s.so`, so it will segfault
if you try to use it with POSIX thread cancellation.  Fortunately
all we need from it is (a) its headers (`lib.getDev`) and (b) to use
it in the `./configure` script for `libgcc`.

When translated over to the native bootstrap, `xgcc` takes the place
of `gccWithoutTargetLibc`, and the "first `glibc`" (we build two of
them) takes the place of `glibc-nolibgcc`.  At that point our native
and cross bootstrap have the same overall architecture, and it
becomes possible to merge them (at last!)

[213453]: https://github.com/NixOS/nixpkgs/issues/213453
[238154]: https://github.com/NixOS/nixpkgs/pull/238154
[hardwired]: 7553d0fe29/pkgs/development/libraries/glibc/default.nix (L69-L88)
2023-08-14 15:09:06 -07:00
Vladimír Čunát
5b033f3a00
Merge #246049: glibcLocales: disable parallelism
..to restore deterministic locales; Merge into staging
2023-08-11 10:23:32 +02:00
Yureka
7197b9f03b
glibcLocales: fix extraNativeBuildInputs definition (#246537) 2023-08-02 21:02:33 +02:00
Sergei Trofimovich
43da9e8fff glibcLocales: disable parallelism to restore deterministic locales
The way `nixpkgs` runs parallel `localedef` instances shares
`--prefix=/build` flag. As a result `localedef` processes
non-deterministically extend the file with new locales (hopefully
without data corruption):

    https://github.com/NixOS/nixpkgs/issues/245360

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2023-07-29 20:43:50 +01:00
Sergei Trofimovich
4d4f5e2db1 glibcLocales: enable parallel building 2023-06-20 09:38:33 +01:00
Maximilian Bosch
1f72072bdd
Merge pull request #238027 from amjoseph-nixpkgs/pr/glibc/parallel
glibcLocales: use more than one core to build
2023-06-17 14:55:40 +02:00
Adam Joseph
7306386eb3 glibcInfo: use makeFlags instead of buildPhase
This commit causes glibc/info.nix to use the standard builder's
`buildPhase` so things like `preBuild`, `postBuild`,
`enableParallelBuilding`, etc work correctly.
2023-06-15 20:14:29 -07:00
Adam Joseph
238b793373 glibc: allow users of glibc/common.nix to override makeFlags
This commit allows to include `makeFlags` in a glibc derivation
without clobbering the flags from `common.nix`
2023-06-15 20:14:29 -07:00
Adam Joseph
b243596eb7 glibcLocales: use more than one core to build
This commit massively reduces the build latency for glibcLocales by
allowing it to build in parallel.  This requires passing
`-j$NIX_BUILD_CORES` via the glibc-specific make variable
`PARALLELMFLAGS`.

This commit also fixes a preexisting bug where the glibcLocales
package would ignore `preBuild` and `postBuild`.
2023-06-15 19:36:23 -07:00
Adam Joseph
cc22c861e8 glibc: allow users of glibc/common.nix to override makeFlags
This commit allows to include `makeFlags` in a glibc derivation
without clobbering the flags from `common.nix`
2023-06-15 19:36:18 -07:00
Linus Heckemann
4d649f2b63 glibc: split getent into its own output
Many dependents only require getent and not all the locale generation
tools that are included in the `bin` output. This can save some
closure size!
2023-06-12 10:26:52 +02:00
Adam Joseph
0e9ef0a07d cc-wrapper: when merging gcc32 and gcc64, merge libgcc as well
Our gcc_multi and glibc_multi expressions merge together a
32-bit-targeted and 64-bit-targeted gcc.  However they do not thread
through the passthru.libgcc from these merged gccs.

This commit corrects that.

It also extends passthru.libgcc to allow a *list* rather than just a
single outpath.

Resolves part of #221891 (at least getting it back to the error
message it gave before).
2023-05-09 00:16:24 -07:00
Adam Joseph
c5a4cc8396 glibc: suppress warning about IEEE-standard long double 2023-04-05 15:54:26 -07:00