Skip to content

Integer overflow error after updating to NixOS 25.05 #85

@eduhoribe

Description

@eduhoribe

I recently updated my system from 24.11 to 25.05 and everything seems to have gone smoothly, but today I tried to do another update and got this error:

error:
       [...]while evaluating definitions from `/nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/nixos/modules/system/etc/etc.nix':

       … while evaluating the option `environment.etc."modprobe.d/kvmfr.conf".source':

       … while evaluating definitions from `/nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/nixos/modules/system/etc/etc.nix':

       … while evaluating the option `environment.etc."modprobe.d/kvmfr.conf".text':

       … while evaluating definitions from `/nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/flake.nix#nixosModules.vfio':while evaluating the option `virtualisation.kvmfr.devices."[definition 1-entry 1]".size':

       … while evaluating definitions from `/nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/flake.nix#nixosModules.vfio':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: integer overflow in multiplying 127 * 285870213051386505

Strangely enough, if I go back to the previous version (still 25.05, just not the latest one), it still builds successfully, but the nix flake check command fails with pretty much the same error.

Looking at the stack trace, it seems that the error is being thrown by the following line:

std.num.pow 2 (std.num.bits.bitSize - std.num.bits.countLeadingZeros n);

Maybe the std.num.bits.countLeadingZeros call is giving a way bigger number now, but I'm not 100% sure if that's the case...

Here is the partial output of the nix flake check --show-trace:

"Full" stacktrace
    [...]while calling anonymous lambda
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:273:71:
          272|           # For definitions that have an associated option
          273|           declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
             |                                                                       ^
          274|

       … while evaluating the attribute 'value'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1084:7:
         1083|     // {
         1084|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1085|       inherit (res.defsFinal') highestPrio;while evaluating the option `environment.etc."modprobe.d/kvmfr.conf".source':

       (13 duplicate frames omitted)while evaluating a branch condition
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1207:7:
         1206|     else if def._type or "" == "if" then
         1207|       if isBool def.condition then
             |       ^
         1208|         if def.condition then dischargeProperties def.content else [ ]while calling the 'isBool' builtin
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1207:10:
         1206|     else if def._type or "" == "if" then
         1207|       if isBool def.condition then
             |          ^
         1208|         if def.condition then dischargeProperties def.content else [ ]while evaluating the attribute 'condition'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1363:13:
         1362|     _type = "if";
         1363|     inherit condition content;
             |             ^
         1364|   };from call site
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/nixos/modules/system/etc/etc.nix:225:36:
          224|                 target = lib.mkDefault name;
          225|                 source = lib.mkIf (config.text != null) (
             |                                    ^
          226|                   letwhile calling anonymous lambda
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/attrsets.nix:1182:17:
         1181|         mapAttrs (
         1182|           name: value:
             |                 ^
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) valuefrom call site
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/attrsets.nix:1183:85:
         1182|           name: value:
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
             |                                                                                     ^
         1184|         );while calling anonymous lambda
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:273:71:
          272|           # For definitions that have an associated option
          273|           declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
             |                                                                       ^
          274|

       … while evaluating the attribute 'value'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1084:7:
         1083|     // {
         1084|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1085|       inherit (res.defsFinal') highestPrio;while evaluating the option `environment.etc."modprobe.d/kvmfr.conf".text':

       (10 duplicate frames omitted)while evaluating definitions from `/nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/flake.nix#nixosModules.vfio':from call site
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1110:80:
         1109|               }
         1110|           ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                ^
         1111|         ) defs;while calling 'dischargeProperties'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1203:5:
         1202|   dischargeProperties =
         1203|     def:
             |     ^
         1204|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1204:5:
         1203|     def:
         1204|     if def._type or "" == "merge" then
             |     ^
         1205|       concatMap dischargeProperties def.contentswhile evaluating the attribute 'value'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:770:21:
          769|             inherit (module) file;
          770|             inherit value;
             |                     ^
          771|           }) module.configwhile calling the 'concatStringsSep' builtin
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:129:11:
          128|         options kvmfr static_size_mb=${
          129|           concatStringsSep "," (map (size: toString size) deviceSizes)
             |           ^
          130|         }while calling anonymous lambda
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:129:38:
          128|         options kvmfr static_size_mb=${
          129|           concatStringsSep "," (map (size: toString size) deviceSizes)
             |                                      ^
          130|         }while calling the 'toString' builtin
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:129:44:
          128|         options kvmfr static_size_mb=${
          129|           concatStringsSep "," (map (size: toString size) deviceSizes)
             |                                            ^
          130|         }while calling anonymous lambda
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:17:22:
           16|
           17|   deviceSizes = map (device: device.size) cfg.devices;
             |                      ^
           18|

       … from call site
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:17:30:
           16|
           17|   deviceSizes = map (device: device.size) cfg.devices;
             |                              ^
           18|

       … while calling anonymous lambda
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/attrsets.nix:1182:17:
         1181|         mapAttrs (
         1182|           name: value:
             |                 ^
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) valuefrom call site
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/attrsets.nix:1183:85:
         1182|           name: value:
         1183|           if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
             |                                                                                     ^
         1184|         );while calling anonymous lambda
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:273:71:
          272|           # For definitions that have an associated option
          273|           declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
             |                                                                       ^
          274|

       … while evaluating the attribute 'value'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1084:7:
         1083|     // {
         1084|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1085|       inherit (res.defsFinal') highestPrio;while evaluating the option `virtualisation.kvmfr.devices."[definition 1-entry 1]".size':

       (13 duplicate frames omitted)from call site
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1208:31:
         1207|       if isBool def.condition then
         1208|         if def.condition then dischargeProperties def.content else [ ]
             |                               ^
         1209|       elsewhile calling 'dischargeProperties'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1203:5:
         1202|   dischargeProperties =
         1203|     def:
             |     ^
         1204|     if def._type or "" == "merge" then

       … while evaluating a branch condition
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1204:5:
         1203|     def:
         1204|     if def._type or "" == "merge" then
             |     ^
         1205|       concatMap dischargeProperties def.contentswhile evaluating the attribute 'content'
         at /nix/store/mdcn81lf3rqdqg54834irvxmqvvwjrns-source/lib/modules.nix:1363:23:
         1362|     _type = "if";
         1363|     inherit condition content;
             |                       ^
         1364|   };from call site
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:100:43:
           99|       size =
          100|         mkIf (config.resolution != null) (sizeFromResolution config.resolution);
             |                                           ^
          101|     };while calling 'sizeFromResolution'
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:9:24:
            8|
            9|   sizeFromResolution = resolution:
             |                        ^
           10|     letfrom call site
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:15:8:
           14|       bytes = resolution.width * resolution.height * pixelSize * 2;
           15|     in ceilToPowerOf2 (bytes / 1024 / 1024 + 10);
             |        ^
           16|

       … while calling 'ceilToPowerOf2'
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:11:24:
           10|     let
           11|       ceilToPowerOf2 = n:
             |                        ^
           12|         std.num.pow 2 (std.num.bits.bitSize - std.num.bits.countLeadingZeros n);from call site
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:12:9:
           11|       ceilToPowerOf2 = n:
           12|         std.num.pow 2 (std.num.bits.bitSize - std.num.bits.countLeadingZeros n);
             |         ^
           13|       pixelSize = if resolution.pixelFormat == "rgb24" then 3 else 4;while calling 'pow'
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:123:16:
          122|   */
          123|   pow = base0: exponent0:
             |                ^
          124|     let pow' = x: exponent: res:

       … from call site
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:130:48:
          129|         else pow' (x * x) (bits.shiftRU exponent 1) res;
          130|     in if base0 == 0 || base0 == 1 then 1 else pow' base0 exponent0 1;
             |                                                ^
          131|

       … while calling 'pow''
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:124:29:
          123|   pow = base0: exponent0:
          124|     let pow' = x: exponent: res:
             |                             ^
          125|         if exponent == 0while evaluating a branch condition
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:125:9:
          124|     let pow' = x: exponent: res:
          125|         if exponent == 0
             |         ^
          126|           then reswhile calling the 'sub' builtin
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:12:45:
           11|       ceilToPowerOf2 = n:
           12|         std.num.pow 2 (std.num.bits.bitSize - std.num.bits.countLeadingZeros n);
             |                                             ^
           13|       pixelSize = if resolution.pixelFormat == "rgb24" then 3 else 4;from call site
         at /nix/store/z8x55rkzgm1sn9f1dikp17qczqr50im5-source/modules/kvmfr/default.nix:12:47:
           11|       ceilToPowerOf2 = n:
           12|         std.num.pow 2 (std.num.bits.bitSize - std.num.bits.countLeadingZeros n);
             |                                               ^
           13|       pixelSize = if resolution.pixelFormat == "rgb24" then 3 else 4;while calling 'countLeadingZeros'
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:705:27:
          704|       */
          705|       countLeadingZeros = x0:
             |                           ^
          706|         if x0 == 0while calling the 'bitXor' builtin
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:708:16:
          707|           then 64
          708|           else bitXor (bitScanReverse x0) 63;
             |                ^
          709|     };while evaluating the first argument passed to builtins.bitXorfrom call site
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:708:24:
          707|           then 64
          708|           else bitXor (bitScanReverse x0) 63;
             |                        ^
          709|     };while calling 'bitScanReverse'
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:682:24:
          681|       */
          682|       bitScanReverse = x0:
             |                        ^
          683|         letwhile calling the 'elemAt' builtin
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:695:16:
          694|             then 63
          695|           else builtins.elemAt debruijn (shiftRU (x6 * 285870213051386505) 58);
             |                ^
          696|

       … while evaluating the second argument passed to 'builtins.elemAt'from call site
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:695:42:
          694|             then 63
          695|           else builtins.elemAt debruijn (shiftRU (x6 * 285870213051386505) 58);
             |                                          ^
          696|

       … while calling 'shiftRU'
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:597:20:
          596|       */
          597|       shiftRU = x: n:
             |                    ^
          598|         if n == 0while evaluating a branch condition
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:604:14:
          603|           then 0
          604|         else if x < 0
             |              ^
          605|           then ((x + minInt) / (builtins.elemAt powtab n)) + builtins.elemAt powtab (63 - n)while calling the 'lessThan' builtin
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:604:19:
          603|           then 0
          604|         else if x < 0
             |                   ^
          605|           then ((x + minInt) / (builtins.elemAt powtab n)) + builtins.elemAt powtab (63 - n)while calling the 'mul' builtin
         at /nix/store/wnb63azsvs2pjq7c6dlqcrim4h9wi2ls-source/num.nix:695:54:
          694|             then 63
          695|           else builtins.elemAt debruijn (shiftRU (x6 * 285870213051386505) 58);
             |                                                      ^
          696|

       error: integer overflow in multiplying 127 * 285870213051386505

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