pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for signing the *.(exe|dll) NFS binaries with WDK test signature, cleanup+misc, 2025-06-03
Posted by Anonymous on Tue 3rd Jun 2025 16:28
raw | new post

  1. From 321ad53e3fd42ff6f932ec6ff7fe318ffc2aaaee Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 3 Jun 2025 12:01:56 +0200
  4. Subject: [PATCH 1/4] sys: |FSCTL_DUPLICATE_EXTENTS_TO_FILE| upcall timeout
  5.  calculation should depend on byte count
  6.  
  7. |FSCTL_DUPLICATE_EXTENTS_TO_FILE| upcall timeout calculation should
  8. depend the number of bytes being cloned.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. sys/nfs41sys_fsctl.c | 7 ++++++-
  13.  1 file changed, 6 insertions(+), 1 deletion(-)
  14.  
  15. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  16. index d90eb6d..6845b89 100644
  17. --- a/sys/nfs41sys_fsctl.c
  18. +++ b/sys/nfs41sys_fsctl.c
  19. @@ -618,6 +618,7 @@ NTSTATUS nfs41_DuplicateData(
  20.          (PDUPLICATE_EXTENTS_DATA)FsCtl->pInputBuffer;
  21.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  22.      PFILE_OBJECT srcfo = NULL;
  23. +    DWORD io_delay;
  24.  
  25.      DbgEn();
  26.  
  27. @@ -730,7 +731,11 @@ NTSTATUS nfs41_DuplicateData(
  28.      entry->u.DuplicateData.bytecount =
  29.          duplicatedatabuffer->ByteCount.QuadPart;
  30.  
  31. -    status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
  32. +    /* Add extra timeout depending on file size */
  33. +    io_delay = (DWORD)(pVNetRootContext->timeout +
  34. +        EXTRA_TIMEOUT_PER_BYTE(entry->u.DuplicateData.bytecount));
  35. +
  36. +    status = nfs41_UpcallWaitForReply(entry, io_delay);
  37.      if (status) {
  38.          /* Timeout - |nfs41_downcall()| will free |entry|+contents */
  39.          entry = NULL;
  40. --
  41. 2.45.1
  42.  
  43. From 63907ff8792da403b567076ebde464a8dc7e826b Mon Sep 17 00:00:00 2001
  44. From: Roland Mainz <roland.mainz@nrubsig.org>
  45. Date: Tue, 3 Jun 2025 12:03:58 +0200
  46. Subject: [PATCH 2/4] daemon,nfs41_build_features.h: Remove
  47.  |NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS| build option
  48.  
  49. Remove |NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS|
  50. build option.
  51.  
  52. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  53. ---
  54. daemon/daemon_debug.c  | 60 --------------------------------
  55.  daemon/daemon_debug.h  |  5 ---
  56.  daemon/getattr.c       | 66 -----------------------------------
  57.  daemon/nfs41.h         |  3 --
  58.  daemon/nfs41_session.c |  5 ---
  59.  daemon/open.c          | 79 ------------------------------------------
  60.  daemon/upcall.c        | 31 -----------------
  61.  nfs41_build_features.h |  9 -----
  62.  8 files changed, 258 deletions(-)
  63.  
  64. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  65. index 674bec5..6b53e94 100644
  66. --- a/daemon/daemon_debug.c
  67. +++ b/daemon/daemon_debug.c
  68. @@ -1410,66 +1410,6 @@ out:
  69.      dprintf_out("<-- debug_list_sparsefile_datasections()\n");
  70.  }
  71.  
  72. -#define NUM_RECENTLY_DELETED 128
  73. -static struct
  74. -{
  75. -    SRWLOCK lock;
  76. -    void *deleted_ptrs[NUM_RECENTLY_DELETED];
  77. -    size_t deleted_index;
  78. -} ptr_recently_deleted_data = {
  79. -    .lock = SRWLOCK_INIT,
  80. -};
  81. -
  82. -bool debug_ptr_was_recently_deleted(void *in_ptr)
  83. -{
  84. -    size_t i;
  85. -    bool_t res = false;
  86. -
  87. -    AcquireSRWLockShared(&ptr_recently_deleted_data.lock);
  88. -    for (i=0 ; i < NUM_RECENTLY_DELETED ; i++) {
  89. -        if (ptr_recently_deleted_data.deleted_ptrs[i] == in_ptr) {
  90. -            res = true;
  91. -            break;
  92. -        }
  93. -    }
  94. -    ReleaseSRWLockShared(&ptr_recently_deleted_data.lock);
  95. -    return res;
  96. -}
  97. -
  98. -void debug_ptr_add_recently_deleted(void *in_ptr)
  99. -{
  100. -    size_t i;
  101. -
  102. -    AcquireSRWLockExclusive(&ptr_recently_deleted_data.lock);
  103. -    i = ptr_recently_deleted_data.deleted_index++ % NUM_RECENTLY_DELETED;
  104. -    ptr_recently_deleted_data.deleted_ptrs[i] = in_ptr;
  105. -    ReleaseSRWLockExclusive(&ptr_recently_deleted_data.lock);
  106. -}
  107. -
  108. -#define NUM_DELAY_FREE 2048
  109. -static struct
  110. -{
  111. -    SRWLOCK lock;
  112. -    void *free_ptrs[NUM_DELAY_FREE];
  113. -    size_t free_ptrs_index;
  114. -} debug_delay_free_data = {
  115. -    .lock = SRWLOCK_INIT,
  116. -};
  117. -
  118. -void debug_delayed_free(void *in_ptr)
  119. -{
  120. -    size_t i;
  121. -
  122. -    AcquireSRWLockExclusive(&debug_delay_free_data.lock);
  123. -    i = debug_delay_free_data.free_ptrs_index++ % NUM_DELAY_FREE;
  124. -
  125. -    if (debug_delay_free_data.free_ptrs[i])
  126. -        free(debug_delay_free_data.free_ptrs[i]);
  127. -
  128. -    debug_delay_free_data.free_ptrs[i] = in_ptr;
  129. -    ReleaseSRWLockExclusive(&debug_delay_free_data.lock);
  130. -}
  131. -
  132.  void debug_print_ea(PFILE_FULL_EA_INFORMATION ea)
  133.  {
  134.      PFILE_FULL_EA_INFORMATION print_ea = ea;
  135. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  136. index a4408f0..f3af022 100644
  137. --- a/daemon/daemon_debug.h
  138. +++ b/daemon/daemon_debug.h
  139. @@ -173,11 +173,6 @@ const char* pnfs_iomode_string(enum pnfs_iomode iomode);
  140.  void dprint_layout(int level, const struct __pnfs_file_layout *layout);
  141.  void dprint_device(int level, const struct __pnfs_file_device *device);
  142.  
  143. -bool debug_ptr_was_recently_deleted(void *in_ptr);
  144. -void debug_ptr_add_recently_deleted(void *in_ptr);
  145. -
  146. -void debug_delayed_free(void *in_ptr);
  147. -
  148.  typedef struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
  149.  void debug_print_ea(PFILE_FULL_EA_INFORMATION ea);
  150.  
  151. diff --git a/daemon/getattr.c b/daemon/getattr.c
  152. index c0ddc2b..7c8b2d1 100644
  153. --- a/daemon/getattr.c
  154. +++ b/daemon/getattr.c
  155. @@ -66,55 +66,6 @@ static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *u
  156.  {
  157.      int status;
  158.  
  159. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  160. -    EASSERT(length > 4);
  161. -    if (length <= 4) {
  162. -        eprintf("parse_getattr: "
  163. -            "upcall->opcode='%s' upcall->state_ref(=0x%p) "
  164. -            "length(=%d) < 4\n",
  165. -            opcode2string(upcall->opcode), upcall->state_ref,
  166. -            (int)length);
  167. -        status = ERROR_INVALID_PARAMETER;
  168. -        goto out;
  169. -    }
  170. -
  171. -    if (debug_ptr_was_recently_deleted(upcall->state_ref)) {
  172. -        eprintf("parse_getattr: "
  173. -            "upcall->opcode='%s' upcall->state_ref(=0x%p) was "
  174. -            "recently deleted\n",
  175. -            opcode2string(upcall->opcode), upcall->state_ref);
  176. -        status = ERROR_INVALID_PARAMETER;
  177. -        goto out;
  178. -    }
  179. -
  180. -    EASSERT_IS_VALID_NON_NULL_PTR(upcall->state_ref);
  181. -    if (!DEBUG_IS_VALID_NON_NULL_PTR(upcall->state_ref)) {
  182. -        eprintf("parse_getattr: "
  183. -            "upcall->opcode='%s' upcall->state_ref(=0x%p) not valid\n",
  184. -            opcode2string(upcall->opcode), upcall->state_ref);
  185. -        status = ERROR_INVALID_PARAMETER;
  186. -        goto out;
  187. -    }
  188. -
  189. -    if (!isvalidnfs41_open_state_ptr(upcall->state_ref)) {
  190. -        eprintf("parse_getattr: upcall->opcode='%s': Error accessing "
  191. -            "upcall->state_ref(=0x%p)->session->client\n",
  192. -            opcode2string(upcall->opcode),
  193. -            upcall->state_ref);
  194. -        status = ERROR_INVALID_PARAMETER;
  195. -        goto out;
  196. -    }
  197. -    EASSERT(upcall->state_ref->ref_count > 0);
  198. -    if (upcall->state_ref->ref_count == 0) {
  199. -        eprintf("parse_getattr: upcall->opcode='%s': "
  200. -            "upcall->state_ref(=0x%p) ref_count==0\n",
  201. -            opcode2string(upcall->opcode),
  202. -            upcall->state_ref);
  203. -        status = ERROR_INVALID_PARAMETER;
  204. -        goto out;
  205. -    }
  206. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  207. -
  208.      getattr_upcall_args *args = &upcall->args.getattr;
  209.      status = safe_read(&buffer, &length, &args->query_class, sizeof(args->query_class));
  210.      if (status) goto out;
  211. @@ -137,23 +88,6 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  212.      nfs41_open_state *state = upcall->state_ref;
  213.      nfs41_file_info info = { 0 };
  214.  
  215. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  216. -    if (!DEBUG_IS_VALID_NON_NULL_PTR(state->session)) {
  217. -        eprintf("handle_getattr: Invalid session ptr=0x%p\n",
  218. -            (void *)state->session);
  219. -        status = ERROR_INVALID_PARAMETER;
  220. -        goto out;
  221. -    }
  222. -
  223. -    if (!DEBUG_IS_VALID_NON_NULL_PTR(state->file.fh.superblock)) {
  224. -        eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=0x%p\n",
  225. -            (void *)state->file.fh.superblock);
  226. -        /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
  227. -        status = ERROR_INVALID_PARAMETER;
  228. -        goto out;
  229. -    }
  230. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  231. -
  232.      status = nfs41_cached_getattr(state->session, &state->file, &info);
  233.      if (status) {
  234.          eprintf("handle_getattr(state->path.path='%s'): "
  235. diff --git a/daemon/nfs41.h b/daemon/nfs41.h
  236. index ef23599..e3443e7 100644
  237. --- a/daemon/nfs41.h
  238. +++ b/daemon/nfs41.h
  239. @@ -561,9 +561,6 @@ void nfs41_open_state_ref(
  240.  
  241.  void nfs41_open_state_deref(
  242.      IN nfs41_open_state *state);
  243. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  244. -bool isvalidnfs41_open_state_ptr(nfs41_open_state *state_ref);
  245. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  246.  struct __stateid_arg;
  247.  void nfs41_open_stateid_arg(
  248.      IN nfs41_open_state *state,
  249. diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
  250. index b4e9b7e..57dc186 100644
  251. --- a/daemon/nfs41_session.c
  252. +++ b/daemon/nfs41_session.c
  253. @@ -447,10 +447,5 @@ void nfs41_session_free(
  254.      DeleteCriticalSection(&session->table.lock);
  255.      ReleaseSRWLockExclusive(&session->client->session_lock);
  256.  
  257. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  258. -    (void)memset(session, 0, sizeof(nfs41_session));
  259. -    debug_delayed_free(session);
  260. -#else
  261.      free(session);
  262. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  263.  }
  264. diff --git a/daemon/open.c b/daemon/open.c
  265. index 682d04d..d1ca062 100644
  266. --- a/daemon/open.c
  267. +++ b/daemon/open.c
  268. @@ -101,14 +101,6 @@ static void open_state_free(
  269.  {
  270.      struct list_entry *entry, *tmp;
  271.  
  272. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  273. -    /*
  274. -     * Remember the pointer here so we can reject it
  275. -     * later in |parse_getattr()|
  276. -     */
  277. -    debug_ptr_add_recently_deleted(state);
  278. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  279. -
  280.      EASSERT(waitcriticalsection(&state->ea.lock) == TRUE);
  281.      EASSERT(waitcriticalsection(&state->locks.lock) == TRUE);
  282.  
  283. @@ -128,77 +120,13 @@ static void open_state_free(
  284.  
  285.      EASSERT(state->ref_count == 0);
  286.  
  287. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  288. -    (void)memset(state, 0, sizeof(nfs41_open_state));
  289. -    debug_delayed_free(state);
  290. -#else
  291.      free(state);
  292. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  293.  }
  294.  
  295. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  296. -bool isvalidnfs41_open_state_ptr(nfs41_open_state *state_ref)
  297. -{
  298. -    /*
  299. -     * If |>state_ref| is garbage, then this should trigger
  300. -     * an exception
  301. -     */
  302. -    volatile int mark = 0;
  303. -    __try {
  304. -        if (state_ref != NULL) {
  305. -            mark++;
  306. -            if (DEBUG_IS_VALID_NON_NULL_PTR(state_ref)) {
  307. -                mark++;
  308. -                if (state_ref->session != NULL) {
  309. -                    mark++;
  310. -                    if (DEBUG_IS_VALID_NON_NULL_PTR(state_ref->session)) {
  311. -                        mark++;
  312. -                        if (state_ref->session->client != NULL) {
  313. -                            mark++;
  314. -                            if (DEBUG_IS_VALID_NON_NULL_PTR(state_ref->session->client)) {
  315. -                                mark++;
  316. -                            }
  317. -                        }
  318. -                    }
  319. -                }
  320. -            }
  321. -        }
  322. -    } __except(EXCEPTION_EXECUTE_HANDLER) {
  323. -        eprintf("isvalidnfs41_open_state_ptr: Exception accessing "
  324. -            "state_ref(=0x%p)->session->client, mark=%d\n",
  325. -            state_ref, mark);
  326. -    }
  327. -
  328. -    if (mark == 6) {
  329. -        return true;
  330. -    }
  331. -
  332. -    return false;
  333. -}
  334. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  335. -
  336.  /* open state reference counting */
  337.  void nfs41_open_state_ref(
  338.      IN nfs41_open_state *state)
  339.  {
  340. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  341. -    /*
  342. -     * gisburn: fixme: sometimes this happens under high parallel
  343. -     * usage with multiple mounts - but why ?
  344. -     * 0:038> kp
  345. -     * Child-SP          RetAddr           Call Site
  346. -     * 0000006d`431fde10 00007ff7`32f7d905 nfsd!nfs41_open_state_ref(struct __nfs41_open_state * state = 0x00000000`00000000)+0x31
  347. -     * 0000006d`431fdf30 00007ff7`32f4d284 nfsd!upcall_parse(unsigned char * buffer = 0x0000006d`431fe180 "???", unsigned int length = 8, struct __nfs41_upcall * upcall = 0x0000006d`431ff1e0)+0x2e5
  348. -     * 0000006d`431fe0b0 00007ffc`1ca24c7c nfsd!thread_main(void * args = 0x00007ff7`32fb6080)+0x144
  349. -     * 0000006d`431ffe00 00007ffc`4d4b7344 ucrtbased!thread_start<unsigned int (void * parameter = 0x0000025d`a9c6def0)+0x9c
  350. -     * 0000006d`431ffe60 00007ffc`4efc26b1 KERNEL32!BaseThreadInitThunk+0x14
  351. -     * 0000006d`431ffe90 00000000`00000000 ntdll!RtlUserThreadStart+0x21
  352. -     */
  353. -    EASSERT_IS_VALID_NON_NULL_PTR(state);
  354. -    if (!DEBUG_IS_VALID_NON_NULL_PTR(state))
  355. -        return;
  356. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  357. -
  358.      EASSERT(state->ref_count > 0);
  359.  
  360.      const LONG count = InterlockedIncrement(&state->ref_count);
  361. @@ -1466,13 +1394,6 @@ out:
  362.  
  363.  static void cleanup_close(nfs41_upcall *upcall)
  364.  {
  365. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  366. -    EASSERT(upcall->state_ref != INVALID_HANDLE_VALUE);
  367. -    if (upcall->state_ref == INVALID_HANDLE_VALUE) {
  368. -        return;
  369. -    }
  370. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  371. -
  372.      /* release the initial reference from create_open_state() */
  373.      nfs41_open_state_deref(upcall->state_ref);
  374.  }
  375. diff --git a/daemon/upcall.c b/daemon/upcall.c
  376. index fe19deb..2f200a7 100644
  377. --- a/daemon/upcall.c
  378. +++ b/daemon/upcall.c
  379. @@ -148,37 +148,6 @@ int upcall_parse(
  380.      if (upcall->root_ref != INVALID_HANDLE_VALUE)
  381.          nfs41_root_ref(upcall->root_ref);
  382.  
  383. -#ifdef NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS
  384. -    if (upcall->state_ref != INVALID_HANDLE_VALUE) {
  385. -        if (!isvalidnfs41_open_state_ptr(upcall->state_ref)) {
  386. -            eprintf("upcall_parse: Error accessing "
  387. -                "upcall->state_ref(=0x%p), opcode %u; "
  388. -                "returning ERROR_INVALID_PARAMETER\n",
  389. -                upcall->state_ref, (unsigned int)upcall_upcode);
  390. -            /*
  391. -             * Set |upcall->state_ref| to |INVALID_HANDLE_VALUE|
  392. -             * so that we do not try to dereference it
  393. -             */
  394. -            upcall->state_ref = INVALID_HANDLE_VALUE;
  395. -            status = ERROR_INVALID_PARAMETER;
  396. -            goto out;
  397. -        }
  398. -
  399. -        if (upcall->state_ref->ref_count == 0) {
  400. -            eprintf("upcall_parse: upcall->state_ref(=0x%p).ref_count == 0, "
  401. -                "opcode %u; returning ERROR_INVALID_PARAMETER\n",
  402. -                upcall->state_ref, (unsigned int)upcall_upcode);
  403. -            /*
  404. -             * Set |upcall->state_ref| to |INVALID_HANDLE_VALUE|
  405. -             * so that we do not try to dereference it
  406. -             */
  407. -            upcall->state_ref = INVALID_HANDLE_VALUE;
  408. -            status = ERROR_INVALID_PARAMETER;
  409. -            goto out;
  410. -        }
  411. -    }
  412. -#endif /* NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS */
  413. -
  414.      if (upcall->state_ref != INVALID_HANDLE_VALUE)
  415.          nfs41_open_state_ref(upcall->state_ref);
  416.  
  417. diff --git a/nfs41_build_features.h b/nfs41_build_features.h
  418. index b15cbdf..38f6372 100644
  419. --- a/nfs41_build_features.h
  420. +++ b/nfs41_build_features.h
  421. @@ -70,15 +70,6 @@
  422.   */
  423.  #define NFS41_DRIVER_STABILITY_HACKS 1
  424.  
  425. -/*
  426. - * NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS - use
  427. - * horrible hacks to improve stabilty because sometimes we use
  428. - * |nfs41_open_state| afer a file close in highly parallel
  429. - * workloads (e.g. building the gcc compiler in parallel).
  430. - *
  431. - * #define NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS 1
  432. - */
  433. -
  434.  /*
  435.   * NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS - use
  436.   * static, large buffer size for socket receive and send buffers
  437. --
  438. 2.45.1
  439.  
  440. From 1b3b797da0ad844a289d86b30254215f929da0fc Mon Sep 17 00:00:00 2001
  441. From: Roland Mainz <roland.mainz@nrubsig.org>
  442. Date: Tue, 3 Jun 2025 12:37:20 +0200
  443. Subject: [PATCH 3/4] sys: Avoid integer overflow for upcall timeouts
  444.  
  445. Avoid (|DWORD|) integer overflow for upcall timeouts
  446.  
  447. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  448. ---
  449. sys/nfs41sys_driver.h     | 10 +++++-----
  450.  sys/nfs41sys_fsctl.c      |  6 +++---
  451.  sys/nfs41sys_readwrite.c  |  2 +-
  452.  sys/nfs41sys_updowncall.c |  2 +-
  453.  4 files changed, 10 insertions(+), 10 deletions(-)
  454.  
  455. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  456. index 349a080..b8b3447 100644
  457. --- a/sys/nfs41sys_driver.h
  458. +++ b/sys/nfs41sys_driver.h
  459. @@ -148,10 +148,10 @@ extern nfs41_timings getexattr;
  460.  #endif /* ENABLE_TIMINGS */
  461.  
  462.  #define RELATIVE(wait) (-(wait))
  463. -#define NANOSECONDS(nanos) (((signed __int64)(nanos)) / 100L)
  464. -#define MICROSECONDS(micros) (((signed __int64)(micros)) * NANOSECONDS(1000L))
  465. -#define MILLISECONDS(milli) (((signed __int64)(milli)) * MICROSECONDS(1000L))
  466. -#define SECONDS(seconds) (((signed __int64)(seconds)) * MILLISECONDS(1000L))
  467. +#define NANOSECONDS(nanos) (((signed __int64)(nanos)) / 100LL)
  468. +#define MICROSECONDS(micros) (((signed __int64)(micros)) * NANOSECONDS(1000LL))
  469. +#define MILLISECONDS(milli) (((signed __int64)(milli)) * MICROSECONDS(1000LL))
  470. +#define SECONDS(seconds) (((signed __int64)(seconds)) * MILLISECONDS(1000LL))
  471.  
  472.  typedef enum _nfs41_updowncall_state {
  473.      NFS41_WAITING_FOR_UPCALL,
  474. @@ -857,7 +857,7 @@ NTSTATUS nfs41_UpcallCreate(
  475.  void nfs41_UpcallDestroy(nfs41_updowncall_entry *entry);
  476.  NTSTATUS nfs41_UpcallWaitForReply(
  477.      IN nfs41_updowncall_entry *entry,
  478. -    IN DWORD secs);
  479. +    IN LONGLONG secs);
  480.  NTSTATUS nfs41_upcall(
  481.      IN PRX_CONTEXT RxContext);
  482.  NTSTATUS nfs41_downcall(
  483. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  484. index 6845b89..e80321b 100644
  485. --- a/sys/nfs41sys_fsctl.c
  486. +++ b/sys/nfs41sys_fsctl.c
  487. @@ -618,7 +618,7 @@ NTSTATUS nfs41_DuplicateData(
  488.          (PDUPLICATE_EXTENTS_DATA)FsCtl->pInputBuffer;
  489.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  490.      PFILE_OBJECT srcfo = NULL;
  491. -    DWORD io_delay;
  492. +    LONGLONG io_delay;
  493.  
  494.      DbgEn();
  495.  
  496. @@ -732,8 +732,8 @@ NTSTATUS nfs41_DuplicateData(
  497.          duplicatedatabuffer->ByteCount.QuadPart;
  498.  
  499.      /* Add extra timeout depending on file size */
  500. -    io_delay = (DWORD)(pVNetRootContext->timeout +
  501. -        EXTRA_TIMEOUT_PER_BYTE(entry->u.DuplicateData.bytecount));
  502. +    io_delay = pVNetRootContext->timeout +
  503. +        EXTRA_TIMEOUT_PER_BYTE(entry->u.DuplicateData.bytecount);
  504.  
  505.      status = nfs41_UpcallWaitForReply(entry, io_delay);
  506.      if (status) {
  507. diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
  508. index cc718df..b60d544 100644
  509. --- a/sys/nfs41sys_readwrite.c
  510. +++ b/sys/nfs41sys_readwrite.c
  511. @@ -240,7 +240,7 @@ NTSTATUS nfs41_Read(
  512.          NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
  513.      __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
  514.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  515. -    DWORD io_delay;
  516. +    LONGLONG io_delay;
  517.  #ifdef ENABLE_TIMINGS
  518.      LARGE_INTEGER t1, t2;
  519.      t1 = KeQueryPerformanceCounter(NULL);
  520. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  521. index f36b936..29e7ac5 100644
  522. --- a/sys/nfs41sys_updowncall.c
  523. +++ b/sys/nfs41sys_updowncall.c
  524. @@ -503,7 +503,7 @@ void nfs41_UpcallDestroy(nfs41_updowncall_entry *entry)
  525.  
  526.  NTSTATUS nfs41_UpcallWaitForReply(
  527.      IN nfs41_updowncall_entry *entry,
  528. -    IN DWORD secs)
  529. +    IN LONGLONG secs)
  530.  {
  531.      NTSTATUS status = STATUS_SUCCESS;
  532.  
  533. --
  534. 2.45.1
  535.  
  536. From 694f47d87e2bdb1fa9209f1bfa1a5c7b1d6b1d4d Mon Sep 17 00:00:00 2001
  537. From: Roland Mainz <roland.mainz@nrubsig.org>
  538. Date: Tue, 3 Jun 2025 16:59:34 +0200
  539. Subject: [PATCH 4/4] README.md,build.vc19,cygwin,docs: Always sign the NFS
  540.  *.exe+*.dll files with the WDK test signature
  541.  
  542. Always use signtool.exe to sign the NFS *.exe+*.dll files with the WDK
  543. test signature, to allow a (Windows Defender) admin to whitelist the
  544. binaries based on that signature.
  545.  
  546. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  547. ---
  548. README.md                                  |  4 ++++
  549.  build.vc19/libtirpc/libtirpc.vcxproj       |  6 ++++++
  550.  build.vc19/ms-nfs41-client_vs2019.vsconfig |  5 ++++-
  551.  build.vc19/ms-nfs41-client_vs2022.vsconfig |  2 ++
  552.  build.vc19/nfs41_np/nfs41_np.vcxproj       |  6 ++++++
  553.  build.vc19/nfs_install/nfs_install.vcxproj |  6 ++++++
  554.  build.vc19/nfs_mount/nfs_mount.vcxproj     |  6 ++++++
  555.  build.vc19/nfsd/nfsd.vcxproj               |  6 ++++++
  556.  cygwin/Makefile                            | 14 +++++++-------
  557.  docs/README.xml                            |  4 ++++
  558.  10 files changed, 51 insertions(+), 8 deletions(-)
  559.  
  560. diff --git a/README.md b/README.md
  561. index 72144eb..9c3a2de 100644
  562. --- a/README.md
  563. +++ b/README.md
  564. @@ -938,6 +938,8 @@ Source code can be obtained from
  565.        git clone https://github.com/kofemann/ms-nfs41-client.git
  566.        cd ms-nfs41-client
  567.        cd cygwin
  568. +      # get default WDK Test Certificate SHA1 ThumbPrint value for code signing
  569. +      export CERTIFICATE_THUMBPRINT="$(powershell -c 'Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*WDKTestCert*"} | Select-Object -ExpandProperty Thumbprint')"
  570.        make build
  571.        make installdest
  572.        make bintarball
  573. @@ -952,6 +954,8 @@ Source code can be obtained from
  574.        # ("v142" should remain the default when comitting)
  575.        sed -i -E 's/<PlatformToolset>v142<\/PlatformToolset>/<PlatformToolset>v143<\/PlatformToolset>/g' $(find 'build.vc19' -name \*.vcxproj)
  576.        cd cygwin
  577. +      # get default WDK Test Certificate SHA1 ThumbPrint value for code signing
  578. +      export CERTIFICATE_THUMBPRINT="$(powershell -c 'Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*WDKTestCert*"} | Select-Object -ExpandProperty Thumbprint')"
  579.        make build64
  580.        make installdest64
  581.        make bintarball64
  582. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  583. index cdf877b..ad91f2a 100644
  584. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  585. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  586. @@ -1,5 +1,11 @@
  587. <?xml version="1.0" encoding="utf-8"?>
  588.  <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  589. +  <Target Name="Sign" AfterTargets="Build">
  590. +    <SignFile
  591. +      CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
  592. +      SigningTarget="$(OutputPath)\libtirpc.dll"
  593. +      TargetFrameworkVersion="v4.5" />
  594. +  </Target>
  595.    <ItemGroup Label="ProjectConfigurations">
  596.      <ProjectConfiguration Include="Debug|Win32">
  597.        <Configuration>Debug</Configuration>
  598. diff --git a/build.vc19/ms-nfs41-client_vs2019.vsconfig b/build.vc19/ms-nfs41-client_vs2019.vsconfig
  599. index 6941e6e..3d99e86 100755
  600. --- a/build.vc19/ms-nfs41-client_vs2019.vsconfig
  601. +++ b/build.vc19/ms-nfs41-client_vs2019.vsconfig
  602. @@ -13,6 +13,7 @@
  603.      "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
  604.      "Microsoft.Component.MSBuild",
  605.      "Microsoft.VisualStudio.Component.TextTemplating",
  606. +    "Microsoft.VisualStudio.Component.Common.Azure.Tools",
  607.      "Microsoft.VisualStudio.Component.Debugger.JustInTime",
  608.      "Component.Microsoft.VisualStudio.LiveShare",
  609.      "Microsoft.VisualStudio.Component.IntelliCode",
  610. @@ -52,6 +53,8 @@
  611.      "Microsoft.VisualStudio.Component.VC.MFC.ARM",
  612.      "Microsoft.VisualStudio.Component.VC.MFC.ARM64",
  613.      "Microsoft.VisualStudio.Component.VC.MFC.ARM64EC",
  614. +    "Microsoft.Component.ClickOnce",
  615.      "Microsoft.VisualStudio.Component.Windows10SDK.20348"
  616. -  ]
  617. +  ],
  618. +  "extensions": []
  619.  }
  620. \ No newline at end of file
  621. diff --git a/build.vc19/ms-nfs41-client_vs2022.vsconfig b/build.vc19/ms-nfs41-client_vs2022.vsconfig
  622. index c4078f4..b49e584 100755
  623. --- a/build.vc19/ms-nfs41-client_vs2022.vsconfig
  624. +++ b/build.vc19/ms-nfs41-client_vs2022.vsconfig
  625. @@ -12,6 +12,7 @@
  626.      "Microsoft.Component.MSBuild",
  627.      "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
  628.      "Microsoft.VisualStudio.Component.TextTemplating",
  629. +    "Microsoft.VisualStudio.Component.Common.Azure.Tools",
  630.      "Microsoft.VisualStudio.Component.NuGet",
  631.      "Microsoft.VisualStudio.Component.Debugger.JustInTime",
  632.      "Microsoft.VisualStudio.Component.IntelliCode",
  633. @@ -56,6 +57,7 @@
  634.      "Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
  635.      "Microsoft.VisualStudio.Component.VC.MFC.ARM",
  636.      "Microsoft.VisualStudio.Component.VC.MFC.ARM64",
  637. +    "Microsoft.Component.ClickOnce",
  638.      "Microsoft.Net.Component.4.6.1.TargetingPack",
  639.      "Component.Microsoft.Windows.DriverKit"
  640.    ],
  641. diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
  642. index dd6d309..1c486e3 100644
  643. --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
  644. +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
  645. @@ -1,5 +1,11 @@
  646. <?xml version="1.0" encoding="utf-8"?>
  647.  <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  648. +  <Target Name="Sign" AfterTargets="Build">
  649. +    <SignFile
  650. +      CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
  651. +      SigningTarget="$(OutputPath)\nfs41_np.dll"
  652. +      TargetFrameworkVersion="v4.5" />
  653. +  </Target>
  654.    <ItemGroup Label="ProjectConfigurations">
  655.      <ProjectConfiguration Include="Debug|Win32">
  656.        <Configuration>Debug</Configuration>
  657. diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
  658. index 46aeda5..2748c7f 100644
  659. --- a/build.vc19/nfs_install/nfs_install.vcxproj
  660. +++ b/build.vc19/nfs_install/nfs_install.vcxproj
  661. @@ -1,5 +1,11 @@
  662. <?xml version="1.0" encoding="utf-8"?>
  663.  <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  664. +  <Target Name="Sign" AfterTargets="Build">
  665. +    <SignFile
  666. +      CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
  667. +      SigningTarget="$(OutputPath)\nfs_install.exe"
  668. +      TargetFrameworkVersion="v4.5" />
  669. +  </Target>
  670.    <ItemGroup Label="ProjectConfigurations">
  671.      <ProjectConfiguration Include="Debug|Win32">
  672.        <Configuration>Debug</Configuration>
  673. diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
  674. index 63ccec7..675bb27 100644
  675. --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
  676. +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
  677. @@ -1,5 +1,11 @@
  678. <?xml version="1.0" encoding="utf-8"?>
  679.  <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  680. +  <Target Name="Sign" AfterTargets="Build">
  681. +    <SignFile
  682. +      CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
  683. +      SigningTarget="$(OutputPath)\nfs_mount.exe"
  684. +      TargetFrameworkVersion="v4.5" />
  685. +  </Target>
  686.    <Target Name="generate_git_version_header" BeforeTargets="ClCompile">
  687.      <Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
  688.        <Output TaskParameter="ConsoleOutput" PropertyName="git_version_string" />
  689. diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
  690. index d5ae5a1..c33081b 100644
  691. --- a/build.vc19/nfsd/nfsd.vcxproj
  692. +++ b/build.vc19/nfsd/nfsd.vcxproj
  693. @@ -1,5 +1,11 @@
  694. <?xml version="1.0" encoding="utf-8"?>
  695.  <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  696. +  <Target Name="Sign" AfterTargets="Build">
  697. +    <SignFile
  698. +      CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
  699. +      SigningTarget="$(OutputPath)\nfsd.exe"
  700. +      TargetFrameworkVersion="v4.5" />
  701. +  </Target>
  702.    <Target Name="generate_git_version_header" BeforeTargets="ClCompile">
  703.      <Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
  704.        <Output TaskParameter="ConsoleOutput" PropertyName="git_version_string" />
  705. diff --git a/cygwin/Makefile b/cygwin/Makefile
  706. index c390347..f570023 100644
  707. --- a/cygwin/Makefile
  708. +++ b/cygwin/Makefile
  709. @@ -31,37 +31,37 @@ $(PROJECT_BASEDIR_DIR)/tests/ea/nfs_ea.exe \
  710.  build_64bit_release:
  711.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  712.         which MSBuild.exe
  713. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Release -p:Platform=x64
  714. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Release -p:Platform=x64 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  715.  
  716.  build_64bit_debug:
  717.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  718.         which MSBuild.exe
  719. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=x64
  720. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=x64 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  721.  
  722.  build_32bit_release:
  723.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  724.         which MSBuild.exe
  725. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Release -p:Platform=x86
  726. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Release -p:Platform=x86 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  727.  
  728.  build_32bit_debug:
  729.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  730.         which MSBuild.exe
  731. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=x86
  732. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=x86 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  733.  
  734.  build_32bit_release_clientutils:
  735.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  736.         which MSBuild.exe
  737. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Release -p:Platform=x86
  738. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Release -p:Platform=x86 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  739.  
  740.  build_32bit_debug_clientutils:
  741.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  742.         which MSBuild.exe
  743. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Debug -p:Platform=x86
  744. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:nfs41_np,nfs_mount  -p:Configuration=Debug -p:Platform=x86 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  745.  
  746.  build_arm_64bit_debug:
  747.         @printf '#\n# PATH is %q\n#\n' '$(PATH)'
  748.         which MSBuild.exe
  749. -       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=ARM64
  750. +       MSBuild.exe '$(shell cygpath -w "$(PROJECT_BASEDIR_DIR)/build.vc19/nfs41-client.sln")' -t:Build  -p:Configuration=Debug -p:Platform=ARM64 /p:CERTIFICATE_THUMBPRINT=$$CERTIFICATE_THUMBPRINT
  751.  
  752.  build_testutils:
  753.         (cd "$(PROJECT_BASEDIR_DIR)/tests/ea" && make all)
  754. diff --git a/docs/README.xml b/docs/README.xml
  755. index b292e8f..be0949e 100644
  756. --- a/docs/README.xml
  757. +++ b/docs/README.xml
  758. @@ -918,6 +918,8 @@ export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Commun
  759.  git clone https://github.com/kofemann/ms-nfs41-client.git
  760.  cd ms-nfs41-client
  761.  cd cygwin
  762. +# get default WDK Test Certificate SHA1 ThumbPrint value for code signing
  763. +export CERTIFICATE_THUMBPRINT="$(powershell -c 'Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*WDKTestCert*"} | Select-Object -ExpandProperty Thumbprint')"
  764.  make build
  765.  make installdest
  766.  make bintarball</programlisting>
  767. @@ -932,6 +934,8 @@ cd ms-nfs41-client
  768.  # ("v142" should remain the default when comitting)
  769.  sed -i -E 's/&lt;PlatformToolset&gt;v142&lt;\/PlatformToolset&gt;/&lt;PlatformToolset&gt;v143&lt;\/PlatformToolset&gt;/g' $(find 'build.vc19' -name \*.vcxproj)
  770.  cd cygwin
  771. +# get default WDK Test Certificate SHA1 ThumbPrint value for code signing
  772. +export CERTIFICATE_THUMBPRINT="$(powershell -c 'Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -like "*WDKTestCert*"} | Select-Object -ExpandProperty Thumbprint')"
  773.  make build64
  774.  make installdest64
  775.  make bintarball64</programlisting>
  776. --
  777. 2.45.1

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at