Skip to content

Commit

Permalink
boehmgc: disable SOFT_VDB on powerpc64le for version 8.2.2
Browse files Browse the repository at this point in the history
Upstream has not yet fixed the bug:

  ivmai/bdwgc#376
  ivmai/bdwgc#479

However there is a recommended workaround:

  ivmai/bdwgc#479 (comment)

This adds `CFLAGS_EXTRA=-DNO_SOFT_VDB` to the `makeFlags`, which
prevents direct accesses to `/proc` being used for tracking dirtied
pages (which must be rescanned):

  https://github.com/ivmai/bdwgc/blob/54522af853de28f45195044dadfd795c4e5942aa/include/private/gcconfig.h#L741

The collector will fall back to using mprotect() to trigger page
faults on writes to clean pages and maintain its own dirty bits,
which is slightly less efficient but (in this case) more reliable.
Unreliable page-dirtiness bits can lead to use-after-free()
corruption; this is not a situation where disabling the tests is a
good idea.
  • Loading branch information
Adam Joseph authored and rtimush committed Sep 21, 2023
1 parent 85ab42b commit 8da983f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkgs/development/libraries/boehm-gc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional enableMmap "--enable-mmap"
++ lib.optional enableLargeConfig "--enable-large-config";

# this stanza can be dropped when a release fixes this issue:
# https://github.com/ivmai/bdwgc/issues/376
makeFlags = lib.optionals (stdenv.hostPlatform.isPower64 &&
lib.versionAtLeast finalAttrs.version "8.2.2")
[
# do not use /proc primitives to track dirty bits; see:
# https://github.com/ivmai/bdwgc/issues/479#issuecomment-1279687537
# https://github.com/ivmai/bdwgc/blob/54522af853de28f45195044dadfd795c4e5942aa/include/private/gcconfig.h#L741
"CFLAGS_EXTRA=-DNO_SOFT_VDB"
];

# `gctest` fails under emulation on aarch64-darwin
doCheck = !(stdenv.isDarwin && stdenv.isx86_64);

Expand Down

0 comments on commit 8da983f

Please sign in to comment.