lol

djbdns: fix crash due to data ulimit

This fixes: https://github.com/NixOS/nixpkgs/issues/119066.

When `djbdns` is repeatedly queried it will crash with:

```
mmap: tinydns (842): VmData 331776 exceed data ulimit 300000. Update limits or use boot option ignore_rlimit_data.
```

So we increase the softlimit from 300000 to 4500000 as suggested in
the issue.

The `tinydns` NixOS test has been extended with testing for the faulty
behaviour.

+35 -2
+15 -1
nixos/tests/tinydns.nix
··· 21 21 testScript = '' 22 22 nameserver.start() 23 23 nameserver.wait_for_unit("tinydns.service") 24 - nameserver.succeed("host bla.foo.bar 192.168.1.1 | grep '1\.2\.3\.4'") 24 + 25 + # We query tinydns a few times to trigger the bug: 26 + # 27 + # nameserver # [ 6.105872] mmap: tinydns (842): VmData 331776 exceed data ulimit 300000. Update limits or use boot option ignore_rlimit_data. 28 + # 29 + # which was reported in https://github.com/NixOS/nixpkgs/issues/119066. 30 + # Without the patch <nixpkgs/pkgs/tools/networking/djbdns/softlimit.patch> 31 + # it fails on the 10th iteration. 32 + nameserver.succeed( 33 + """ 34 + for i in {1..15}; do 35 + host bla.foo.bar 192.168.1.1 | grep '1\.2\.3\.4' 36 + done 37 + """ 38 + ) 25 39 ''; 26 40 })
+8 -1
pkgs/tools/networking/djbdns/default.nix
··· 19 19 sha256 = "0j3baf92vkczr5fxww7rp1b7gmczxmmgrqc8w2dy7kgk09m85k9w"; 20 20 }; 21 21 22 - patches = [ ./hier.patch ./fix-nix-usernamespace-build.patch ]; 22 + patches = [ 23 + ./hier.patch 24 + ./fix-nix-usernamespace-build.patch 25 + 26 + # To fix https://github.com/NixOS/nixpkgs/issues/119066. 27 + # Note that the NixOS test <nixpkgs/nixos/tests/tinydns.nix> tests for this. 28 + ./softlimit.patch 29 + ]; 23 30 24 31 postPatch = '' 25 32 echo gcc -O2 -include ${glibc.dev}/include/errno.h > conf-cc
+12
pkgs/tools/networking/djbdns/softlimit.patch
··· 1 + diff -Naur a/tinydns-conf.c b/tinydns-conf.c 2 + --- a/tinydns-conf.c 2001-02-11 21:11:45.000000000 +0000 3 + +++ b/tinydns-conf.c 2021-11-08 17:23:06.181385437 +0000 4 + @@ -46,7 +46,7 @@ 5 + 6 + start("run"); 7 + outs("#!/bin/sh\nexec 2>&1\nexec envuidgid "); outs(user); 8 + - outs(" envdir ./env softlimit -d300000 "); 9 + + outs(" envdir ./env softlimit -d4500000 "); 10 + outs(auto_home); outs("/bin/tinydns\n"); 11 + finish(); 12 + perm(0755);