Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu: 9.0.2 -> 9.1.0 #338598

Merged
merged 1 commit into from
Sep 5, 2024
Merged

qemu: 9.0.2 -> 9.1.0 #338598

merged 1 commit into from
Sep 5, 2024

Conversation

alyssais
Copy link
Member

@alyssais alyssais commented Aug 31, 2024

Description of changes

Fixes: CVE-2024-7409

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@alyssais alyssais changed the title qemu: 9.0.2 -> 9.1.0-rc4 qemu: 9.0.2 -> 9.1.0 Aug 31, 2024
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 11-100 10.rebuild-linux: 101-500 labels Aug 31, 2024
@alyssais alyssais requested a review from jcaesar August 31, 2024 12:58
@alyssais alyssais added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Aug 31, 2024
@risicle
Copy link
Contributor

risicle commented Aug 31, 2024

On macos 12 x86_64:

 ... qemu-9.1.0-rc4/include/qemu/osdep.h:803:5: error: call to undeclared function 'pthread_jit_write_protect_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
pthread_jit_write_protect_np(true);

@risicle
Copy link
Contributor

risicle commented Aug 31, 2024

Will look at patching CVE-2024-7409 for 24.05 unless you're ahead of me

@alyssais
Copy link
Member Author

It looked complicated, like it was fixed over a number of commits. I assume it'll be in the next stable release anyway?

@alyssais
Copy link
Member Author

On macos 12 x86_64:

 ... qemu-9.1.0-rc4/include/qemu/osdep.h:803:5: error: call to undeclared function 'pthread_jit_write_protect_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
pthread_jit_write_protect_np(true);

@reckenrode suggested I try overriding the SDK, so I've pushed that now (not tested).

@risicle
Copy link
Contributor

risicle commented Aug 31, 2024

I'm not sure it's that complicated beyond being split across two commits, but yes I'd hope it would be in a 9.0.3, though don't know when to expect that.

@risicle
Copy link
Contributor

risicle commented Aug 31, 2024

I'm recalling all the sdk-overriding fun we had with the last qemu bump - it was a big struggle.

@reckenrode
Copy link
Contributor

I recall some issues too. I’ll check on my SDK refactor branch once I have a working stdenv again. Once the Darwin refactor lands, you’ll be able to add apple-sdk_11 as a build input, and that’s it. You get the 11.3 SDK unless something propagated a newer version to you (e.g., Swift will propagate the 13.3 SDK).

See https://discourse.nixos.org/t/on-the-future-of-darwin-sdks-or-how-you-can-stop-worrying-and-put-the-sdk-in-build-inputs/50574 for more information on the Darwin refactor.

@Izorkin
Copy link
Contributor

Izorkin commented Aug 31, 2024

It works for me.

@emilazy emilazy force-pushed the qemu-9.1.0 branch 2 times, most recently from 3343fa7 to cfac202 Compare August 31, 2024 19:23
@emilazy
Copy link
Member

emilazy commented Aug 31, 2024

I fixed it. Upstream only support alive macOS releases and aggressively remove conditionals, so I’ve bumped to their (effective) requirements rather than vendoring a bunch more patches to revert their changes and potentially remove features.

emilazy added a commit to emilazy/nixpkgs that referenced this pull request Aug 31, 2024
For a long time now, the SDK and minimum target version for
`x86_64-darwin` has been stuck on macOS 10.12. In the past, the minimum
SDK was updated quite regularly; at first, the current situation was
just because updating the SDKs was excessively burdensome and nobody
was up for doing the work, but the introduction of `aarch64-darwin`
with its macOS 11 default SDK has resulted in a long‐term fracture
of the two platforms.

Per <https://endoflife.date/macos>, macOS 10.12 has not received
an update since 2017 and went out of security support 5 years
ago. Trying to support it in Nixpkgs has been a large burden on the
Darwin maintainers, resulting in workarounds, porting work, and even
patching functionality out of applications. The existence of Nix
users using a macOS version this old is, to my knowledge, entirely
theoretical, and we pay in both maintenance costs and functionality:
for instance, applications built for `x86_64-darwin` do not support
automatic dark mode switching by default.

This situation has always been suboptimal, but it is
now becoming untenable. Python, a critical component
of the Nixpkgs standard environment for builds, is
dropping support for versions older than 10.13 in 3.13:
<https://www.python.org/downloads/release/python-3130rc1/>. Qt 6 only
supports macOS 11 and newer. libuv only supports the versions Apple
does, and is a ticking time bomb due to its use in the standard
environment. QEMU only supports the last two macOS releases, and
won’t build with an SDK older than macOS 12; we previously vendored
a set of backporting changes and functionality‐removing reverts
to keep it building for 10.12, but this also became overly onerous,
and we gave up in <NixOS#338598>.

`x86_64-darwin` is a platform with a limited upstream future. Apple no
longer sells any hardware that runs it natively, and it is unclear how
much longer they will support it in the operating system. There are
still many users of the platform, myself included, so we shouldn’t
drop support for it prematurely, but it’s unreasonable to try and
patch the entire world to keep it supporting insecure versions of
the OS that only run on hardware that is no longer sold.

