- From 2826a4b2e9152b50e7075cbad0f9dd87d9d85f7e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 31 Oct 2023 11:33:44 +0100
- Subject: [PATCH 1/9] cygwin/devel/msnfs41client.bash: Remove custom uid
- settings
- Remove custom uid/uid settings in msnfs41client.bash
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/devel/msnfs41client.bash | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index 454b4bc..da91627 100644
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -108,12 +108,11 @@ function nfsclient_rundeamon
- #
- if false ; then
- - gdb -ex=run --args nfsd_debug -d 0 --noldap --gid 1616 --uid 1616
- + gdb -ex=run --args nfsd_debug -d 0 --noldap #--gid 1616 --uid 1616
- else
- export _NT_ALT_SYMBOL_PATH="$(cygpath -w "$PWD");srv*https://msdl.microsoft.com/download/symbols"
- # use '!gflag +full;g' for heap tests, eats lots of memory
- - # use '!gflag +soe;sxe -c "kp;gn" *;g' to report exceptions and then continue
- - cdb -c '!gflag +soe;sxe -c "kp;gn" *;g' "$(cygpath -w "$PWD/nfsd_debug.exe")" -d 0 --noldap --gid 1616 --uid 1616
- + cdb -c '!gflag +soe;sxe -c "kp;gn" *;g' "$(cygpath -w "$PWD/nfsd_debug.exe")" -d 0 --noldap #--gid 1616 --uid 1616
- fi
- return $?
- }
- @@ -124,12 +123,11 @@ function nfsclient_system_rundeamon
- set -o nounset
- if false ; then
- - su_system gdb -ex=run --args nfsd_debug -d 0 --noldap --gid 1616 --uid 1616
- + su_system gdb -ex=run --args nfsd_debug -d 0 --noldap #--gid 1616 --uid 1616
- else
- export _NT_ALT_SYMBOL_PATH="$(cygpath -w "$PWD");srv*https://msdl.microsoft.com/download/symbols"
- # use '!gflag +full;g' for heap tests, eats lots of memory
- - # use '!gflag +soe;sxe -c "kp;gn" *;g' to report exceptions and then continue
- - su_system cdb -c '!gflag +soe;sxe -c "kp;gn" *;g' "$(cygpath -w "$PWD/nfsd_debug.exe")" -d 0 --noldap --gid 1616 --uid 1616
- + su_system cdb -c '!gflag +soe;sxe -c "kp;gn" *;g' "$(cygpath -w "$PWD/nfsd_debug.exe")" -d 0 --noldap #--gid 1616 --uid 1616
- fi
- return $?
- }
- --
- 2.42.0
- From e87c0a0d120783491031b33ac55bb2ec3ecc942a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 1 Nov 2023 13:17:06 +0100
- Subject: [PATCH 2/9] libtirpc: Re-enable |warnx()| for libtirpc
- |warnx()| rework in Win32-libtirpc:
- - Added Win32-specific |wintirpc_warnx()|
- - re-enable |warnx()| and use |wintirpc_warnx()|
- - added Win32-|assert()| macro, which uses |wintirpc_warnx()|
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- libtirpc/src/auth_unix.c | 13 +++++-----
- libtirpc/src/clnt_dg.c | 2 +-
- libtirpc/src/clnt_raw.c | 6 +++--
- libtirpc/src/crypt_client.c | 2 +-
- libtirpc/src/svc_dg.c | 20 +++++++--------
- libtirpc/src/svc_generic.c | 47 ++++++++++++++++++------------------
- libtirpc/src/svc_simple.c | 36 +++++++++++++--------------
- libtirpc/src/svc_vc.c | 26 +++++++++++---------
- libtirpc/src/wintirpc.c | 11 ++++++++-
- libtirpc/src/xdr.c | 4 +--
- libtirpc/src/xdr_array.c | 2 +-
- libtirpc/src/xdr_rec.c | 6 ++---
- libtirpc/src/xdr_reference.c | 2 +-
- libtirpc/tirpc/wintirpc.h | 10 ++++++++
- 14 files changed, 105 insertions(+), 82 deletions(-)
- diff --git a/libtirpc/src/auth_unix.c b/libtirpc/src/auth_unix.c
- index ff86956..e9e9fa4 100644
- --- a/libtirpc/src/auth_unix.c
- +++ b/libtirpc/src/auth_unix.c
- @@ -66,8 +66,10 @@
- #include <reentrant.h>
- //#include <sys/param.h>
- +#ifndef _WIN32
- #include <assert.h>
- -//#include <err.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- //#include <unistd.h>
- @@ -125,14 +127,14 @@ authunix_create(machname, uid, gid, len, aup_gids)
- auth = mem_alloc(sizeof(*auth));
- #ifndef _KERNEL
- if (auth == NULL) {
- - // XXX warnx("authunix_create: out of memory");
- + warnx("authunix_create: out of memory");
- goto cleanup_authunix_create;
- }
- #endif
- au = mem_alloc(sizeof(*au));
- #ifndef _KERNEL
- if (au == NULL) {
- - // XXX warnx("authunix_create: out of memory");
- + warnx("authunix_create: out of memory");
- goto cleanup_authunix_create;
- }
- #endif
- @@ -165,7 +167,7 @@ authunix_create(machname, uid, gid, len, aup_gids)
- au->au_origcred.oa_base = mem_alloc((u_int) len);
- #else
- if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
- - // XXX warnx("authunix_create: out of memory");
- + warnx("authunix_create: out of memory");
- goto cleanup_authunix_create;
- }
- #endif
- @@ -371,8 +373,7 @@ marshal_new_auth(auth)
- xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
- if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
- (! xdr_opaque_auth(xdrs, &(auth->ah_verf))))
- - assert(0); // XXX
- - // XXX warnx("auth_none.c - Fatal marshalling problem");
- + warnx("auth_none.c - Fatal marshalling problem");
- else
- au->au_mpos = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
- diff --git a/libtirpc/src/clnt_dg.c b/libtirpc/src/clnt_dg.c
- index e5b62ff..0e7427f 100644
- --- a/libtirpc/src/clnt_dg.c
- +++ b/libtirpc/src/clnt_dg.c
- @@ -300,7 +300,7 @@ clnt_dg_create(fd, svcaddr, program, version, sendsz, recvsz)
- return (cl);
- err1:
- - //warnx(mem_err_clnt_dg);
- + warnx(mem_err_clnt_dg);
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- err2:
- diff --git a/libtirpc/src/clnt_raw.c b/libtirpc/src/clnt_raw.c
- index 3953324..d97761b 100644
- --- a/libtirpc/src/clnt_raw.c
- +++ b/libtirpc/src/clnt_raw.c
- @@ -39,8 +39,10 @@
- #include <wintirpc.h>
- //#include <pthread.h>
- #include <reentrant.h>
- +#ifndef _WIN32
- #include <assert.h>
- -//#include <err.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <stdio.h>
- #include <stdlib.h>
- @@ -113,7 +115,7 @@ clnt_raw_create(prog, vers)
- call_msg.rm_call.cb_vers = (u_int32_t)vers;
- xdrmem_create(xdrs, clp->u.mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
- if (! xdr_callhdr(xdrs, &call_msg))
- - //warnx("clntraw_create - Fatal header serialization error.");
- + warnx("clntraw_create - Fatal header serialization error.");
- clp->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
- diff --git a/libtirpc/src/crypt_client.c b/libtirpc/src/crypt_client.c
- index 32023fb..73fa320 100644
- --- a/libtirpc/src/crypt_client.c
- +++ b/libtirpc/src/crypt_client.c
- @@ -63,7 +63,7 @@ _des_crypt_call(buf, len, dparms)
- break;
- }
- if (nconf == NULL) {
- - //warnx("getnetconfig: %s", nc_sperror());
- + warnx("getnetconfig: %s", nc_sperror());
- return(DESERR_HWERROR);
- }
- clnt = clnt_tp_create(NULL, CRYPT_PROG, CRYPT_VERS, nconf);
- diff --git a/libtirpc/src/svc_dg.c b/libtirpc/src/svc_dg.c
- index 8610c7a..b6bc541 100644
- --- a/libtirpc/src/svc_dg.c
- +++ b/libtirpc/src/svc_dg.c
- @@ -104,7 +104,7 @@ svc_dg_create(fd, sendsize, recvsize)
- socklen_t slen;
- if (!__rpc_fd2sockinfo(fd, &si)) {
- - // XXX warnx(svc_dg_str, svc_dg_err1);
- + warnx(svc_dg_str, svc_dg_err1);
- return (NULL);
- }
- /*
- @@ -113,7 +113,7 @@ svc_dg_create(fd, sendsize, recvsize)
- sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
- recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
- if ((sendsize == 0) || (recvsize == 0)) {
- - // XXX warnx(svc_dg_str, svc_dg_err2);
- + warnx(svc_dg_str, svc_dg_err2);
- return (NULL);
- }
- @@ -145,7 +145,7 @@ svc_dg_create(fd, sendsize, recvsize)
- xprt_register(xprt);
- return (xprt);
- freedata:
- - // XXX (void) warnx(svc_dg_str, __no_mem_str);
- + warnx(svc_dg_str, __no_mem_str);
- if (xprt) {
- if (su)
- (void) mem_free(su, sizeof (*su));
- @@ -392,13 +392,13 @@ svc_dg_enablecache(transp, size)
- mutex_lock(&dupreq_lock);
- if (su->su_cache != NULL) {
- - // XXX (void) warnx(cache_enable_str, enable_err, " ");
- + warnx(cache_enable_str, enable_err, " ");
- mutex_unlock(&dupreq_lock);
- return (0);
- }
- uc = ALLOC(struct cl_cache, 1);
- if (uc == NULL) {
- - // XXX warnx(cache_enable_str, alloc_err, " ");
- + warnx(cache_enable_str, alloc_err, " ");
- mutex_unlock(&dupreq_lock);
- return (0);
- }
- @@ -406,7 +406,7 @@ svc_dg_enablecache(transp, size)
- uc->uc_nextvictim = 0;
- uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS);
- if (uc->uc_entries == NULL) {
- - // XXX warnx(cache_enable_str, alloc_err, "data");
- + warnx(cache_enable_str, alloc_err, "data");
- FREE(uc, struct cl_cache, 1);
- mutex_unlock(&dupreq_lock);
- return (0);
- @@ -414,7 +414,7 @@ svc_dg_enablecache(transp, size)
- MEMZERO(uc->uc_entries, cache_ptr, size * SPARSENESS);
- uc->uc_fifo = ALLOC(cache_ptr, size);
- if (uc->uc_fifo == NULL) {
- - // XXX warnx(cache_enable_str, alloc_err, "fifo");
- + warnx(cache_enable_str, alloc_err, "fifo");
- FREE(uc->uc_entries, cache_ptr, size * SPARSENESS);
- FREE(uc, struct cl_cache, 1);
- mutex_unlock(&dupreq_lock);
- @@ -468,7 +468,7 @@ cache_set(xprt, replylen)
- vicp = &(*vicp)->cache_next)
- ;
- if (*vicp == NULL) {
- - // XXX warnx(cache_set_str, cache_set_err1);
- + warnx(cache_set_str, cache_set_err1);
- mutex_unlock(&dupreq_lock);
- return;
- }
- @@ -477,13 +477,13 @@ cache_set(xprt, replylen)
- } else {
- victim = ALLOC(struct cache_node, 1);
- if (victim == NULL) {
- - // XXX warnx(cache_set_str, cache_set_err2);
- + warnx(cache_set_str, cache_set_err2);
- mutex_unlock(&dupreq_lock);
- return;
- }
- newbuf = mem_alloc(su->su_iosz);
- if (newbuf == NULL) {
- - // XXX warnx(cache_set_str, cache_set_err3);
- + warnx(cache_set_str, cache_set_err3);
- FREE(victim, struct cache_node, 1);
- mutex_unlock(&dupreq_lock);
- return;
- diff --git a/libtirpc/src/svc_generic.c b/libtirpc/src/svc_generic.c
- index 80f5e87..47a12a3 100644
- --- a/libtirpc/src/svc_generic.c
- +++ b/libtirpc/src/svc_generic.c
- @@ -85,7 +85,7 @@ svc_create(dispatch, prognum, versnum, nettype)
- /* VARIABLES PROTECTED BY xprtlist_lock: xprtlist */
- if ((handle = __rpc_setconf(nettype)) == NULL) {
- - // XXX warnx("svc_create: unknown protocol");
- + warnx("svc_create: unknown protocol");
- return (0);
- }
- while ((nconf = __rpc_getconf(handle)) != NULL) {
- @@ -96,10 +96,10 @@ svc_create(dispatch, prognum, versnum, nettype)
- (void) rpcb_unset(prognum, versnum, nconf);
- if (svc_reg(l->xprt, prognum, versnum,
- dispatch, nconf) == FALSE) {
- - // XXX warnx(
- -// "svc_create: could not register prog %u vers %u on %s",
- -// (unsigned)prognum, (unsigned)versnum,
- -// nconf->nc_netid);
- + warnx(
- + "svc_create: could not register prog %u vers %u on %s",
- + (unsigned)prognum, (unsigned)versnum,
- + nconf->nc_netid);
- } else {
- num++;
- }
- @@ -112,7 +112,7 @@ svc_create(dispatch, prognum, versnum, nettype)
- if (xprt) {
- l = (struct xlist *)malloc(sizeof (*l));
- if (l == NULL) {
- - // XXX warnx("svc_create: no memory");
- + warnx("svc_create: no memory");
- mutex_unlock(&xprtlist_lock);
- return (0);
- }
- @@ -147,9 +147,9 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
- SVCXPRT *xprt;
- if (nconf == NULL) {
- - // XXX warnx(
- -// "svc_tp_create: invalid netconfig structure for prog %u vers %u",
- -// (unsigned)prognum, (unsigned)versnum);
- + warnx(
- + "svc_tp_create: invalid netconfig structure for prog %u vers %u",
- + (unsigned)prognum, (unsigned)versnum);
- return (NULL);
- }
- xprt = svc_tli_create(RPC_ANYFD, nconf, NULL, 0, 0);
- @@ -159,10 +159,10 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
- /*LINTED const castaway*/
- (void) rpcb_unset(prognum, versnum, (struct netconfig *) nconf);
- if (svc_reg(xprt, prognum, versnum, dispatch, nconf) == FALSE) {
- - // XXX warnx(
- -// "svc_tp_create: Could not register prog %u vers %u on %s",
- -// (unsigned)prognum, (unsigned)versnum,
- -// nconf->nc_netid);
- + warnx(
- + "svc_tp_create: Could not register prog %u vers %u on %s",
- + (unsigned)prognum, (unsigned)versnum,
- + nconf->nc_netid);
- SVC_DESTROY(xprt);
- return (NULL);
- }
- @@ -194,14 +194,14 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- if (fd == RPC_ANYFD) {
- if (nconf == NULL) {
- - // XXX warnx("svc_tli_create: invalid netconfig");
- + warnx("svc_tli_create: invalid netconfig");
- return (NULL);
- }
- fd = __rpc_nconf2fd(nconf);
- if (fd == -1) {
- - // XXX warnx(
- -// "svc_tli_create: could not open connection for %s",
- -// nconf->nc_netid);
- + warnx(
- + "svc_tli_create: could not open connection for %s",
- + nconf->nc_netid);
- return (NULL);
- }
- __rpc_nconf2sockinfo(nconf, &si);
- @@ -211,8 +211,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- * It is an open descriptor. Get the transport info.
- */
- if (!__rpc_fd2sockinfo(fd, &si)) {
- - // XXX warnx(
- -// "svc_tli_create: could not get transport information");
- + warnx("svc_tli_create: could not get transport information");
- return (NULL);
- }
- }
- @@ -227,8 +226,8 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- ss.ss_family = si.si_af;
- if (bind(_get_osfhandle(fd), (struct sockaddr *)(void *)&ss,
- (socklen_t)si.si_alen) == SOCKET_ERROR) {
- - // XXX warnx(
- -// "svc_tli_create: could not bind to anonymous port");
- + warnx(
- + "svc_tli_create: could not bind to anonymous port");
- goto freedata;
- }
- }
- @@ -237,8 +236,8 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- if (bind(_get_osfhandle(fd),
- (struct sockaddr *)bindaddr->addr.buf,
- (socklen_t)si.si_alen) == SOCKET_ERROR) {
- - // XXX warnx(
- -// "svc_tli_create: could not bind to requested address");
- + warnx(
- + "svc_tli_create: could not bind to requested address");
- goto freedata;
- }
- wintirpc_listen(fd, (int)bindaddr->qlen);
- @@ -270,7 +269,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- xprt = svc_dg_create(fd, sendsz, recvsz);
- break;
- default:
- - // XXX warnx("svc_tli_create: bad service type");
- + warnx("svc_tli_create: bad service type");
- goto freedata;
- }
- diff --git a/libtirpc/src/svc_simple.c b/libtirpc/src/svc_simple.c
- index 17ec027..3ad528e 100644
- --- a/libtirpc/src/svc_simple.c
- +++ b/libtirpc/src/svc_simple.c
- @@ -103,15 +103,15 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- extern mutex_t proglst_lock;
- if (procnum == NULLPROC) {
- - // XXXwarnx("%s can't reassign procedure number %u", rpc_reg_msg,
- -// NULLPROC);
- + warnx("%s can't reassign procedure number %u", rpc_reg_msg,
- + NULLPROC);
- return (-1);
- }
- if (nettype == NULL)
- nettype = "netpath"; /* The default behavior */
- if ((handle = __rpc_setconf(nettype)) == NULL) {
- - // XXX warnx(rpc_reg_err, rpc_reg_msg, __reg_err1);
- + warnx(rpc_reg_err, rpc_reg_msg, __reg_err1);
- return (-1);
- }
- /* VARIABLES PROTECTED BY proglst_lock: proglst */
- @@ -145,19 +145,19 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- if (svcxprt == NULL)
- continue;
- if (!__rpc_fd2sockinfo(svcxprt->xp_fd, &si)) {
- - // XXX warnx(rpc_reg_err, rpc_reg_msg, __reg_err2);
- + warnx(rpc_reg_err, rpc_reg_msg, __reg_err2);
- SVC_DESTROY(svcxprt);
- continue;
- }
- recvsz = __rpc_get_t_size(si.si_af, si.si_proto, 0);
- if (recvsz == 0) {
- - // XXX warnx(rpc_reg_err, rpc_reg_msg, __reg_err3);
- + warnx(rpc_reg_err, rpc_reg_msg, __reg_err3);
- SVC_DESTROY(svcxprt);
- continue;
- }
- if (((xdrbuf = malloc((unsigned)recvsz)) == NULL) ||
- ((netid = strdup(nconf->nc_netid)) == NULL)) {
- - // XXX warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
- + warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
- SVC_DESTROY(svcxprt);
- break;
- }
- @@ -180,9 +180,9 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- }
- if (!svc_reg(svcxprt, prognum, versnum, universal, nconf)) {
- - // XXX warnx("%s couldn't register prog %u vers %u for %s",
- -// rpc_reg_msg, (unsigned)prognum,
- -// (unsigned)versnum, netid);
- + warnx("%s couldn't register prog %u vers %u for %s",
- + rpc_reg_msg, (unsigned)prognum,
- + (unsigned)versnum, netid);
- if (madenow) {
- SVC_DESTROY(svcxprt);
- free(xdrbuf);
- @@ -193,7 +193,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- pl = malloc(sizeof (struct proglst));
- if (pl == NULL) {
- - // XXX warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
- + warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
- if (madenow) {
- SVC_DESTROY(svcxprt);
- free(xdrbuf);
- @@ -219,8 +219,8 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- mutex_unlock(&proglst_lock);
- if (done == FALSE) {
- - // XXX warnx("%s cant find suitable transport for %s",
- -// rpc_reg_msg, nettype);
- + warnx("%s cant find suitable transport for %s",
- + rpc_reg_msg, nettype);
- return (-1);
- }
- return (0);
- @@ -250,7 +250,7 @@ universal(rqstp, transp)
- if (rqstp->rq_proc == NULLPROC) {
- if (svc_sendreply(transp, (xdrproc_t) xdr_void, NULL) ==
- FALSE) {
- - // XXX warnx("svc_sendreply failed");
- + warnx("svc_sendreply failed");
- }
- return;
- }
- @@ -284,9 +284,9 @@ universal(rqstp, transp)
- return;
- }
- if (!svc_sendreply(transp, pl->p_outproc, outdata)) {
- - // XXX warnx(
- -// "rpc: rpc_reg trouble replying to prog %u vers %u",
- -// (unsigned)prog, (unsigned)vers);
- + warnx(
- + "rpc: rpc_reg trouble replying to prog %u vers %u",
- + (unsigned)prog, (unsigned)vers);
- mutex_unlock(&proglst_lock);
- return;
- }
- @@ -297,7 +297,7 @@ universal(rqstp, transp)
- }
- mutex_unlock(&proglst_lock);
- /* This should never happen */
- - // XXX warnx("rpc: rpc_reg: never registered prog %u vers %u",
- -// (unsigned)prog, (unsigned)vers);
- + warnx("rpc: rpc_reg: never registered prog %u vers %u",
- + (unsigned)prog, (unsigned)vers);
- return;
- }
- diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
- index fcb6ff3..5c57685 100644
- --- a/libtirpc/src/svc_vc.c
- +++ b/libtirpc/src/svc_vc.c
- @@ -49,8 +49,10 @@
- //#include <netinet/in.h>
- //#include <netinet/tcp.h>
- +#ifndef _WIN32
- #include <assert.h>
- -//#include <err.h>
- +#include <err.h>
- +#endif /* !_WIN32 */
- #include <errno.h>
- #include <fcntl.h>
- #include <stdio.h>
- @@ -156,7 +158,7 @@ svc_vc_create(fd, sendsize, recvsize)
- r = mem_alloc(sizeof(*r));
- if (r == NULL) {
- - // XXX warnx("svc_vc_create: out of memory");
- + warnx("svc_vc_create: out of memory");
- goto cleanup_svc_vc_create;
- }
- if (!__rpc_fd2sockinfo(fd, &si))
- @@ -166,7 +168,7 @@ svc_vc_create(fd, sendsize, recvsize)
- r->maxrec = __svc_maxrec;
- xprt = mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- - // XXX warnx("svc_vc_create: out of memory");
- + warnx("svc_vc_create: out of memory");
- goto cleanup_svc_vc_create;
- }
- xprt->xp_tp = NULL;
- @@ -180,12 +182,12 @@ svc_vc_create(fd, sendsize, recvsize)
- slen = sizeof (struct sockaddr_storage);
- if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&sslocal, &slen) == SOCKET_ERROR) {
- - // XXX warnx("svc_vc_create: could not retrieve local addr");
- + warnx("svc_vc_create: could not retrieve local addr");
- goto cleanup_svc_vc_create;
- }
- if (!__rpc_set_netbuf(&xprt->xp_ltaddr, &sslocal, sizeof(sslocal))) {
- - // XXX warnx("svc_vc_create: no mem for local addr");
- + warnx("svc_vc_create: no mem for local addr");
- goto cleanup_svc_vc_create;
- }
- xprt_register(xprt);
- @@ -218,21 +220,21 @@ svc_fd_create(fd, sendsize, recvsize)
- slen = sizeof (struct sockaddr_storage);
- if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR) {
- - // XXX warnx("svc_fd_create: could not retrieve local addr");
- + warnx("svc_fd_create: could not retrieve local addr");
- goto freedata;
- }
- if (!__rpc_set_netbuf(&ret->xp_ltaddr, &ss, sizeof(ss))) {
- - // XXX warnx("svc_fd_create: no mem for local addr");
- + warnx("svc_fd_create: no mem for local addr");
- goto freedata;
- }
- slen = sizeof (struct sockaddr_storage);
- if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR) {
- - // XXX warnx("svc_fd_create: could not retrieve remote addr");
- + warnx("svc_fd_create: could not retrieve remote addr");
- goto freedata;
- }
- if (!__rpc_set_netbuf(&ret->xp_rtaddr, &ss, sizeof(ss))) {
- - // XXX warnx("svc_fd_create: no mem for local addr");
- + warnx("svc_fd_create: no mem for local addr");
- goto freedata;
- }
- @@ -262,20 +264,20 @@ makefd_xprt(fd, sendsize, recvsize)
- assert(fd != SOCKET_ERROR);
- if (fd >= FD_SETSIZE) {
- - // XXX warnx("svc_vc: makefd_xprt: fd too high\n");
- + warnx("svc_vc: makefd_xprt: fd too high\n");
- xprt = NULL;
- goto done;
- }
- xprt = mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- - // XXX warnx("svc_vc: makefd_xprt: out of memory");
- + warnx("svc_vc: makefd_xprt: out of memory");
- goto done;
- }
- memset(xprt, 0, sizeof *xprt);
- cd = mem_alloc(sizeof(struct cf_conn));
- if (cd == NULL) {
- - // XXX warnx("svc_tcp: makefd_xprt: out of memory");
- + warnx("svc_tcp: makefd_xprt: out of memory");
- mem_free(xprt, sizeof(SVCXPRT));
- xprt = NULL;
- goto done;
- diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
- index f5b69d6..e75b023 100644
- --- a/libtirpc/src/wintirpc.c
- +++ b/libtirpc/src/wintirpc.c
- @@ -24,7 +24,6 @@
- #include <rpc/rpc.h>
- #include <stdio.h>
- #include <winsock.h>
- -#include <assert.h>
- WSADATA WSAData;
- @@ -298,6 +297,16 @@ int wintirpc_sendto(int s, const char *buf, int len, int flags,
- return(sendto(_get_osfhandle(s), buf, len, flags, to, tolen));
- }
- +void wintirpc_warnx(const char *format, ...)
- +{
- + va_list args;
- + va_start(args, format);
- + (void)fprintf(stderr, "%04x: ", GetCurrentThreadId());
- + (void)vfprintf(stderr, format, args);
- + (void)fflush(stderr);
- + va_end(args);
- +}
- +
- int tirpc_exit(void)
- {
- if (init == 0 || --init > 0)
- diff --git a/libtirpc/src/xdr.c b/libtirpc/src/xdr.c
- index 7f098b4..38a959d 100644
- --- a/libtirpc/src/xdr.c
- +++ b/libtirpc/src/xdr.c
- @@ -572,7 +572,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
- #endif
- }
- if (sp == NULL) {
- - //warnx("xdr_bytes: out of memory");
- + warnx("xdr_bytes: out of memory");
- return (FALSE);
- }
- /* FALLTHROUGH */
- @@ -735,7 +735,7 @@ xdr_string(xdrs, cpp, maxsize)
- }
- #endif
- if (sp == NULL) {
- - //warnx("xdr_string: out of memory");
- + warnx("xdr_string: out of memory");
- return (FALSE);
- }
- sp[size] = 0;
- diff --git a/libtirpc/src/xdr_array.c b/libtirpc/src/xdr_array.c
- index 3ab9ce5..f932efe 100644
- --- a/libtirpc/src/xdr_array.c
- +++ b/libtirpc/src/xdr_array.c
- @@ -94,7 +94,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
- return (TRUE);
- *addrp = target = mem_alloc(nodesize);
- if (target == NULL) {
- - //warnx("xdr_array: out of memory");
- + warnx("xdr_array: out of memory");
- return (FALSE);
- }
- memset(target, 0, nodesize);
- diff --git a/libtirpc/src/xdr_rec.c b/libtirpc/src/xdr_rec.c
- index 567f574..26afb48 100644
- --- a/libtirpc/src/xdr_rec.c
- +++ b/libtirpc/src/xdr_rec.c
- @@ -189,7 +189,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
- RECSTREAM *rstrm = mem_alloc(sizeof(RECSTREAM));
- if (rstrm == NULL) {
- - //warnx("xdrrec_create: out of memory");
- + warnx("xdrrec_create: out of memory");
- /*
- * This is bad. Should rework xdrrec_create to
- * return a handle, and in this case return NULL
- @@ -199,14 +199,14 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
- rstrm->sendsize = sendsize = fix_buf_size(sendsize);
- rstrm->out_base = mem_alloc(rstrm->sendsize);
- if (rstrm->out_base == NULL) {
- - //warnx("xdrrec_create: out of memory");
- + warnx("xdrrec_create: out of memory");
- mem_free(rstrm, sizeof(RECSTREAM));
- return;
- }
- rstrm->recvsize = recvsize = fix_buf_size(recvsize);
- rstrm->in_base = mem_alloc(recvsize);
- if (rstrm->in_base == NULL) {
- - //warnx("xdrrec_create: out of memory");
- + warnx("xdrrec_create: out of memory");
- mem_free(rstrm->out_base, sendsize);
- mem_free(rstrm, sizeof(RECSTREAM));
- return;
- diff --git a/libtirpc/src/xdr_reference.c b/libtirpc/src/xdr_reference.c
- index 875cffb..cb43cba 100644
- --- a/libtirpc/src/xdr_reference.c
- +++ b/libtirpc/src/xdr_reference.c
- @@ -76,7 +76,7 @@ xdr_reference(xdrs, pp, size, proc)
- case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc(size);
- if (loc == NULL) {
- - //warnx("xdr_reference: out of memory");
- + warnx("xdr_reference: out of memory");
- return (FALSE);
- }
- memset(loc, 0, size);
- diff --git a/libtirpc/tirpc/wintirpc.h b/libtirpc/tirpc/wintirpc.h
- index d33ce74..ff2fda2 100644
- --- a/libtirpc/tirpc/wintirpc.h
- +++ b/libtirpc/tirpc/wintirpc.h
- @@ -107,6 +107,7 @@ int wintirpc_listen(int in_s, int backlog);
- int wintirpc_accept(int s_fd, struct sockaddr *addr, int *addrlen);
- int wintirpc_send(int s, const char *buf, int len, int flags);
- int wintirpc_sendto(int s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen);
- +void wintirpc_warnx(const char *format, ...);
- void wintirpc_register_osfhandle_fd(SOCKET handle, int fd);
- void wintirpc_unregister_osfhandle(SOCKET handle);
- int wintirpc_handle2fd(SOCKET handle);
- @@ -114,4 +115,13 @@ int wintirpc_handle2fd(SOCKET handle);
- /* Debugging function */
- void wintirpc_debug(char *fmt, ...);
- +/* Asserts */
- +#define assert(exp) \
- + if (!(exp)) { \
- + wintirpc_warnx("ASSERTION '%s' in '%s'/%ld failed.\n", \
- + ""#exp"", __FILE__, (long)__LINE__); }
- +
- +/* Mappings Windows API to |wintirpc_*()|-API */
- +#define warnx wintirpc_warnx
- +
- #endif /* !_TIRPC_WINTIRPC_H */
- --
- 2.42.0
- From 7760f2ddb03fc87023109dba91c70aa3587f95a9 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 1 Nov 2023 13:48:57 +0100
- Subject: [PATCH 3/9] nfs_daemon should not call |assert()|
- nfs_daemon should not call the fatal |assert()| function, we added
- |EASSERT()| (error asserts) and |DASSERT()| (debug assert) as
- non-fatal assertions to "daemon_debug.h" a while ago for such
- a purpose.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/name_cache.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 3f944fd..39168f4 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -22,7 +22,6 @@
- #include <Windows.h>
- #include <strsafe.h>
- #include <time.h>
- -#include <assert.h>
- #include "nfs41_ops.h"
- #include "nfs41_compound.h"
- @@ -1068,7 +1067,7 @@ int nfs41_name_cache_delegreturn(
- if (attributes->delegated) {
- attributes->delegated = FALSE;
- attr_cache_entry_deref(&cache->attributes, attributes);
- - assert(cache->delegations > 0);
- + EASSERT(cache->delegations > 0);
- cache->delegations--;
- }
- status = NO_ERROR;
- --
- 2.42.0
- From 981d8d3151214c2de1372855278b81fac23d79f9 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 1 Nov 2023 14:32:28 +0100
- Subject: [PATCH 4/9] nfs_daemon: Fix name cache issues with Cygwin |stat()|
- uid/gid
- nfs_daemon: Fix name cache issues with Cygwin |stat()| uid/gid
- vs. NFSv4 owner/owner_group
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/name_cache.c | 31 +++++++++++++++++++++++--------
- daemon/nfs41_xdr.c | 2 ++
- daemon/open.c | 44 +++++++++++++++++++++++++++++++++++++++++---
- daemon/util.c | 6 ++++--
- 4 files changed, 70 insertions(+), 13 deletions(-)
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 39168f4..8da2fff 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -350,12 +350,24 @@ static void copy_attrs(
- dst->type = src->type;
- dst->numlinks = src->numlinks;
- dst->mode = src->mode;
- - EASSERT(src->owner != NULL);
- - dst->owner = dst->owner_buf;
- - (void)strcpy(dst->owner, src->owner);
- - EASSERT(src->owner_group != NULL);
- - dst->owner_group = dst->owner_group_buf;
- - (void)strcpy(dst->owner_group, src->owner_group);
- + EASSERT(src->owner[0] != '\0');
- + if (src->owner[0] != '\0') {
- + dst->owner = dst->owner_buf;
- + (void)strcpy(dst->owner, src->owner);
- + }
- + else {
- + /* this should only happen for newly created files/dirs */
- + dst->owner = NULL;
- + }
- + EASSERT(src->owner_group[0] != '\0');
- + if (src->owner_group[0] != '\0') {
- + dst->owner_group = dst->owner_group_buf;
- + (void)strcpy(dst->owner_group, src->owner_group);
- + }
- + else {
- + /* this should only happen for newly created files/dirs */
- + dst->owner_group = NULL;
- + }
- dst->fileid = src->fileid;
- dst->hidden = src->hidden;
- dst->system = src->system;
- @@ -368,8 +380,11 @@ static void copy_attrs(
- dst->attrmask.arr[1] = FATTR4_WORD1_MODE
- | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS
- | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY
- - | FATTR4_WORD1_SYSTEM
- - | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
- + | FATTR4_WORD1_SYSTEM;
- + if (dst->owner)
- + dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
- + if (dst->owner_group)
- + dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
- }
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 9bde0f0..245bbff 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -1815,6 +1815,7 @@ static bool_t decode_file_attrs(
- EASSERT(owner_len > 0);
- EASSERT(owner_len < sizeof(info->owner_group_buf));
- info->owner[owner_len] = '\0';
- + EASSERT(info->owner[0] != '\0');
- }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
- if (info->owner_group == NULL)
- @@ -1830,6 +1831,7 @@ static bool_t decode_file_attrs(
- EASSERT(owner_group_len > 0);
- EASSERT(owner_group_len < sizeof(info->owner_group_buf));
- info->owner_group[owner_group_len] = '\0';
- + EASSERT(info->owner_group[0] != '\0');
- }
- if (attrs->attrmask.arr[1] & FATTR4_WORD1_SPACE_AVAIL) {
- if (!xdr_u_hyper(xdr, &info->space_avail))
- diff --git a/daemon/open.c b/daemon/open.c
- index a9ffcb0..3071041 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -669,12 +669,47 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- gid_t map_gid = -1;
- char *at_ch; /* pointer to '@' */
- +#if 1
- + /* this should only happen for newly created files/dirs */
- + if (((info.attrmask.arr[1] & FATTR4_WORD1_OWNER) == 0) ||
- + ((info.attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) == 0)) {
- + bitmap4 og_attr_request = { 0 };
- + nfs41_file_info og_info = { 0 };
- + nfsacl41 acl = { 0 };
- +
- + og_attr_request.count = 2;
- + og_attr_request.arr[1] =
- + FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
- + og_info.owner = og_info.owner_buf;
- + og_info.owner_group = og_info.owner_group_buf;
- + status = nfs41_getattr(state->session, &state->file,
- + &og_attr_request, &og_info);
- + if (status) {
- + eprintf("get_stat_data: nfs41_getattr('%s') "
- + "failed with %d\n",
- + state->path.path,
- + status);
- + goto out_free_state;
- + }
- +
- + info.owner = info.owner_buf;
- + (void)strcpy(info.owner, og_info.owner);
- + info.attrmask.arr[1] |= FATTR4_WORD1_OWNER;
- + info.owner_group = info.owner_group_buf;
- + (void)strcpy(info.owner_group, og_info.owner_group);
- + info.attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
- + }
- +#endif
- +
- EASSERT((info.attrmask.arr[1] & FATTR4_WORD1_OWNER) != 0);
- EASSERT((info.attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) != 0);
- EASSERT(info.owner != NULL);
- EASSERT(info.owner_group != NULL);
- EASSERT(info.owner == info.owner_buf);
- EASSERT(info.owner_group == info.owner_group_buf);
- + EASSERT(strlen(info.owner) > 0);
- + EASSERT(strlen(info.owner_group) > 0);
- +
- /* Make copies as we will modify them */
- (void)strcpy(owner, info.owner);
- (void)strcpy(owner_group, info.owner_group);
- @@ -698,8 +733,9 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- }
- else {
- args->owner_local_uid = NFS_USER_NOBODY_UID;
- - eprintf("get_stat_data: "
- + eprintf("get_stat_data('%s'): "
- "no username mapping for '%s', fake uid=%d\n",
- + state->path.path,
- owner, args->owner_local_uid);
- }
- @@ -721,12 +757,14 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- }
- else {
- args->owner_group_local_gid = NFS_GROUP_NOGROUP_GID;
- - eprintf("get_stat_data: "
- + eprintf("get_stat_data('%s'): "
- "no group mapping for '%s', fake gid=%d\n",
- + state->path.path,
- owner_group, args->owner_group_local_gid);
- }
- - dprintf(1, "handle_open: stat: owner=%u/'%s', owner_group=%u/'%s'\n",
- + dprintf(1, "handle_open('%s'): stat: owner=%u/'%s', owner_group=%u/'%s'\n",
- + state->path.path,
- (unsigned int)args->owner_local_uid, owner,
- (unsigned int)args->owner_group_local_gid, owner_group);
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- diff --git a/daemon/util.c b/daemon/util.c
- index 07aa2c6..ef3ae7d 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -207,8 +207,10 @@ void nfs41_file_info_cpy(
- IN const nfs41_file_info *src)
- {
- (void)memcpy(dest, src, sizeof(nfs41_file_info));
- - dest->owner = dest->owner_buf;
- - dest->owner_group = dest->owner_group_buf;
- + if (src->owner != NULL)
- + dest->owner = dest->owner_buf;
- + if (src->owner_group != NULL)
- + dest->owner_group = dest->owner_group_buf;
- }
- void get_file_time(
- --
- 2.42.0
- From 83fbd7eea08bd5618672ee5ac038e4e0fbcb5918 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 1 Nov 2023 15:08:07 +0100
- Subject: [PATCH 5/9] msnfs41client.bash: Add support to follow the kernel
- debug log
- Add support to follow the kernel debug log via tail -f to
- msnfs41client.bash.
- Requires DebugView from
- https://learn.microsoft.com/en-gb/sysinternals/downloads/debugview
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/devel/msnfs41client.bash | 38 +++++++++++++++++++++++++++++++++
- 1 file changed, 38 insertions(+)
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index da91627..23ca032 100644
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -72,9 +72,18 @@ function nfsclient_install
- cp etc_netconfig /cygdrive/c/etc/netconfig
- cp ms-nfs41-idmap.conf /cygdrive/c/etc/.
- + # make sure we can load the kernel driver
- + # (does not work with SecureBoot)
- bcdedit /set testsigning on
- +
- + # enable local kernel debugging
- + bcdedit /debug on
- + bcdedit /dbgsettings local
- +
- + # set domain name
- regtool -s set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' 'GLOBAL.LOC'
- + # disable DFS
- sc query Dfsc
- sc stop Dfsc || true
- sc config Dfsc start=disabled
- @@ -132,6 +141,23 @@ function nfsclient_system_rundeamon
- return $?
- }
- +function watch_kernel_debuglog
- +{
- + printf "# logging start...\n" 1>&2
- + # seperate process so SIGINT works
- + # use DebugView (https://learn.microsoft.com/en-gb/sysinternals/downloads/debugview) to print kernel log
- + bash -c '
- + klogname="msnfs41client_watch_kernel_debuglog$$.log"
- + dbgview64 /t /k /l "$klogname" &
- + (( dbgview_pid=$! ))
- + trap "(( dbgview_pid != 0)) && kill $dbgview_pid && wait ; (( dbgview_pid=0 ))" INT TERM EXIT
- + sleep 2
- + printf "# logging %s ...\n" "$klogname" 1>&2
- + tail -n0 -f "$klogname"'
- + printf "# logging done\n" 1>&2
- + return 0
- +}
- +
- function nfsclient_mount_homedir
- {
- set -o xtrace
- @@ -239,6 +265,9 @@ function main
- # my own path to pstools
- PATH+=':/home/roland_mainz/work/win_pstools/'
- + # my own path to DebugView
- + PATH+=':/cygdrive/c/Users/roland_mainz/download/DebugView'
- +
- case "$cmd" in
- 'install')
- nfsclient_install
- @@ -285,6 +314,15 @@ function main
- return $?
- ;;
- # misc
- + 'watch_kernel_debuglog')
- + require_cmd 'dbgview64' || return 1
- + if ! is_windows_admin_account ; then
- + printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
- + return 1
- + fi
- + watch_kernel_debuglog
- + return $?
- + ;;
- 'sys_terminal')
- require_cmd 'mintty.exe' || return 1
- if ! is_windows_admin_account ; then
- --
- 2.42.0
- From 9acd0c968d522f2f940746a28d0f4be556e61d37 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sun, 5 Nov 2023 17:54:52 +0100
- Subject: [PATCH 6/9] sys/nfs41_driver: Fix "IOCTL_NFS41_WRITE failed with 31
- xid=... opcode=..."
- Fix issues with |KeWaitForSingleObject()| getting interrupted. As
- consequence the matching request was abandoned, and nfsd_debug printed
- "IOCTL_NFS41_WRITE failed with 31 xid=... opcode=...", typically for
- NFS41_FILE_QUERY.
- Instead we now just retry the |KeWaitForSingleObject()|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 0368732..8c91c5a 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -1484,6 +1484,7 @@ NTSTATUS nfs41_UpcallWaitForReply(
- /* 02/15/2011 cbodley: added NFS41_UNLOCK for the same reason. locking
- * tests were triggering an interrupted unlock, which led to a bugcheck
- * in CloseSrvOpen() */
- +retry_wait:
- #define MAKE_WAITONCLOSE_NONITERRUPTABLE
- #ifdef MAKE_WAITONCLOSE_NONITERRUPTABLE
- if (entry->opcode == NFS41_CLOSE || entry->opcode == NFS41_UNLOCK)
- @@ -1509,9 +1510,15 @@ NTSTATUS nfs41_UpcallWaitForReply(
- goto out;
- switch(status) {
- - case STATUS_SUCCESS: break;
- case STATUS_USER_APC:
- case STATUS_ALERTED:
- + DbgP("nfs41_UpcallWaitForReply: KeWaitForSingleObject() "
- + "returned status(=%ld), "
- + "retry waiting for '%s' entry=%p xid=%lld\n",
- + (long)status,
- + opcode2string(entry->opcode), entry, entry->xid);
- + goto retry_wait;
- + case STATUS_SUCCESS: break;
- default:
- ExAcquireFastMutex(&entry->lock);
- if (entry->state == NFS41_DONE_PROCESSING) {
- --
- 2.42.0
- From 99b655781f20ca29ee6fa4ad0ae2a729fbdec345 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sun, 5 Nov 2023 18:10:27 +0100
- Subject: [PATCH 7/9] sys/nfs41_driver: Fix header length
- |marshal_nfs41_filequery()|
- Fix header length used by |marshal_nfs41_filequery()|, it was
- missing the two HANDLE objects.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 8c91c5a..6fc1351 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -1008,7 +1008,7 @@ NTSTATUS marshal_nfs41_filequery(
- if (status) goto out;
- else tmp += *len;
- - header_len = *len + 2 * sizeof(ULONG);
- + header_len = *len + 2 * sizeof(ULONG) + 2*sizeof(HANDLE);
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- --
- 2.42.0
- From faa3d8c9c274a211929b9f02f60186d58d806faa Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sun, 5 Nov 2023 18:16:35 +0100
- Subject: [PATCH 8/9] sys/nfs41_driver: More debug code for NFS41_FILE_QUERY
- failure codepaths
- Add more debug output in NFS41_FILE_QUERY failure codepaths.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 33 ++++++++++++++++++++++++++++++---
- 1 file changed, 30 insertions(+), 3 deletions(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 6fc1351..3900cec 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -5285,9 +5285,24 @@ NTSTATUS nfs41_QueryFileInformation(
- DbgEn();
- print_debug_filedirquery_header(RxContext);
- #endif
- + DbgP("--> nfs41_QueryFileInformation, RxContext->Info.LengthRemaining=%ld, "
- + "RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength=%ld\n",
- + (long)RxContext->Info.LengthRemaining,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength);
- status = check_nfs41_dirquery_args(RxContext);
- - if (status) goto out;
- + if (status) {
- + print_error("check_nfs41_dirquery_args failed.\n");
- + goto out;
- + }
- +
- + RtlZeroMemory(RxContext->Info.Buffer, RxContext->Info.LengthRemaining);
- +
- + DbgP("nfs41_QueryFileInformation, RxContext->Info.LengthRemaining=%ld, "
- + "RxContext->LowIoContext.ParamsFor.IoCtl.{InputBufferLength=%ld,OutputBufferLength=%ld}\n",
- + (long)RxContext->Info.LengthRemaining,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.InputBufferLength,
- + (long)RxContext->LowIoContext.ParamsFor.IoCtl.OutputBufferLength);
- switch (InfoClass) {
- case FileEaInformation:
- @@ -5314,19 +5329,27 @@ NTSTATUS nfs41_QueryFileInformation(
- status = nfs41_UpcallCreate(NFS41_FILE_QUERY, &nfs41_fobx->sec_ctx,
- pVNetRootContext->session, nfs41_fobx->nfs41_open_state,
- pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry);
- - if (status) goto out;
- + if (status) {
- + print_error("nfs41_UpcallCreate() failed, status=%d\n", status);
- + goto out;
- + }
- entry->u.QueryFile.InfoClass = InfoClass;
- entry->buf = RxContext->Info.Buffer;
- entry->buf_len = RxContext->Info.LengthRemaining;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- - if (status) goto out;
- + if (status) {
- + print_error("nfs41_UpcallWaitForReply() failed, status=%d\n", status);
- + goto out;
- + }
- if (entry->status == STATUS_BUFFER_TOO_SMALL) {
- RxContext->InformationToReturn = entry->buf_len;
- + print_error("entry->status == STATUS_BUFFER_TOO_SMALL\n");
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- + print_error("entry->status == STATUS_SUCCESS\n");
- BOOLEAN DeletePending = FALSE;
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&getattr.sops);
- @@ -5382,9 +5405,12 @@ NTSTATUS nfs41_QueryFileInformation(
- print_std_info(1, &nfs41_fcb->StandardInfo);
- #endif
- break;
- + default:
- + print_error("Unhandled/unsupported InfoClass(%d)\n", (int)InfoClass);
- }
- } else {
- status = map_queryfile_error(entry->status);
- + print_error("status(0x%lx) = map_queryfile_error(entry->status(0x%lx));\n", (long)status, (long)entry->status);
- }
- RxFreePool(entry);
- out:
- @@ -5400,6 +5426,7 @@ out:
- #ifdef DEBUG_FILE_QUERY
- DbgEx();
- #endif
- + DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n", (long)status);
- return status;
- }
- --
- 2.42.0
- From 97c9d90a241489de885c351cb4a5271044a33191 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Sun, 5 Nov 2023 18:29:46 +0100
- Subject: [PATCH 9/9] sys/nfs41_driver: Allocate NFS41_SERVER_ENTRY from
- NonPagedPool
- Allocate NFS41_SERVER_ENTRY from NonPagedPool, as mixing PagedPool
- and NonPagedPool with the same pool tag is not recommended, and in
- this case it makes more sense to allocate it from NonPagedPool as
- the data are critical for the driver.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 3900cec..55d7425 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -2509,7 +2509,7 @@ NTSTATUS _nfs41_CreateSrvCall(
- }
- /* Let's create our own representation of the server */
- - pServerEntry = (PNFS41_SERVER_ENTRY)RxAllocatePoolWithTag(PagedPool,
- + pServerEntry = (PNFS41_SERVER_ENTRY)RxAllocatePoolWithTag(NonPagedPool,
- sizeof(NFS41_SERVER_ENTRY), NFS41_MM_POOLTAG);
- if (pServerEntry == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- --
- 2.42.0
msnfs41client: Kernel+libtirpc+misc patches, 2023-11-06
Posted by Anonymous on Mon 6th Nov 2023 06:20
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.