diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-04-12 23:04:49 +0200 |
---|---|---|
committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2020-05-01 08:10:50 +0200 |
commit | 3dbfab479f3eb4aa4f751f9365b7fe1f14254b3c (patch) | |
tree | 4140d5e8ee0585bef9984f93ad8afda1ce79a20f /gnu/packages/patches/libtirpc-hurd-client.patch | |
parent | 2e463d6e2cb2bc468926e8ed1a6ed77d9ca01441 (diff) |
gnu: Add libtirpc/hurd.
* gnu/packages/onc-rpc.scm (libtirpc/hurd): New variable.
* gnu/packages/patches/libtirpc-hurd-client.patch,
gnu/packages/patches/libtirpc-hurd.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/patches/libtirpc-hurd-client.patch')
-rw-r--r-- | gnu/packages/patches/libtirpc-hurd-client.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gnu/packages/patches/libtirpc-hurd-client.patch b/gnu/packages/patches/libtirpc-hurd-client.patch new file mode 100644 index 0000000000..526ad262d2 --- /dev/null +++ b/gnu/packages/patches/libtirpc-hurd-client.patch @@ -0,0 +1,50 @@ +Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/06-hurd-client-port.diff + +Description: Fix client code for hurd, avoiding malloc overflow + When trying to setup a inet connection, it happens the following: + - in libtirp, src/clnt_vc.c, clnt_vc_create gets called + - when trying to allocate vc_fd_locks, __rpc_dtbsize() is used as size + for that array of fd locks + - __rpc_dtbsize(), in src/rpc_generic.c, queries using rlimit the + maximum (rlim_max) number of file descriptors (RLIMIT_NOFILE): + - on Linux, the default is { rlim_cur = 1024, rlim_max = 4096 } + - on kFreeBSD, the default is { rlim_cur = 1024, rlim_max = 1024 } + - on Hurd, the default is { rlim_cur = 1024, rlim_max = RLIM_INFINITY } + meaning that on Hurd the memory allocation fails (as + __rpc_dtbsize() * sizeof(int) overflows and is negative) + + Change libtiprc so __rpc_dtbsize falls back on rlim_cur if rlim_max + is unlimited. + + This patch fixes the client connection using inet sockets; local unix + sockets are not working, for two reasons so far: + - getpeername on them gives EOPNOTSUPP + - SO_REUSEADDR is not implemented for them +Author: Pino Toscano <pino@debian.org> + +Bug-Debian: http://bugs.debian.org/739674 +Forwarded: no +Reviewed-By: Petter Reinholdtsen +Last-Update: 2014-03-03 + +--- a/src/rpc_generic.c ++++ b/src/rpc_generic.c +@@ -107,12 +107,17 @@ + { + static int tbsize; + struct rlimit rl; ++ rlim_t lim; + + if (tbsize) { + return (tbsize); + } + if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { +- return (tbsize = (int)rl.rlim_max); ++ lim = rl.rlim_max; ++ if (lim == RLIM_INFINITY) { ++ lim = rl.rlim_cur; ++ } ++ return (tbsize = (int)lim); + } + /* + * Something wrong. I'll try to save face by returning a |