Therefore, this adds a release note to warn users ahead of time that
25.05 will only support macOS 11 and newer, as suggested by the 24.05
release team when the possibility of bumping the required version
was raised.

Why target Big Sur, rather than any other version? The
reason is simple: it’s the same SDK and deployment target as
`aarch64-darwin`. There are many packages that work on `aarch64-darwin`
but not `x86_64-darwin`, and Darwin maintainers frequently need to be
called in to fix things that work fine on the newer platform but not
the older one. This change will increase the health of `x86_64-darwin`
by aligning the SDK versions and support between the two platforms;
the vast majority of packages that work on one will Just Work on the
other. macOS 11 is almost four years old and has itself been out of
security support for a year now, but as the first version to support
Apple Silicon, it’s a far more compatible base for us to build our
Darwin packages for. Any future change in supported versions should
be synchronized between the two Darwin architectures.

When 25.05 is released, users on old, unsupported versions of macOS
will have the following options:

* Update to a new macOS version. For users that are on hardware
  that Apple has dropped support for, OpenCore Legacy Patcher
  (<https://dortania.github.io/OpenCore-Legacy-Patcher/>) can enable
  the use of newer macOS versions on hardware even older than 10.12
  supports.

* Install NixOS. That obviously precludes the use of macOS software
  (though most of that software has already dropped support for 10.12),
  but will give users a secure, supported operating system that we
  can actually own the support for going forward.

* Keep using 24.11 forever. Since they’re not getting updates
  to their OS and core applications anyway, this is likely to be
  acceptable to many users.

* Switch to MacPorts. They support all the way back to 10.6 for
  `x86_64-darwin` by building packages separately for every OS release,
  though not every package is available for every version.

* Send patches. We *may* accept non‐invasive patches to keep
  certain critical packages (such as the core `stdenv` packages)
  building for old OS versions, on a case‐by‐case basis, but we
  can’t guarantee it. This will ultimately have to be a decision
  made by package maintainers and personally I doubt this will be a
  viable path to sustainably support older versions.
@willcohen
Copy link
Contributor

I think this is a lovely move!

@risicle
Copy link
Contributor

risicle commented Sep 1, 2024

(on nixos x86_64, nixpkgs-review reveals no new failures, built qemu.tests, qemu_full.tests, pkgsi686Linux.qemu.tests, pkgsCross.aarch64-multiplatform.qemu)

@risicle
Copy link
Contributor

risicle commented Sep 1, 2024

nixpkgs-review reveals no new failures, macos 12 x86_64

The macOS deployment target has been set to 12.0, and the collection
of patches and reverts to keep older macOS versions working has been
dropped, as maintaining what is effectively a fork of QEMU solely for
the sake of versions no longer supported by Apple has become untenable.
It may or may not still work on older macOS versions, potentially with
reduced functionality. Upstream only officially supports the latest
two versions of macOS, so this is still extending support further back
than QEMU will support. To continue supporting back to macOS 10.12,
at least the following upstream commits would have to be reverted,
and possibly more:

* <https://gitlab.com/qemu-project/qemu/-/commit/2d27c91e2b72ac7a65504ac207c89262d92464eb>
* <https://gitlab.com/qemu-project/qemu/-/commit/e9c9d8dc3ba993384bc9553b617120ad4717345c>
* <https://gitlab.com/qemu-project/qemu/-/commit/7b60b971cc2f52ed2a69006a2ad709df2831cd67>

However, if you want to do that, you should be prepared to take up the
burden of maintaining the monotonically‐increasing set of patches
that will be required to keep this working in future.

Fixes: CVE-2024-7409
Co-authored-by: Emily <vcs@emily.moe>
@alyssais alyssais marked this pull request as ready for review September 4, 2024 21:40
@ofborg ofborg bot requested a review from SigmaSquadron September 4, 2024 22:39
@alyssais
Copy link
Member Author

alyssais commented Sep 5, 2024

@ofborg test cage cagebreak cloud-init-hostname cloud-init mtp os-prober phosh sway systemd-initrd-luks-fido2 tinywl virtualbox

@alyssais alyssais merged commit 8ce7f9f into NixOS:master Sep 5, 2024
26 of 30 checks passed
@alyssais alyssais deleted the qemu-9.1.0 branch September 5, 2024 14:38
@GiyoMoon
Copy link
Contributor

GiyoMoon commented Sep 9, 2024

Hey, qemu 9.1.0 fails to build on my system.

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.6.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.20.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
error: builder for '/nix/store/czyw7yx2ywwf7bzndsdkmc9zlfsh5qpa-qemu-9.1.0.drv' failed with exit code 1;
       last 25 log lines:
       > [958/6499] Compiling C object libblock.a.p/block_monitor_bitmap-qmp-cmds.c.o
       > [959/6499] Compiling C object libblock.a.p/block_file-posix.c.o
       > FAILED: libblock.a.p/block_file-posix.c.o
       > clang -Ilibblock.a.p -I. -I.. -Iqapi -Itrace -Iui -Iui/shader -Iblock -I/nix/store/jcjsb1j4wgisax1yxg70fqkns226a1a7-zstd-1.5.6-dev/include -I/nix/store/msk5fbqh4w4sr4sn9p9hm8fnmk2d4f65-zlib-1.3.1-dev/include -I/nix/store/ms2wc83ixqvv9ynmwr3z7ki0fd8q4hnm-libiscsi-1.20.0/include -I/nix/store/g4zbipp4xgqynsss9sb068hm2khp7jij-curl-8.9.1-dev/include -I/nix/store/9n38970sj7ygcj02gb0cp3d4f6nd9crx-glib-2.80.4-dev/include/glib-2.0 -I/nix/store/7djvgxggk62mmpy877rs6kjy8nfdj3xa-glib-2.80.4/lib/glib-2.0/include -I/nix/store/9n38970sj7ygcj02gb0cp3d4f6nd9crx-glib-2.80.4-dev/include -fdiagnostics-color=auto -Wall -Winvalid-pch -std=gnu11 -O2 -g -fstack-protector-strong -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-security -Wformat-y2k -Wignored-qualifiers -Winit-self -Wmissing-format-attribute -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings -Wno-gnu-variable-sized-type-not-at-end -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value -Wno-string-plus-int -Wno-tautological-type-limit-compare -Wno-typedef-redefinition -iquote . -iquote /private/tmp/nix-build-qemu-9.1.0.drv-0/qemu-9.1.0 -iquote /private/tmp/nix-build-qemu-9.1.0.drv-0/qemu-9.1.0/include -iquote /private/tmp/nix-build-qemu-9.1.0.drv-0/qemu-9.1.0/host/include/aarch64 -iquote /private/tmp/nix-build-qemu-9.1.0.drv-0/qemu-9.1.0/host/include/generic -iquote /private/tmp/nix-build-qemu-9.1.0.drv-0/qemu-9.1.0/tcg/aarch64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-common -fwrapv -fno-pie -ftrivial-auto-var-init=zero -fzero-call-used-regs=used-gpr -MD -MQ libblock.a.p/block_file-posix.c.o -MF libblock.a.p/block_file-posix.c.o.d -o libblock.a.p/block_file-posix.c.o -c ../block/file-posix.c
       > In file included from ../block/file-posix.c:51:
       > In file included from /nix/store/104lz9wl5cb0wm11cqfmx29h0q07qav1-apple-framework-IOKit-12.3/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:49:
       > /nix/store/104lz9wl5cb0wm11cqfmx29h0q07qav1-apple-framework-IOKit-12.3/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:81:49: error: expected ';' after top level declarator
       > typedef mach_vm_address_t       IOVirtualAddress __kernel_ptr_semantics;
       >                                                 ^
       > In file included from ../block/file-posix.c:51:
       > In file included from /nix/store/104lz9wl5cb0wm11cqfmx29h0q07qav1-apple-framework-IOKit-12.3/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:52:
       > /nix/store/104lz9wl5cb0wm11cqfmx29h0q07qav1-apple-framework-IOKit-12.3/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:120:53: error: expected ';' after top level declarator
       > typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;
       >                                                     ^
       > 2 errors generated.
       > [960/6499] Compiling C object libblock.a.p/block_vvfat.c.o
       > [961/6499] Compiling C object libblockdev.a.p/job-qmp.c.o
       > [962/6499] Compiling C object libblock.a.p/block_curl.c.o
       > [963/6499] Compiling C object libblockdev.a.p/block_export_export.c.o
       > [964/6499] Compiling C object libblockdev.a.p/iothread.c.o
       > [965/6499] Compiling C object libblockdev.a.p/blockdev-nbd.c.o
       > [966/6499] Compiling C object libblock.a.p/block_iscsi.c.o
       > [967/6499] Compiling C object libblockdev.a.p/blockdev.c.o
       > [968/6499] Compiling C object libblockdev.a.p/nbd_server.c.o
       > ninja: build stopped: subcommand failed.
       For full logs, run 'nix-store -l /nix/store/czyw7yx2ywwf7bzndsdkmc9zlfsh5qpa-qemu-9.1.0.drv'.

@lunik1
Copy link
Contributor

lunik1 commented Sep 9, 2024

I've seen the same issue

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.6.0, macOS 14.6.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

@alyssais
Copy link
Member Author

alyssais commented Sep 9, 2024

My understanding is that should have been fixed by #340131.

@GiyoMoon
Copy link
Contributor

GiyoMoon commented Sep 9, 2024

@alyssais oh, I was on nixos-unstable which doesn't include this fix yet it seems. Switching to nixpkgs-unstable fixed it! Thanks

@lunik1
Copy link
Contributor

lunik1 commented Sep 9, 2024

Ah yes, builds on master for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.severity: security Issues which raise a security issue, or PRs that fix one 10.rebuild-darwin: 11-100 10.rebuild-linux: 101-500 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants