Skip to content

gasket: fails to build with Linux 7.1 (zap_vma_ptes removed) #535359

Closed

Description

@evilbulgarian

Description

pkgs.linuxPackages.gasket fails to build with Linux kernel 7.1+ due to the removal of zap_vma_ptes from the kernel's exported symbol set.

Error

gasket_core.c: In function 'gasket_mm_unmap_region':
gasket_core.c:923:9: error: implicit declaration of function 'zap_vma_ptes' [-Wimplicit-function-declaration]
  923 |         zap_vma_ptes(vma, vma->vm_start + virt_offset,
      |         ^~~~~~~~~~~~

The patch we carry for kernel >= 6.13 does not address this. Attempting to use zap_vma_range (which is declared in include/linux/mm.h in 7.1) results in a secondary failure:

ERROR: modpost: "zap_vma_range" [gasket.ko] undefined!

zap_vma_range exists in the headers but is not exported to modules (EXPORT_SYMBOL), so it cannot be used by out-of-tree modules.

Fix

The correct replacement is zap_special_vma_range, which:

  • Has the same signature: void zap_special_vma_range(struct vm_area_struct *vma, unsigned long address, unsigned long size)
  • Is exported via EXPORT_SYMBOL_GPL(zap_special_vma_range) in mm/memory.c
  • Guards on VM_PFNMAP | VM_MIXEDMAP — satisfied for gasket because do_map_region() uses io_remap_pfn_range(), which sets VM_PFNMAP

Suggested addition to patches in pkgs/os-specific/linux/gasket/default.nix:

(fetchpatch2 {
  name = "linux-7.1-compat.patch";
  url = "...";  # needs upstream commit or local patch
  hash = "...";
})

With patch content:

--- a/src/gasket_core.c
+++ b/src/gasket_core.c
@@ -920,9 +920,15 @@
  	 *
  	 * Next multiple of y: ceil_div(x, y) * y
  	 */
-	zap_vma_ptes(vma, vma->vm_start + virt_offset,
-		     DIV_ROUND_UP(mappable_region.length_bytes, PAGE_SIZE) *
-		     PAGE_SIZE);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)
+	zap_special_vma_range(vma, vma->vm_start + virt_offset,
+			      DIV_ROUND_UP(mappable_region.length_bytes, PAGE_SIZE) *
+			      PAGE_SIZE);
+#else
+	zap_vma_ptes(vma, vma->vm_start + virt_offset,
+		     DIV_ROUND_UP(mappable_region.length_bytes, PAGE_SIZE) *
+		     PAGE_SIZE);
+#endif
 	return 0;
 }
 EXPORT_SYMBOL(gasket_mm_unmap_region);

Upstream status

The upstream repository https://github.com/google/gasket-driver was archived on April 18, 2026 and is now read-only. No kernel 7.x compatibility fixes are expected from upstream. We will need to carry this patch indefinitely in nixpkgs.

The KyleGospo/gasket-dkms fork (which we also referenced for previous compat patches) likewise has no 7.x fix at this time.

Workaround

Until this is fixed in nixpkgs, hosts using gasket can override the derivation locally:

boot.extraModulePackages = [
  (config.boot.kernelPackages.gasket.overrideAttrs (old: {
    patches = (old.patches or [ ]) ++ [ ./linux-7.1-compat.patch ];
  }))
];

cc @kylehendricks @booxter

Activity

  1. scottrknight commented on Jul 15, 2026

    @scottrknight

    Thanks for documenting this. I am using the KyleGospo DKMS package on fedora and just edited locally to get it working until (if) that package get fixed.

  2. added a commit that references this issue on Oct 29, 2026
    1615951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions