Commit Graph

232 Commits

Author SHA1 Message Date
Guillaume Girol
4faaa99ff9 glibc: enable structuredAttrs (#548500) 2026-08-15 20:05:45 +00:00
John Ericson
83cb487509 gcc/ng: build libgcc twice, once for the libc and once against it
The libc bootstrap had every stage except the last. `gccNoLibgcc` builds
libgcc, `gccWithLibgcc` builds the libc with it — and then nothing goes
back to rebuild libgcc now that the libc exists. So the only libgcc
anyone ever got was the one from before there was a libc, which is
necessarily single-threaded: `gthr-posix.h` includes `<pthread.h>`
unconditionally, and at that point there is no libc to provide it.
`libstdcxx` above it assumed `posix` regardless, so the two disagreed by
construction — the unwinder's registry locking compiled away to nothing
underneath a `libstdc++` handing out `std::thread`.

Add the last stage the way the LLVM package set does with
`compiler-rt-no-libc` and `compiler-rt-libc`: instantiate the same
package twice. `libgcc-no-libc` is the existing one and now feeds only
the three bootstrap compilers. `libgcc-libc` is built after the libc, by
a new `gccWithLibcAndBasicLibgcc` — real libc, bootstrap libgcc — and is
what `libgcc` resolves to for any platform that has a libc.

Nothing is passed to the package to say which of the two it is. The
distinction is the compiler it is handed, exactly as in the LLVM set:
`gccNoLibgcc` is wrapped with `binutilsNoLibc`, whose `libc` is
`preLibcHeaders` -- the header-only stand-in, or nothing at all on
platforms without one -- and `wrapCCWith` defaults a wrapper's `libc` to
its bintools'. So the package reads `stdenv.cc.libc` and needs no
bootstrap flag of its own.

Which threading model is available is a property of the libc, so the libc
declares it as `passthru.threadModel` and `libgcc` reads it from there.
That is what makes the pre-libc build single-threaded without being told
to be: a headers-only package declares no `threadModel`, a real libc
does.
`libstdcxx` in turn takes both the model and the generated
`gthr-default.h` from `libgcc`, replacing a `$CXX -v` probe that asked
the compiler — which in this package set is configured separately from
libgcc and so answers for the wrong component. Platforms that declare
nothing keep the single-threaded model they already had.

The second libgcc is also the first one that can be shared. Previously
only the static library was built, and the compiler was configured
`--disable-shared` for every target, which is compiled into the driver's
specs, so it named bare `-lgcc` and never `-lgcc_s`:

    $ x86_64-unknown-netbsd-g++ -### eh.cc
    collect2 ... -lstdc++ -lm -lgcc -lc -lgcc

Both halves have to move together. Build the shared library without
changing the specs and the unwinder leaves `libgcc.a` while the specs
still name it:

    libgcc.a         _Unwind_RaiseException: absent
    libgcc_eh.a      _Unwind_RaiseException: present
    libgcc_s.so.1    _Unwind_RaiseException: present

so every throwing C++ program fails to link and `rustc` fails on
`-lgcc_s` outright. Either standard arm would do, `-lgcc_s -lgcc` shared
or `-lgcc -lgcc_eh` static; the halves disagreeing is what breaks.

`--disable-shared` was passed to libgcc with the comment "Do not have
dynamic linker without libc". That does not hold: the monolithic build
ships `libgcc_s` even from its *nolibc* cross stage, and the result needs
nothing at run time --

    $ readelf -d .../nolibc-gcc-15.3.0-libgcc/.../libgcc_s.so.1
     0x...0e (SONAME)  Library soname: [libgcc_s.so.1]
    (no NEEDED entries at all)

What genuinely blocks it is libgcc's own makefile: `SHLIB_LC` defaults to
`-lc`, so the `libgcc_s.so` rule links against a libc that does not exist
yet and fails with `cannot find -lc`. The monolithic build clobbers that
variable -- see `common/libgcc-buildstuff.nix` -- so reuse that helper
rather than reinventing it. On the compiler side the flag derives from
`hasSharedLibraries`, as the monolithic build does, so a target genuinely
without shared libraries keeps the old behaviour; it is spelled
`enableTargetShared` there because it describes the target's libgcc
rather than anything about the compiler being built.

Verified on `x86_64-unknown-netbsd`, where `libgcc_s.so.1` and the
`GROUP ( libgcc_s.so.1 -lgcc )` script now appear in the output, and by
building `stdenv.cc` for `aarch64-unknown-linux-gnu` and
`aarch64-unknown-linux-musl`.

Assisted-by: Claude Code (Claude Opus 5)
2026-08-12 16:59:29 -04:00
Stefan Frijters
39953932fe glibc: enable structuredAttrs 2026-08-02 20:18:37 +02:00
Maximilian Bosch
2078e14914 glibc: fix CVE-2026-5435 and CVE-2026-6238 (#537324) 2026-07-11 14:53:58 +00:00
Maximilian Bosch
a6735426ca set default zonedir to match fhs (#491193) 2026-07-04 09:18:03 +00:00
Matthew Donoughe
8746d3caee glibc: set default zonedir to match fhs 2026-07-03 15:01:11 -04:00
Julian Stecklina
8515b91b88 glibc: fix CVE-2026-5435 and CVE-2026-6238
The fixes were backported from glibc master and had some slight
conflicts.
0001-resolv-Check-for-inet_ntop-failure-in-ns_sprintrrf.patch was
backported to avoid having to modify the fix for CVE-2026-6238.
2026-07-01 10:47:23 +02:00
zowoq
bbacb13154 glibc: 2.42-61 -> 2.42-67
(cherry picked from commit 4a8e8392a4)
(cherry picked from commit e0c442323b)
2026-06-22 08:15:14 +02:00
zowoq
4a8e8392a4 glibc: 2.42-61 -> 2.42-67 2026-05-19 16:51:53 +10:00
Maximilian Bosch
c66e479167 glibc: 2.42-58 -> 2.42-61, fixes CVE-2026-4438
Wasn't backported to the 2.42 branch when I bumped for CVE-2026-4437 (#503779).
2026-04-04 08:25:52 +02:00
Maximilian Bosch
d8593ca802 glibc: 2.42-51 -> 2.42-58, fix CVE-2026-4437
Closes #502536
2026-03-26 16:54:01 +01:00
nixpkgs-ci[bot]
23ee7d594c Merge master into staging-next 2026-03-14 00:21:49 +00:00
Alexander Bantyev
2839911e81 various: add security-review team as a maintainer
Adds the @NixOS/security-review team as a maintainer to multiple
packages deemed to be important security-wise.

For the motivation of the package list, see:
https://github.com/NixOS/nixpkgs/issues/494349#issuecomment-4005099033
2026-03-05 15:19:44 +01:00
Maximilian Bosch
b8a75f52fa glibc: add gettext to nativeBuildInputs (#493023) 2026-02-28 19:38:52 +00:00
David Wronek
b7e62e3e73 glibc: add gettext to nativeBuildInputs
The `gettext` package is required in order to build and install the libc
message catalogs.

Previously, glibc was falling back to the C locale, even though the
default locale has been changed (e.g. to de_DE.UTF-8):
```
rm: das Entfernen von 'file' ist nicht möglich: No such file or directory
```

With this change, the whole string will be translated to the desired
locale:
```
rm: das Entfernen von 'file' ist nicht möglich: Datei oder Verzeichnis nicht gefunden
```

Signed-off-by: David Wronek <david.wronek@mainlining.org>
2026-02-22 13:59:45 +01:00
Maximilian Bosch
7ba104638e glibc: 2.42-50 -> 2.42-51, fixes CVE-2025-15281
Closes #482394

Seems like low-severity, given

> There is no known application impact for this CVE, and the
> feature is generally non-functional with the two flags.

(from https://sourceware.org/bugzilla/show_bug.cgi?id=33814)
2026-01-22 09:42:33 +01:00
Maximilian Bosch
809c1fc759 glibc: 2.42-47 -> 2.42-50, fixes CVE-2026-0915, CVE-2026-0861
Closes #480802
2026-01-17 08:00:47 +01:00
K900
055ff17e06 glibc: fix path derp on cross 2026-01-15 11:20:38 +03:00
Maximilian Bosch
6585c8e80a glibc: make it easier to work with a dev shell
Creating the build directory in `..` may be OK in a sandbox, but this
makes it unnecessarily annoying when trying to work with this in a
source-checkout.

Hence, move the `build/` directory into the source tree.
2026-01-03 20:39:43 +01:00
Maximilian Bosch
190f166df8 glibc: 2.40-66 -> 2.42-47
Announcements:
* https://lists.gnu.org/archive/html/info-gnu/2025-01/msg00014.html
* https://lists.gnu.org/archive/html/info-gnu/2025-07/msg00011.html
2025-12-30 14:57:10 +01:00
Ihar Hrachyshka
567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00
Maximilian Bosch
700d7ec879 glibcLocales: re-enable parallel build
This was originally turned off in #245360 because the approach was
non-reproducible, i.e. all N concurrent jobs were racing to update
`locale-archive`.

glibc's localedef allows to separate the build from the install, i.e.
`localedef --no-archive` allows to only perform the build of the locale
which can be parallelized again. After that, a single process adds all
newly built locales into the archive.

This isn't supported by the Makefiles in upstream glibc yet[1], hence
the additional patches.

For me, this reduces the build-time of `pkgs.glibcLocales` from ~7min to
slightly under 1min.

[1] https://sourceware.org/pipermail/libc-alpha/2025-October/170803.html
2025-10-05 23:00:57 +02:00
Maximilian Bosch
7c104c9ba3 glibc: 2.40-66 -> 2.40-142, fix CVE-2025-8058
See https://nvd.nist.gov/vuln/detail/CVE-2025-8058

Updating to the latest patch-level of the 2.40 branch to address this.
2025-07-24 20:07:04 +02:00
Wolfgang Walther
90604d95bc Merge branch 'staging-next' into staging 2025-07-24 14:33:09 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Dmitry Bogatov
2a9a83e489 glibc: Fix build with gcc-15 2025-07-19 13:13:31 +00:00
Alexander Bantyev
22e563fc3d glibc: add comments describing the patches
This simply adds some comments describing previously undocumented
patches.
2025-07-01 16:48:42 +04:00
Winter
05482c6b79 glibc: allow easier overriding of linux headers package
Before this change, one would have to `callPackage` `common.nix` manually,
but now this can be done via `glibc.override`.
2025-06-04 11:31:43 -04:00
Thomas Gerbet
ca851b6f12 glibc: 2.40-36 -> 2.40-66
Fixes CVE-2025-0395 / GLIBC-SA-2025-0001
https://sourceware.org/git/?p=glibc.git;a=blob;f=advisories/GLIBC-SA-2025-0001;h=45f8b8f181fa024611452518ca0147ede1b88c47;hb=d9dcfe766eb9adcf9b1143112b569ac34ea9a9e6
https://www.openwall.com/lists/oss-security/2025/01/22/4
2025-01-23 21:23:13 +01:00
Martin Joerg
7498f431c8 glibc: avoid overriding makeFlags
fixes regression introduced in #357052
2024-12-29 18:40:29 +00:00
Silvan Mosberger
667d42c00d treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 57b193d8dd
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00
Wolfgang Walther
d86588d230 treewide: improve prepending and appending derivation arguments in bash code
Those would be problematic with __structuredAttrs turned on, because
they'd turn those nice bash arrays back into strings - and potentially
lose some of the values on the way.
2024-11-25 09:09:23 +01:00
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
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
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
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
Connor Baker
2b47345ff5 glibc: add NVCC include guards to fix ARM CUDA compilation 2023-11-06 00:53:11 +00: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