I'm not fully sure I understand why (although this issue in nixpkgs might be related NixOS/nixpkgs#338511)
but the nvidia-cdi-hook commands generated by calling cdi generate seem to fail in certain settings:
Here is the actual call that is used to generate the cdi json:
https://github.com/NixOS/nixpkgs/blob/85163d3c74112fa8033d18881af9410cebb38323/nixos/modules/services/hardware/nvidia-container-toolkit/cdi-generate.nix#L37
I don't get too much from the crashes (I have some core dumps, but looking at them didn't yield much). There is just a warning about stack smashing.
I'm assuming that this has something to do with dynamic linking and perhaps that environment that is being used by containerd when it is excuting runc, but its not at all obvious how to debug the issue.