pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for kernel downcall buffer checks, |const|+|restrict|+cleanup+misc, 2025-10-06
Posted by Anonymous on Mon 6th Oct 2025 20:21
raw | new post

  1. From 2c6aec09e59bde58ef9d652d4b838b7e68dd56e7 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Mon, 6 Oct 2025 11:53:53 +0200
  4. Subject: [PATCH 1/6] sys: Handle
  5.  |LowIoContext->ParamsFor.IoCtl.pInputBuffer|&co as |const|+use |restrict|
  6.  
  7. Handle |LowIoContext->ParamsFor.IoCtl.pInputBuffer|&co as |const|+use
  8. |restrict|.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. sys/nfs41sys_acl.c        |  2 +-
  13.  sys/nfs41sys_dir.c        |  2 +-
  14.  sys/nfs41sys_driver.c     |  8 +++---
  15.  sys/nfs41sys_driver.h     | 28 ++++++++++----------
  16.  sys/nfs41sys_ea.c         |  2 +-
  17.  sys/nfs41sys_fileinfo.c   |  4 +--
  18.  sys/nfs41sys_fsctl.c      | 42 ++++++++++++++---------------
  19.  sys/nfs41sys_mount.c      |  7 ++---
  20.  sys/nfs41sys_openclose.c  |  2 +-
  21.  sys/nfs41sys_readwrite.c  |  2 +-
  22.  sys/nfs41sys_reparse.c    |  6 +++--
  23.  sys/nfs41sys_symlink.c    |  8 +++---
  24.  sys/nfs41sys_updowncall.c | 56 +++++++++++++++++++--------------------
  25.  sys/nfs41sys_volinfo.c    |  2 +-
  26.  14 files changed, 88 insertions(+), 83 deletions(-)
  27.  
  28. diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
  29. index 66ce93f..d2c0a6e 100644
  30. --- a/sys/nfs41sys_acl.c
  31. +++ b/sys/nfs41sys_acl.c
  32. @@ -137,7 +137,7 @@ out:
  33.  
  34.  NTSTATUS unmarshal_nfs41_getacl(
  35.      nfs41_updowncall_entry *cur,
  36. -    unsigned char **buf)
  37. +    const unsigned char *restrict *restrict buf)
  38.  {
  39.      NTSTATUS status = STATUS_SUCCESS;
  40.      DWORD buf_len;
  41. diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
  42. index e86a231..75b2820 100644
  43. --- a/sys/nfs41sys_dir.c
  44. +++ b/sys/nfs41sys_dir.c
  45. @@ -137,7 +137,7 @@ out:
  46.  
  47.  NTSTATUS unmarshal_nfs41_dirquery(
  48.      nfs41_updowncall_entry *cur,
  49. -    unsigned char **buf)
  50. +    const unsigned char *restrict *restrict buf)
  51.  {
  52.      NTSTATUS status = STATUS_SUCCESS;
  53.      ULONG buf_len;
  54. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  55. index 3bf52cc..e9e4486 100644
  56. --- a/sys/nfs41sys_driver.c
  57. +++ b/sys/nfs41sys_driver.c
  58. @@ -277,12 +277,12 @@ NTSTATUS nfs41_invalidate_cache(
  59.      IN PRX_CONTEXT RxContext)
  60.  {
  61.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  62. -    unsigned char *buf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  63. +    const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  64.      ULONG flag = DISABLE_CACHING;
  65.      PMRX_SRV_OPEN srv_open;
  66.      NTSTATUS status;
  67.  
  68. -    RtlCopyMemory(&srv_open, buf, sizeof(HANDLE));
  69. +    RtlCopyMemory(&srv_open, inbuf, sizeof(HANDLE));
  70.  #ifdef DEBUG_INVALIDATE_CACHE
  71.      DbgP("nfs41_invalidate_cache: received srv_open=0x%p '%wZ'\n",
  72.          srv_open, srv_open->pAlreadyPrefixedName);
  73. @@ -454,7 +454,7 @@ NTSTATUS nfs41_DevFcbXXXControlFile(
  74.      PLOWIO_CONTEXT io_ctx = &RxContext->LowIoContext;
  75.      ULONG fsop = io_ctx->ParamsFor.FsCtl.FsControlCode, state;
  76.      ULONG in_len = io_ctx->ParamsFor.IoCtl.InputBufferLength;
  77. -    DWORD *buf = io_ctx->ParamsFor.IoCtl.pInputBuffer;
  78. +    const DWORD *inbuf = io_ctx->ParamsFor.IoCtl.pInputBuffer;
  79.      PNFS41_DEVICE_EXTENSION DevExt =
  80.          NFS41GetDeviceExtension(RxContext->RxDeviceObject);
  81.      DWORD nfs41d_version = 0;
  82. @@ -521,7 +521,7 @@ NTSTATUS nfs41_DevFcbXXXControlFile(
  83.          case IOCTL_NFS41_START:
  84.              print_driver_state(nfs41_start_state);
  85.              if (in_len >= sizeof(DWORD)) {
  86. -                RtlCopyMemory(&nfs41d_version, buf, sizeof(DWORD));
  87. +                RtlCopyMemory(&nfs41d_version, inbuf, sizeof(DWORD));
  88.                  DbgP("NFS41 Daemon sent start request with version %d\n",
  89.                      nfs41d_version);
  90.                  DbgP("Currently used NFS41 Daemon version is %d\n",
  91. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  92. index fa019f4..92c21cc 100644
  93. --- a/sys/nfs41sys_driver.h
  94. +++ b/sys/nfs41sys_driver.h
  95. @@ -616,7 +616,7 @@ NTSTATUS marshal_nfs41_setacl(
  96.      ULONG *len);
  97.  NTSTATUS unmarshal_nfs41_getacl(
  98.      nfs41_updowncall_entry *cur,
  99. -    unsigned char **buf);
  100. +    const unsigned char *restrict *restrict buf);
  101.  NTSTATUS nfs41_QuerySecurityInformation(
  102.      IN OUT PRX_CONTEXT RxContext);
  103.  NTSTATUS nfs41_SetSecurityInformation(
  104. @@ -630,7 +630,7 @@ NTSTATUS marshal_nfs41_dirquery(
  105.      ULONG *len);
  106.  NTSTATUS unmarshal_nfs41_dirquery(
  107.      nfs41_updowncall_entry *cur,
  108. -    unsigned char **buf);
  109. +    const unsigned char *restrict *restrict buf);
  110.  void print_debug_filedirquery_header(
  111.      PRX_CONTEXT RxContext);
  112.  NTSTATUS check_nfs41_dirquery_args(
  113. @@ -671,7 +671,7 @@ NTSTATUS marshal_nfs41_eaget(
  114.      ULONG *len);
  115.  void unmarshal_nfs41_eaget(
  116.      nfs41_updowncall_entry *cur,
  117. -    unsigned char **buf);
  118. +    const unsigned char *restrict *restrict buf);
  119.  NTSTATUS nfs41_SetEaInformation(
  120.      IN OUT PRX_CONTEXT RxContext);
  121.  NTSTATUS nfs41_QueryEaInformation(
  122. @@ -687,7 +687,7 @@ NTSTATUS marshal_nfs41_queryallocatedranges(
  123.      ULONG *len);
  124.  NTSTATUS unmarshal_nfs41_queryallocatedranges(
  125.      nfs41_updowncall_entry *cur,
  126. -    unsigned char **buf);
  127. +    const unsigned char *restrict *restrict buf);
  128.  NTSTATUS marshal_nfs41_setzerodata(
  129.      nfs41_updowncall_entry *entry,
  130.      unsigned char *buf,
  131. @@ -695,7 +695,7 @@ NTSTATUS marshal_nfs41_setzerodata(
  132.      ULONG *len);
  133.  NTSTATUS unmarshal_nfs41_setzerodata(
  134.      nfs41_updowncall_entry *cur,
  135. -    unsigned char **buf);
  136. +    const unsigned char *restrict *restrict buf);
  137.  NTSTATUS marshal_nfs41_duplicatedata(
  138.      nfs41_updowncall_entry *entry,
  139.      unsigned char *buf,
  140. @@ -703,7 +703,7 @@ NTSTATUS marshal_nfs41_duplicatedata(
  141.      ULONG *len);
  142.  NTSTATUS unmarshal_nfs41_duplicatedata(
  143.      nfs41_updowncall_entry *cur,
  144. -    unsigned char **buf);
  145. +    const unsigned char *restrict *restrict buf);
  146.  void nfs41_remove_offloadcontext_for_fobx(
  147.      IN PMRX_FOBX pFobx);
  148.  
  149. @@ -747,7 +747,7 @@ NTSTATUS marshal_nfs41_unmount(
  150.      ULONG *len);
  151.  void unmarshal_nfs41_mount(
  152.      nfs41_updowncall_entry *cur,
  153. -    unsigned char **buf);
  154. +    const unsigned char *restrict *restrict buf);
  155.  NTSTATUS nfs41_unmount(
  156.      HANDLE session,
  157.      DWORD version,
  158. @@ -808,7 +808,7 @@ NTSTATUS marshal_nfs41_close(
  159.      ULONG *len);
  160.  NTSTATUS unmarshal_nfs41_open(
  161.      nfs41_updowncall_entry *cur,
  162. -    unsigned char **buf);
  163. +    const unsigned char *restrict *restrict buf);
  164.  NTSTATUS nfs41_Create(
  165.      IN OUT PRX_CONTEXT RxContext);
  166.  NTSTATUS nfs41_CollapseOpen(
  167. @@ -826,7 +826,7 @@ NTSTATUS marshal_nfs41_rw(
  168.      ULONG *len);
  169.  NTSTATUS unmarshal_nfs41_rw(
  170.      nfs41_updowncall_entry *cur,
  171. -    unsigned char **buf);
  172. +    const unsigned char *restrict *restrict buf);
  173.  NTSTATUS nfs41_Read(
  174.      IN OUT PRX_CONTEXT RxContext);
  175.  NTSTATUS nfs41_Write(
  176. @@ -844,7 +844,7 @@ NTSTATUS marshal_nfs41_symlink(
  177.      ULONG *len);
  178.  void unmarshal_nfs41_symlink(
  179.      nfs41_updowncall_entry *cur,
  180. -    unsigned char **buf);
  181. +    const unsigned char *restrict *restrict buf);
  182.  NTSTATUS nfs41_SetSymlinkReparsePoint(
  183.      IN OUT PRX_CONTEXT RxContext);
  184.  NTSTATUS nfs41_GetSymlinkReparsePoint(
  185. @@ -868,7 +868,7 @@ void unmarshal_nfs41_attrget(
  186.      nfs41_updowncall_entry *cur,
  187.      PVOID attr_value,
  188.      ULONG *attr_len,
  189. -    unsigned char **buf,
  190. +    const unsigned char *restrict *restrict buf,
  191.      BOOL copy_partial);
  192.  NTSTATUS nfs41_UpcallCreate(
  193.      IN DWORD opcode,
  194. @@ -903,10 +903,10 @@ NTSTATUS marshal_nfs41_fileset(
  195.  void unmarshal_nfs41_setattr(
  196.      nfs41_updowncall_entry *cur,
  197.      PULONGLONG dest_buf,
  198. -    unsigned char **buf);
  199. +    const unsigned char *restrict *restrict buf);
  200.  void unmarshal_nfs41_getattr(
  201.      nfs41_updowncall_entry *cur,
  202. -    unsigned char **buf);
  203. +    const unsigned char *restrict *restrict buf);
  204.  NTSTATUS nfs41_QueryFileInformation(
  205.      IN OUT PRX_CONTEXT RxContext);
  206.  NTSTATUS nfs41_SetFileInformation(
  207. @@ -922,7 +922,7 @@ NTSTATUS marshal_nfs41_volume(
  208.      ULONG *len);
  209.  void unmarshal_nfs41_volume(
  210.      nfs41_updowncall_entry *cur,
  211. -    unsigned char **buf);
  212. +    const unsigned char *restrict *restrict buf);
  213.  NTSTATUS nfs41_QueryVolumeInformation(
  214.      IN OUT PRX_CONTEXT RxContext);
  215.  
  216. diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
  217. index bb7845d..53b0790 100644
  218. --- a/sys/nfs41sys_ea.c
  219. +++ b/sys/nfs41sys_ea.c
  220. @@ -159,7 +159,7 @@ out:
  221.  
  222.  void unmarshal_nfs41_eaget(
  223.      nfs41_updowncall_entry *cur,
  224. -    unsigned char **buf)
  225. +    const unsigned char *restrict *restrict buf)
  226.  {
  227.      RtlCopyMemory(&cur->u.QueryEa.Overflow, *buf, sizeof(ULONG));
  228.      *buf += sizeof(ULONG);
  229. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  230. index b4cd89f..bc84e30 100644
  231. --- a/sys/nfs41sys_fileinfo.c
  232. +++ b/sys/nfs41sys_fileinfo.c
  233. @@ -141,7 +141,7 @@ out:
  234.  void unmarshal_nfs41_setattr(
  235.      nfs41_updowncall_entry *cur,
  236.      PULONGLONG dest_buf,
  237. -    unsigned char **buf)
  238. +    const unsigned char *restrict *restrict buf)
  239.  {
  240.      RtlCopyMemory(dest_buf, *buf, sizeof(ULONGLONG));
  241.  #ifdef DEBUG_MARSHAL_DETAIL
  242. @@ -151,7 +151,7 @@ void unmarshal_nfs41_setattr(
  243.  
  244.  void unmarshal_nfs41_getattr(
  245.      nfs41_updowncall_entry *cur,
  246. -    unsigned char **buf)
  247. +    const unsigned char *restrict *restrict buf)
  248.  {
  249.      unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, FALSE);
  250.      RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(ULONGLONG));
  251. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  252. index 8f25517..4a5d3f6 100644
  253. --- a/sys/nfs41sys_fsctl.c
  254. +++ b/sys/nfs41sys_fsctl.c
  255. @@ -76,8 +76,8 @@ NTSTATUS check_nfs41_queryallocatedranges_args(
  256.      XXCTL_LOWIO_COMPONENT *FsCtl =
  257.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  258.      const USHORT HeaderLen = sizeof(FILE_ALLOCATED_RANGE_BUFFER);
  259. -    __notnull PFILE_ALLOCATED_RANGE_BUFFER in_range_buffer =
  260. -        (PFILE_ALLOCATED_RANGE_BUFFER)FsCtl->pInputBuffer;
  261. +    __notnull const PFILE_ALLOCATED_RANGE_BUFFER in_range_buffer =
  262. +        (const PFILE_ALLOCATED_RANGE_BUFFER)FsCtl->pInputBuffer;
  263.  
  264.      if (FsCtl->pInputBuffer == NULL) {
  265.          status = STATUS_INVALID_USER_BUFFER;
  266. @@ -128,8 +128,8 @@ NTSTATUS nfs41_QueryAllocatedRanges(
  267.          NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
  268.      __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  269.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  270. -    __notnull PFILE_ALLOCATED_RANGE_BUFFER in_range_buffer =
  271. -        (PFILE_ALLOCATED_RANGE_BUFFER)FsCtl->pInputBuffer;
  272. +    __notnull const PFILE_ALLOCATED_RANGE_BUFFER in_range_buffer =
  273. +        (const PFILE_ALLOCATED_RANGE_BUFFER)FsCtl->pInputBuffer;
  274.      __notnull PFILE_ALLOCATED_RANGE_BUFFER out_range_buffer =
  275.          (PFILE_ALLOCATED_RANGE_BUFFER)FsCtl->pOutputBuffer;
  276.      ULONG out_range_buffer_len = FsCtl->OutputBufferLength;
  277. @@ -307,7 +307,7 @@ out:
  278.  
  279.  NTSTATUS unmarshal_nfs41_queryallocatedranges(
  280.      nfs41_updowncall_entry *cur,
  281. -    unsigned char **buf)
  282. +    const unsigned char *restrict *restrict buf)
  283.  {
  284.      NTSTATUS status = STATUS_SUCCESS;
  285.  
  286. @@ -350,8 +350,8 @@ NTSTATUS nfs41_SetSparse(
  287.      __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
  288.      __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  289.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  290. -    __notnull PFILE_SET_SPARSE_BUFFER set_parse_buffer =
  291. -        (PFILE_SET_SPARSE_BUFFER)FsCtl->pInputBuffer;
  292. +    __notnull const PFILE_SET_SPARSE_BUFFER set_parse_buffer =
  293. +        (const PFILE_SET_SPARSE_BUFFER)FsCtl->pInputBuffer;
  294.  
  295.      DbgEn();
  296.  
  297. @@ -448,8 +448,8 @@ NTSTATUS nfs41_SetZeroData(
  298.          NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
  299.      __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  300.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  301. -    __notnull PFILE_ZERO_DATA_INFORMATION setzerodatabuffer =
  302. -        (PFILE_ZERO_DATA_INFORMATION)FsCtl->pInputBuffer;
  303. +    __notnull const PFILE_ZERO_DATA_INFORMATION setzerodatabuffer =
  304. +        (const PFILE_ZERO_DATA_INFORMATION)FsCtl->pInputBuffer;
  305.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  306.  
  307.      DbgEn();
  308. @@ -567,7 +567,7 @@ out:
  309.  
  310.  NTSTATUS unmarshal_nfs41_setzerodata(
  311.      nfs41_updowncall_entry *cur,
  312. -    unsigned char **buf)
  313. +    const unsigned char *restrict *restrict buf)
  314.  {
  315.      NTSTATUS status = STATUS_SUCCESS;
  316.  
  317. @@ -662,8 +662,8 @@ NTSTATUS nfs41_DuplicateData(
  318.              goto out;
  319.          }
  320.  
  321. -        PDUPLICATE_EXTENTS_DATA32 ded32bit =
  322. -            (PDUPLICATE_EXTENTS_DATA32)FsCtl->pInputBuffer;
  323. +        const PDUPLICATE_EXTENTS_DATA32 ded32bit =
  324. +            (const PDUPLICATE_EXTENTS_DATA32)FsCtl->pInputBuffer;
  325.  
  326.          dd.handle           = (HANDLE)ded32bit->FileHandle;
  327.          dd.srcfileoffset    = ded32bit->SourceFileOffset.QuadPart;
  328. @@ -681,8 +681,8 @@ NTSTATUS nfs41_DuplicateData(
  329.              goto out;
  330.          }
  331.  
  332. -        PDUPLICATE_EXTENTS_DATA ded =
  333. -            (PDUPLICATE_EXTENTS_DATA)FsCtl->pInputBuffer;
  334. +        const PDUPLICATE_EXTENTS_DATA ded =
  335. +            (const PDUPLICATE_EXTENTS_DATA)FsCtl->pInputBuffer;
  336.  
  337.          dd.handle           = ded->FileHandle;
  338.          dd.srcfileoffset    = ded->SourceFileOffset.QuadPart;
  339. @@ -884,7 +884,7 @@ out:
  340.  
  341.  NTSTATUS unmarshal_nfs41_duplicatedata(
  342.      nfs41_updowncall_entry *cur,
  343. -    unsigned char **buf)
  344. +    const unsigned char *restrict *restrict buf)
  345.  {
  346.      NTSTATUS status = STATUS_SUCCESS;
  347.  
  348. @@ -1025,7 +1025,7 @@ NTSTATUS nfs41_OffloadRead(
  349.      IN OUT PRX_CONTEXT RxContext)
  350.  {
  351.      NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST;
  352. -    __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  353. +    __notnull const XXCTL_LOWIO_COMPONENT *FsCtl =
  354.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  355.      __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
  356.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  357. @@ -1062,8 +1062,8 @@ NTSTATUS nfs41_OffloadRead(
  358.          goto out;
  359.      }
  360.  
  361. -    PFSCTL_OFFLOAD_READ_INPUT ori =
  362. -        (PFSCTL_OFFLOAD_READ_INPUT)FsCtl->pInputBuffer;
  363. +    const PFSCTL_OFFLOAD_READ_INPUT ori =
  364. +        (const PFSCTL_OFFLOAD_READ_INPUT)FsCtl->pInputBuffer;
  365.      PFSCTL_OFFLOAD_READ_OUTPUT oro =
  366.          (PFSCTL_OFFLOAD_READ_OUTPUT)FsCtl->pOutputBuffer;
  367.  
  368. @@ -1158,7 +1158,7 @@ NTSTATUS nfs41_OffloadWrite(
  369.          NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
  370.      __notnull PNFS41_NETROOT_EXTENSION pNetRootContext =
  371.          NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
  372. -    __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  373. +    __notnull const XXCTL_LOWIO_COMPONENT *FsCtl =
  374.          &RxContext->LowIoContext.ParamsFor.FsCtl;
  375.      __notnull PNFS41_FOBX nfs41_fobx = NFS41GetFobxExtension(RxContext->pFobx);
  376.      offloadcontext_entry *src_oce = NULL;
  377. @@ -1199,8 +1199,8 @@ NTSTATUS nfs41_OffloadWrite(
  378.          goto out;
  379.      }
  380.  
  381. -    PFSCTL_OFFLOAD_WRITE_INPUT owi =
  382. -        (PFSCTL_OFFLOAD_WRITE_INPUT)FsCtl->pInputBuffer;
  383. +    const PFSCTL_OFFLOAD_WRITE_INPUT owi =
  384. +        (const PFSCTL_OFFLOAD_WRITE_INPUT)FsCtl->pInputBuffer;
  385.      PFSCTL_OFFLOAD_WRITE_OUTPUT owo =
  386.          (PFSCTL_OFFLOAD_WRITE_OUTPUT)FsCtl->pOutputBuffer;
  387.  
  388. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  389. index ac5e8d6..c480c22 100644
  390. --- a/sys/nfs41sys_mount.c
  391. +++ b/sys/nfs41sys_mount.c
  392. @@ -176,7 +176,7 @@ NTSTATUS marshal_nfs41_unmount(
  393.  
  394.  void unmarshal_nfs41_mount(
  395.      nfs41_updowncall_entry *cur,
  396. -    unsigned char **buf)
  397. +    const unsigned char *restrict *restrict buf)
  398.  {
  399.      RtlCopyMemory(&cur->session, *buf, sizeof(HANDLE));
  400.      *buf += sizeof(HANDLE);
  401. @@ -1653,7 +1653,8 @@ NTSTATUS nfs41_CreateConnection(
  402.      NTSTATUS status = STATUS_SUCCESS;
  403.      HANDLE Handle = INVALID_HANDLE_VALUE;
  404.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  405. -    PVOID Buffer = LowIoContext->ParamsFor.IoCtl.pInputBuffer, EaBuffer;
  406. +    const PVOID Buffer = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  407. +    PVOID EaBuffer;
  408.      ULONG BufferLen = LowIoContext->ParamsFor.IoCtl.InputBufferLength, EaLength;
  409.      UNICODE_STRING FileName;
  410.      BOOLEAN Wait = BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT);
  411. @@ -1693,7 +1694,7 @@ NTSTATUS nfs41_DeleteConnection(
  412.  {
  413.      NTSTATUS status = STATUS_INVALID_PARAMETER;
  414.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  415. -    PWCHAR ConnectName = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  416. +    const PWCHAR ConnectName = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  417.      ULONG ConnectNameLen = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  418.      HANDLE Handle;
  419.      UNICODE_STRING FileName;
  420. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  421. index ca3b76f..e9d28f7 100644
  422. --- a/sys/nfs41sys_openclose.c
  423. +++ b/sys/nfs41sys_openclose.c
  424. @@ -240,7 +240,7 @@ out:
  425.  
  426.  NTSTATUS unmarshal_nfs41_open(
  427.      nfs41_updowncall_entry *cur,
  428. -    unsigned char **buf)
  429. +    const unsigned char *restrict *restrict buf)
  430.  {
  431.      NTSTATUS status = STATUS_SUCCESS;
  432.  
  433. diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
  434. index 9662e8c..63ed061 100644
  435. --- a/sys/nfs41sys_readwrite.c
  436. +++ b/sys/nfs41sys_readwrite.c
  437. @@ -161,7 +161,7 @@ out:
  438.  
  439.  NTSTATUS unmarshal_nfs41_rw(
  440.      nfs41_updowncall_entry *cur,
  441. -    unsigned char **buf)
  442. +    const unsigned char *restrict *restrict buf)
  443.  {
  444.      NTSTATUS status = STATUS_SUCCESS;
  445.  
  446. diff --git a/sys/nfs41sys_reparse.c b/sys/nfs41sys_reparse.c
  447. index 5d850b3..d774fd0 100644
  448. --- a/sys/nfs41sys_reparse.c
  449. +++ b/sys/nfs41sys_reparse.c
  450. @@ -76,8 +76,10 @@ NTSTATUS nfs41_SetReparsePoint(
  451.      IN OUT PRX_CONTEXT RxContext)
  452.  {
  453.      NTSTATUS status;
  454. -    __notnull XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
  455. -    __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  456. +    __notnull XXCTL_LOWIO_COMPONENT *FsCtl =
  457. +        &RxContext->LowIoContext.ParamsFor.FsCtl;
  458. +    __notnull const PREPARSE_DATA_BUFFER Reparse =
  459. +        (const PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  460.  
  461.      DbgEn();
  462.      FsRtlEnterFileSystem();
  463. diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
  464. index 77fe26e..9ee03f2 100644
  465. --- a/sys/nfs41sys_symlink.c
  466. +++ b/sys/nfs41sys_symlink.c
  467. @@ -121,7 +121,7 @@ out:
  468.  
  469.  void unmarshal_nfs41_symlink(
  470.      nfs41_updowncall_entry *cur,
  471. -    unsigned char **buf)
  472. +    const unsigned char *restrict *restrict buf)
  473.  {
  474.      if (cur->opcode == NFS41_SYSOP_SYMLINK_SET)
  475.          return;
  476. @@ -172,7 +172,8 @@ NTSTATUS check_nfs41_setsymlinkreparse_args(
  477.  {
  478.      NTSTATUS status = STATUS_SUCCESS;
  479.      __notnull XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
  480. -    __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  481. +    __notnull const PREPARSE_DATA_BUFFER Reparse =
  482. +        (const PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  483.      __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
  484.      __notnull PNFS41_V_NET_ROOT_EXTENSION VNetRootContext =
  485.          NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
  486. @@ -241,7 +242,8 @@ NTSTATUS nfs41_SetSymlinkReparsePoint(
  487.      NTSTATUS status;
  488.      UNICODE_STRING TargetName;
  489.      __notnull XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
  490. -    __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  491. +    __notnull const PREPARSE_DATA_BUFFER Reparse =
  492. +        (const PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  493.      __notnull PNFS41_FOBX Fobx = NFS41GetFobxExtension(RxContext->pFobx);
  494.      __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
  495.      __notnull PNFS41_V_NET_ROOT_EXTENSION VNetRootContext =
  496. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  497. index 7afc19f..fef489d 100644
  498. --- a/sys/nfs41sys_updowncall.c
  499. +++ b/sys/nfs41sys_updowncall.c
  500. @@ -142,7 +142,7 @@ void nfs41_downcall_free_updowncall_entry(nfs41_updowncall_entry *entry)
  501.  
  502.  static void unmarshal_nfs41_header(
  503.      nfs41_updowncall_entry *tmp,
  504. -    unsigned char **buf)
  505. +    const unsigned char *restrict *restrict buf)
  506.  {
  507.      RtlCopyMemory(&tmp->xid, *buf, sizeof(tmp->xid));
  508.      *buf += sizeof(tmp->xid);
  509. @@ -164,7 +164,7 @@ void unmarshal_nfs41_attrget(
  510.      nfs41_updowncall_entry *cur,
  511.      PVOID attr_value,
  512.      ULONG *attr_len,
  513. -    unsigned char **buf,
  514. +    const unsigned char *restrict *restrict buf,
  515.      BOOL copy_partial)
  516.  {
  517.      ULONG buf_len;
  518. @@ -612,9 +612,9 @@ NTSTATUS nfs41_downcall(
  519.      NTSTATUS status = STATUS_SUCCESS;
  520.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  521.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  522. -    ULONG in_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  523. +    ULONG inbuf_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  524.  #endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  525. -    unsigned char *buf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  526. +    const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  527.      PLIST_ENTRY pEntry;
  528.      nfs41_updowncall_entry *tmp, *cur= NULL;
  529.      BOOLEAN found = 0;
  530. @@ -622,7 +622,7 @@ NTSTATUS nfs41_downcall(
  531.      FsRtlEnterFileSystem();
  532.  
  533.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  534. -    print_hexbuf("downcall buffer", buf, in_len);
  535. +    print_hexbuf("downcall buffer", inbuf, inbuf_len);
  536.  #endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  537.  
  538.  #ifdef USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM
  539. @@ -637,7 +637,7 @@ NTSTATUS nfs41_downcall(
  540.      }
  541.  #endif /* USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM */
  542.  
  543. -    unmarshal_nfs41_header(tmp, &buf);
  544. +    unmarshal_nfs41_header(tmp, &inbuf);
  545.  
  546.      ExAcquireFastMutexUnsafe(&downcalllist.lock);
  547.      pEntry = &downcalllist.head;
  548. @@ -715,53 +715,53 @@ NTSTATUS nfs41_downcall(
  549.      if (!tmp->status) {
  550.          switch (tmp->opcode) {
  551.          case NFS41_SYSOP_MOUNT:
  552. -            unmarshal_nfs41_mount(cur, &buf);
  553. +            unmarshal_nfs41_mount(cur, &inbuf);
  554.              break;
  555.          case NFS41_SYSOP_WRITE:
  556.          case NFS41_SYSOP_READ:
  557. -            status = unmarshal_nfs41_rw(cur, &buf);
  558. +            status = unmarshal_nfs41_rw(cur, &inbuf);
  559.              break;
  560.          case NFS41_SYSOP_OPEN:
  561. -            status = unmarshal_nfs41_open(cur, &buf);
  562. +            status = unmarshal_nfs41_open(cur, &inbuf);
  563.              break;
  564.          case NFS41_SYSOP_DIR_QUERY:
  565. -            status = unmarshal_nfs41_dirquery(cur, &buf);
  566. +            status = unmarshal_nfs41_dirquery(cur, &inbuf);
  567.              break;
  568.          case NFS41_SYSOP_FILE_QUERY:
  569.          case NFS41_SYSOP_FILE_QUERY_TIME_BASED_COHERENCY:
  570. -            unmarshal_nfs41_getattr(cur, &buf);
  571. +            unmarshal_nfs41_getattr(cur, &inbuf);
  572.              break;
  573.          case NFS41_SYSOP_EA_GET:
  574. -            unmarshal_nfs41_eaget(cur, &buf);
  575. +            unmarshal_nfs41_eaget(cur, &inbuf);
  576.              break;
  577.          case NFS41_SYSOP_SYMLINK_GET:
  578.          case NFS41_SYSOP_SYMLINK_SET:
  579. -            unmarshal_nfs41_symlink(cur, &buf);
  580. +            unmarshal_nfs41_symlink(cur, &inbuf);
  581.              break;
  582.          case NFS41_SYSOP_VOLUME_QUERY:
  583. -            unmarshal_nfs41_volume(cur, &buf);
  584. +            unmarshal_nfs41_volume(cur, &inbuf);
  585.              break;
  586.          case NFS41_SYSOP_ACL_QUERY:
  587. -            status = unmarshal_nfs41_getacl(cur, &buf);
  588. +            status = unmarshal_nfs41_getacl(cur, &inbuf);
  589.              break;
  590.          case NFS41_SYSOP_FILE_SET:
  591. -            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &buf);
  592. +            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
  593.              break;
  594.          case NFS41_SYSOP_EA_SET:
  595. -            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &buf);
  596. +            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
  597.              break;
  598.          case NFS41_SYSOP_ACL_SET:
  599. -            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &buf);
  600. +            unmarshal_nfs41_setattr(cur, &cur->ChangeTime, &inbuf);
  601.              break;
  602.          case NFS41_SYSOP_FSCTL_QUERYALLOCATEDRANGES:
  603. -            unmarshal_nfs41_queryallocatedranges(cur, &buf);
  604. +            unmarshal_nfs41_queryallocatedranges(cur, &inbuf);
  605.              break;
  606.          case NFS41_SYSOP_FSCTL_SET_ZERO_DATA:
  607. -            unmarshal_nfs41_setzerodata(cur, &buf);
  608. +            unmarshal_nfs41_setzerodata(cur, &inbuf);
  609.              break;
  610.          case NFS41_SYSOP_FSCTL_DUPLICATE_DATA:
  611.          case NFS41_SYSOP_FSCTL_OFFLOAD_DATACOPY:
  612. -            unmarshal_nfs41_duplicatedata(cur, &buf);
  613. +            unmarshal_nfs41_duplicatedata(cur, &inbuf);
  614.              break;
  615.          }
  616.      }
  617. @@ -813,9 +813,9 @@ NTSTATUS nfs41_delayxid(
  618.      NTSTATUS status = STATUS_SUCCESS;
  619.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  620.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  621. -    ULONG in_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  622. +    ULONG inbuf_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  623.  #endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  624. -    unsigned char *buf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  625. +    const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  626.      PLIST_ENTRY pEntry;
  627.      nfs41_updowncall_entry *cur = NULL;
  628.      BOOLEAN found = FALSE;
  629. @@ -823,17 +823,17 @@ NTSTATUS nfs41_delayxid(
  630.      FsRtlEnterFileSystem();
  631.  
  632.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  633. -    print_hexbuf("delayxid buffer", buf, in_len);
  634. +    print_hexbuf("delayxid buffer", inbuf, inbuf_len);
  635.  #endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  636.  
  637.      LONGLONG delayxid;
  638.      LONGLONG moredelay;
  639.  
  640.      /* Unmarshal XID+delay value */
  641. -    RtlCopyMemory(&delayxid, buf, sizeof(delayxid));
  642. -    buf += sizeof(delayxid);
  643. -    RtlCopyMemory(&moredelay, buf, sizeof(moredelay));
  644. -    /* buf += sizeof(delay); */
  645. +    RtlCopyMemory(&delayxid, inbuf, sizeof(delayxid));
  646. +    inbuf += sizeof(delayxid);
  647. +    RtlCopyMemory(&moredelay, inbuf, sizeof(moredelay));
  648. +    /* inbuf += sizeof(delay); */
  649.  
  650.      ExAcquireFastMutexUnsafe(&downcalllist.lock);
  651.      pEntry = &downcalllist.head;
  652. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  653. index 0363c2e..2caad54 100644
  654. --- a/sys/nfs41sys_volinfo.c
  655. +++ b/sys/nfs41sys_volinfo.c
  656. @@ -101,7 +101,7 @@ out:
  657.  
  658.  void unmarshal_nfs41_volume(
  659.      nfs41_updowncall_entry *cur,
  660. -    unsigned char **buf)
  661. +    const unsigned char *restrict *restrict buf)
  662.  {
  663.      unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, TRUE);
  664.  }
  665. --
  666. 2.51.0
  667.  
  668. From 70d5455fe1153045e2cd9012d484e54384061fc4 Mon Sep 17 00:00:00 2001
  669. From: Roland Mainz <roland.mainz@nrubsig.org>
  670. Date: Mon, 6 Oct 2025 14:32:56 +0200
  671. Subject: [PATCH 2/6] sys: Kernel module should verify that it consumes all
  672.  |IOCTL_NFS41_WRITE| downcall bytes+fix issues
  673.  
  674. Kernel module should verify that it consumes all |IOCTL_NFS41_WRITE|
  675. downcall bytes, plus fix existing issues.
  676. |IOCTL_NFS41_WRITE| will now return |STATUS_BUFFER_OVERFLOW| if not
  677. all downcall bytes were processed.
  678.  
  679. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  680. ---
  681. sys/nfs41sys_acl.c        |  1 +
  682.  sys/nfs41sys_fileinfo.c   |  6 +++--
  683.  sys/nfs41sys_fsctl.c      |  4 ++-
  684.  sys/nfs41sys_mount.c      |  1 +
  685.  sys/nfs41sys_openclose.c  |  1 +
  686.  sys/nfs41sys_readwrite.c  |  3 ++-
  687.  sys/nfs41sys_symlink.c    |  1 +
  688.  sys/nfs41sys_updowncall.c | 55 ++++++++++++++++++++++++++++++++-------
  689.  8 files changed, 59 insertions(+), 13 deletions(-)
  690.  
  691. diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
  692. index d2c0a6e..e077b26 100644
  693. --- a/sys/nfs41sys_acl.c
  694. +++ b/sys/nfs41sys_acl.c
  695. @@ -151,6 +151,7 @@ NTSTATUS unmarshal_nfs41_getacl(
  696.          goto out;
  697.      }
  698.      RtlCopyMemory(cur->buf, *buf, buf_len);
  699. +    *buf += buf_len;
  700.      if (buf_len > cur->buf_len)
  701.          cur->status = STATUS_BUFFER_TOO_SMALL;
  702.      cur->buf_len = buf_len;
  703. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  704. index bc84e30..a2cc9c1 100644
  705. --- a/sys/nfs41sys_fileinfo.c
  706. +++ b/sys/nfs41sys_fileinfo.c
  707. @@ -143,7 +143,8 @@ void unmarshal_nfs41_setattr(
  708.      PULONGLONG dest_buf,
  709.      const unsigned char *restrict *restrict buf)
  710.  {
  711. -    RtlCopyMemory(dest_buf, *buf, sizeof(ULONGLONG));
  712. +    RtlCopyMemory(dest_buf, *buf, sizeof(*dest_buf));
  713. +    *buf += sizeof(*dest_buf);
  714.  #ifdef DEBUG_MARSHAL_DETAIL
  715.      DbgP("unmarshal_nfs41_setattr: returned ChangeTime %llu\n", *dest_buf);
  716.  #endif
  717. @@ -154,7 +155,8 @@ void unmarshal_nfs41_getattr(
  718.      const unsigned char *restrict *restrict buf)
  719.  {
  720.      unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, FALSE);
  721. -    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(ULONGLONG));
  722. +    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
  723. +    *buf += sizeof(cur->ChangeTime);
  724.  #ifdef DEBUG_MARSHAL_DETAIL
  725.      if (cur->u.QueryFile.InfoClass == FileBasicInformation)
  726.          DbgP("[unmarshal_nfs41_getattr] ChangeTime %llu\n", cur->ChangeTime);
  727. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  728. index 4a5d3f6..0e1ba89 100644
  729. --- a/sys/nfs41sys_fsctl.c
  730. +++ b/sys/nfs41sys_fsctl.c
  731. @@ -571,7 +571,8 @@ NTSTATUS unmarshal_nfs41_setzerodata(
  732.  {
  733.      NTSTATUS status = STATUS_SUCCESS;
  734.  
  735. -    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(ULONGLONG));
  736. +    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
  737. +    *buf += sizeof(cur->ChangeTime);
  738.      DbgP("unmarshal_nfs41_setzerodata: returned ChangeTime %llu\n",
  739.          cur->ChangeTime);
  740.  
  741. @@ -889,6 +890,7 @@ NTSTATUS unmarshal_nfs41_duplicatedata(
  742.      NTSTATUS status = STATUS_SUCCESS;
  743.  
  744.      RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(ULONGLONG));
  745. +    *buf += sizeof(cur->ChangeTime);
  746.      DbgP("unmarshal_nfs41_duplicatedata: returned ChangeTime %llu\n",
  747.          cur->ChangeTime);
  748.  
  749. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  750. index c480c22..7133e72 100644
  751. --- a/sys/nfs41sys_mount.c
  752. +++ b/sys/nfs41sys_mount.c
  753. @@ -186,6 +186,7 @@ void unmarshal_nfs41_mount(
  754.      *buf += sizeof(DWORD);
  755.      RtlCopyMemory(cur->u.Mount.FsAttrs, *buf,
  756.          sizeof(NFS41_FILE_FS_ATTRIBUTE_INFORMATION));
  757. +    *buf += sizeof(NFS41_FILE_FS_ATTRIBUTE_INFORMATION);
  758.  #ifdef DEBUG_MARSHAL_DETAIL
  759.      DbgP("unmarshal_nfs41_mount: session=0x%p version=%d lease_time "
  760.           "%d\n",
  761. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  762. index e9d28f7..8c6e287 100644
  763. --- a/sys/nfs41sys_openclose.c
  764. +++ b/sys/nfs41sys_openclose.c
  765. @@ -301,6 +301,7 @@ NTSTATUS unmarshal_nfs41_open(
  766.          }
  767.          RtlCopyMemory(cur->u.Open.symlink.Buffer, *buf,
  768.              cur->u.Open.symlink.Length);
  769. +        *buf += cur->u.Open.symlink.Length;
  770.          cur->u.Open.symlink.Buffer[cur->u.Open.symlink.Length/sizeof(wchar_t)] =
  771.              L'\0';
  772.  #ifdef DEBUG_MARSHAL_DETAIL
  773. diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
  774. index 63ed061..f1eface 100644
  775. --- a/sys/nfs41sys_readwrite.c
  776. +++ b/sys/nfs41sys_readwrite.c
  777. @@ -167,7 +167,8 @@ NTSTATUS unmarshal_nfs41_rw(
  778.  
  779.      RtlCopyMemory(&cur->buf_len, *buf, sizeof(cur->buf_len));
  780.      *buf += sizeof(cur->buf_len);
  781. -    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(ULONGLONG));
  782. +    RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
  783. +    *buf += sizeof(cur->ChangeTime);
  784.  #ifdef DEBUG_MARSHAL_DETAIL_RW
  785.      DbgP("unmarshal_nfs41_rw: returned len %lu ChangeTime %llu\n",
  786.          cur->buf_len, cur->ChangeTime);
  787. diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
  788. index 9ee03f2..c669565 100644
  789. --- a/sys/nfs41sys_symlink.c
  790. +++ b/sys/nfs41sys_symlink.c
  791. @@ -135,6 +135,7 @@ void unmarshal_nfs41_symlink(
  792.      }
  793.      RtlCopyMemory(cur->u.Symlink.target->Buffer, *buf,
  794.          cur->u.Symlink.target->Length);
  795. +    *buf += cur->u.Symlink.target->Length;
  796.  }
  797.  
  798.  NTSTATUS map_symlink_errors(
  799. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  800. index fef489d..78ec5a2 100644
  801. --- a/sys/nfs41sys_updowncall.c
  802. +++ b/sys/nfs41sys_updowncall.c
  803. @@ -168,7 +168,10 @@ void unmarshal_nfs41_attrget(
  804.      BOOL copy_partial)
  805.  {
  806.      ULONG buf_len;
  807. -    RtlCopyMemory(&buf_len, *buf, sizeof(ULONG));
  808. +
  809. +    RtlCopyMemory(&buf_len, *buf, sizeof(buf_len));
  810. +    *buf += sizeof(ULONG);
  811. +
  812.      if (copy_partial) {
  813.          if (buf_len > *attr_len) {
  814.              cur->status = STATUS_BUFFER_OVERFLOW;
  815. @@ -182,7 +185,6 @@ void unmarshal_nfs41_attrget(
  816.          }
  817.      }
  818.  
  819. -    *buf += sizeof(ULONG);
  820.      *attr_len = buf_len;
  821.      RtlCopyMemory(attr_value, *buf, buf_len);
  822.      *buf += buf_len;
  823. @@ -611,14 +613,15 @@ NTSTATUS nfs41_downcall(
  824.  {
  825.      NTSTATUS status = STATUS_SUCCESS;
  826.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  827. -#ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  828.      ULONG inbuf_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  829. -#endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  830. -    const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  831. +    const unsigned char *inbuf;
  832. +    const unsigned char *inbuf_orig;
  833.      PLIST_ENTRY pEntry;
  834.      nfs41_updowncall_entry *tmp, *cur= NULL;
  835.      BOOLEAN found = 0;
  836.  
  837. +    inbuf = inbuf_orig = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  838. +
  839.      FsRtlEnterFileSystem();
  840.  
  841.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  842. @@ -764,6 +767,25 @@ NTSTATUS nfs41_downcall(
  843.              unmarshal_nfs41_duplicatedata(cur, &inbuf);
  844.              break;
  845.          }
  846. +
  847. +        /*
  848. +         * Verify that we really read all bytes send by the userland daemon!
  849. +         * (|NFS41_SYSOP_VOLUME_QUERY| is exempt from this test, because most
  850. +         * volume queries allows partial reads from |inbuf| if the caller
  851. +         * passes a buffer which is too small)
  852. +         */
  853. +        ULONG bytesread_from_inbuf = (ULONG)(inbuf - inbuf_orig);
  854. +        if ((tmp->opcode != NFS41_SYSOP_VOLUME_QUERY) &&
  855. +            (bytesread_from_inbuf != inbuf_len)) {
  856. +            print_error("nfs41_downcall: ASSERT: '%s': "
  857. +                "(inbuf(=0x%p)-inbuf_orig(=0x%p))(=%ld) != inbuf_len(=%ld)\n",
  858. +                opcode2string(tmp->opcode),
  859. +                inbuf,
  860. +                inbuf_orig,
  861. +                (long)bytesread_from_inbuf,
  862. +                (long)inbuf_len);
  863. +            status = STATUS_BUFFER_OVERFLOW;
  864. +        }
  865.      }
  866.      ExReleaseFastMutexUnsafe(&cur->lock);
  867.      if (cur->async_op) {
  868. @@ -812,16 +834,17 @@ NTSTATUS nfs41_delayxid(
  869.  {
  870.      NTSTATUS status = STATUS_SUCCESS;
  871.      PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
  872. -#ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  873.      ULONG inbuf_len = LowIoContext->ParamsFor.IoCtl.InputBufferLength;
  874. -#endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  875. -    const unsigned char *inbuf = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  876. +    const unsigned char *inbuf;
  877. +    const unsigned char *inbuf_orig;
  878.      PLIST_ENTRY pEntry;
  879.      nfs41_updowncall_entry *cur = NULL;
  880.      BOOLEAN found = FALSE;
  881.  
  882.      FsRtlEnterFileSystem();
  883.  
  884. +    inbuf = inbuf_orig = LowIoContext->ParamsFor.IoCtl.pInputBuffer;
  885. +
  886.  #ifdef DEBUG_PRINT_DOWNCALL_HEXBUF
  887.      print_hexbuf("delayxid buffer", inbuf, inbuf_len);
  888.  #endif /* DEBUG_PRINT_DOWNCALL_HEXBUF */
  889. @@ -833,7 +856,21 @@ NTSTATUS nfs41_delayxid(
  890.      RtlCopyMemory(&delayxid, inbuf, sizeof(delayxid));
  891.      inbuf += sizeof(delayxid);
  892.      RtlCopyMemory(&moredelay, inbuf, sizeof(moredelay));
  893. -    /* inbuf += sizeof(delay); */
  894. +    inbuf += sizeof(moredelay);
  895. +
  896. +    /*
  897. +     * Verify that we really read all bytes send by the userland daemon!
  898. +     */
  899. +    ULONG bytesread_from_inbuf = (ULONG)(inbuf - inbuf_orig);
  900. +    if (bytesread_from_inbuf != inbuf_len) {
  901. +        print_error("nfs41_delayxid: ASSERT: "
  902. +            "(inbuf(=0x%p)-inbuf_orig(=0x%p))(=%ld) != inbuf_len(=%ld)\n",
  903. +            inbuf,
  904. +            inbuf_orig,
  905. +            (long)bytesread_from_inbuf,
  906. +            (long)inbuf_len);
  907. +        status = STATUS_BUFFER_OVERFLOW;
  908. +    }
  909.  
  910.      ExAcquireFastMutexUnsafe(&downcalllist.lock);
  911.      pEntry = &downcalllist.head;
  912. --
  913. 2.51.0
  914.  
  915. From 56076d38c86c5f8801bf7b1bf26002c544c10ba3 Mon Sep 17 00:00:00 2001
  916. From: Roland Mainz <roland.mainz@nrubsig.org>
  917. Date: Mon, 6 Oct 2025 17:13:43 +0200
  918. Subject: [PATCH 3/6] daemon: updowncall utility functions should use
  919.  |const|+|restrict|
  920.  
  921. updowncall utility functions should use |const|+|restrict|
  922.  
  923. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  924. ---
  925. daemon/util.c | 67 +++++++++++++++++++++++++++------------------------
  926.  daemon/util.h | 17 +++++++------
  927.  2 files changed, 45 insertions(+), 39 deletions(-)
  928.  
  929. diff --git a/daemon/util.c b/daemon/util.c
  930. index a9c96a3..1c284d9 100644
  931. --- a/daemon/util.c
  932. +++ b/daemon/util.c
  933. @@ -41,7 +41,8 @@ char *stpcpy(char *restrict s1, const char *restrict s2)
  934.      return ((char *)memcpy(s1, s2, (l+1)*sizeof(char))) + l*sizeof(char);
  935.  }
  936.  
  937. -int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len)
  938. +int safe_read(const unsigned char *restrict *restrict pos,
  939. +    uint32_t *restrict remaining, void *dest, uint32_t dest_len)
  940.  {
  941.      if (*remaining < dest_len)
  942.          return ERROR_BUFFER_OVERFLOW;
  943. @@ -57,7 +58,8 @@ int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t des
  944.   * have enough buffer space left, and in that case return current buffer
  945.   * position in |destbuffer|
  946.   */
  947. -int get_safe_read_bufferpos(unsigned char **pos, uint32_t *remaining, uint32_t src_len, void **destbuffer)
  948. +int get_safe_read_bufferpos(const unsigned char *restrict *restrict pos,
  949. +    uint32_t *restrict remaining, uint32_t src_len, const void **destbuffer)
  950.  {
  951.      if (*remaining < src_len)
  952.          return ERROR_BUFFER_OVERFLOW;
  953. @@ -68,8 +70,36 @@ int get_safe_read_bufferpos(unsigned char **pos, uint32_t *remaining, uint32_t s
  954.      return ERROR_SUCCESS;
  955.  }
  956.  
  957. +int get_name(const unsigned char *restrict *restrict pos,
  958. +    uint32_t *restrict remaining, const char *restrict *restrict out_name)
  959. +{
  960. +    int status;
  961. +    USHORT len;
  962. +    const char *name;
  963. +
  964. +    status = safe_read(pos, remaining, &len, sizeof(USHORT));
  965. +    if (status) goto out;
  966. +    if (*remaining < len) {
  967. +        status = ERROR_BUFFER_OVERFLOW;
  968. +        goto out;
  969. +    }
  970. +
  971. +    name = (const char *)*pos;
  972. +
  973. +    EASSERT_MSG((name[len-1] == '\0'),
  974. +        ("name='%s', (len-1)=%d, expected 0x00, got 0x%x\n",
  975. +        name, (int)(len-1), (int)name[len-1]));
  976. +
  977. +    *out_name = name;
  978. +    *pos += len;
  979. +    *remaining -= len;
  980. +
  981. +out:
  982. +    return status;
  983. +}
  984.  
  985. -int safe_write(unsigned char **pos, uint32_t *remaining, void *src, uint32_t src_len)
  986. +int safe_write(unsigned char *restrict *restrict pos,
  987. +    uint32_t *restrict remaining, const void *src, uint32_t src_len)
  988.  {
  989.      if (*remaining < src_len)
  990.          return ERROR_BUFFER_OVERFLOW;
  991. @@ -85,7 +115,8 @@ int safe_write(unsigned char **pos, uint32_t *remaining, void *src, uint32_t src
  992.   * have enough buffer space left, and in that case return current buffer
  993.   * position in |destbuffer|
  994.   */
  995. -int get_safe_write_bufferpos(unsigned char **pos, uint32_t *remaining, uint32_t src_len, void **destbuffer)
  996. +int get_safe_write_bufferpos(unsigned char *restrict *restrict pos,
  997. +    uint32_t *restrict remaining, uint32_t src_len, void **destbuffer)
  998.  {
  999.      if (*remaining < src_len)
  1000.          return ERROR_BUFFER_OVERFLOW;
  1001. @@ -96,34 +127,6 @@ int get_safe_write_bufferpos(unsigned char **pos, uint32_t *remaining, uint32_t
  1002.      return ERROR_SUCCESS;
  1003.  }
  1004.  
  1005. -
  1006. -int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
  1007. -{
  1008. -    int status;
  1009. -    USHORT len;
  1010. -    const char *name;
  1011. -    
  1012. -    status = safe_read(pos, remaining, &len, sizeof(USHORT));
  1013. -    if (status) goto out;
  1014. -    if (*remaining < len) {
  1015. -        status = ERROR_BUFFER_OVERFLOW;
  1016. -        goto out;
  1017. -    }
  1018. -
  1019. -    name = (const char *)*pos;
  1020. -
  1021. -    EASSERT_MSG((name[len-1] == '\0'),
  1022. -        ("name='%s', (len-1)=%d, expected 0x00, got 0x%x\n",
  1023. -        name, (int)(len-1), (int)name[len-1]));
  1024. -
  1025. -    *out_name = name;
  1026. -    *pos += len;
  1027. -    *remaining -= len;
  1028. -
  1029. -out:
  1030. -    return status;
  1031. -}
  1032. -
  1033.  const char* strip_path(
  1034.      IN const char *path,
  1035.      OUT uint32_t *len_out)
  1036. diff --git a/daemon/util.h b/daemon/util.h
  1037. index a424442..bb3fbaa 100644
  1038. --- a/daemon/util.h
  1039. +++ b/daemon/util.h
  1040. @@ -93,13 +93,16 @@ void *memrchr(const void * restrict s, int c, size_t n)
  1041.      return NULL;
  1042.  }
  1043.  
  1044. -int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  1045. -int get_safe_read_bufferpos(unsigned char **pos, uint32_t *remaining,
  1046. -    uint32_t src_len, void **destbuffer);
  1047. -int safe_write(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  1048. -int get_safe_write_bufferpos(unsigned char **pos, uint32_t *remaining,
  1049. -    uint32_t src_len, void **destbuffer);
  1050. -int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name);
  1051. +int safe_read(const unsigned char *restrict *restrict pos,
  1052. +    uint32_t *restrict remaining, void *dest, uint32_t dest_len);
  1053. +int get_safe_read_bufferpos(const unsigned char *restrict *restrict pos,
  1054. +    uint32_t *restrict remaining, uint32_t src_len, const void **destbuffer);
  1055. +int get_name(const unsigned char *restrict *restrict pos,
  1056. +    uint32_t *restrict remaining, const char *restrict *restrict out_name);
  1057. +int safe_write(unsigned char *restrict *restrict pos,
  1058. +    uint32_t *restrict remaining, const void *src, uint32_t src_len);
  1059. +int get_safe_write_bufferpos(unsigned char *restrict *restrict pos,
  1060. +    uint32_t *restrict remaining, uint32_t src_len, void **destbuffer);
  1061.  
  1062.  const char* strip_path(
  1063.      IN const char *path,
  1064. --
  1065. 2.51.0
  1066.  
  1067. From c0239b45aeef3e7817ba9060d4a5e70f17a07d13 Mon Sep 17 00:00:00 2001
  1068. From: Roland Mainz <roland.mainz@nrubsig.org>
  1069. Date: Mon, 6 Oct 2025 18:35:52 +0200
  1070. Subject: [PATCH 4/6] build.vc19: Do not use the (debug) |memcpy_inline()|
  1071.  function
  1072.  
  1073. Do not use the (debug) |memcpy_inline()| function. It causes
  1074. inteference with debuggers and DrMemory, and DrMemory does
  1075. the job better anyway.
  1076.  
  1077. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  1078. ---
  1079. build.vc19/libtirpc/libtirpc.vcxproj       | 12 ++++++------
  1080.  build.vc19/nfs41_np/nfs41_np.vcxproj       | 12 ++++++------
  1081.  build.vc19/nfs_install/nfs_install.vcxproj | 12 ++++++------
  1082.  build.vc19/nfs_mount/nfs_mount.vcxproj     | 12 ++++++------
  1083.  build.vc19/nfsd/nfsd.vcxproj               | 12 ++++++------
  1084.  5 files changed, 30 insertions(+), 30 deletions(-)
  1085.  
  1086. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  1087. index 815629f..4034b0b 100644
  1088. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  1089. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  1090. @@ -126,7 +126,7 @@
  1091.        </PrecompiledHeader>
  1092.        <WarningLevel>Level4</WarningLevel>
  1093.        <Optimization>Disabled</Optimization>
  1094. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1095. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1096.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1097.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1098.        <StringPooling>true</StringPooling>
  1099. @@ -152,7 +152,7 @@
  1100.        </PrecompiledHeader>
  1101.        <WarningLevel>Level4</WarningLevel>
  1102.        <Optimization>Disabled</Optimization>
  1103. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1104. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1105.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1106.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1107.        <StringPooling>true</StringPooling>
  1108. @@ -178,7 +178,7 @@
  1109.        </PrecompiledHeader>
  1110.        <WarningLevel>Level4</WarningLevel>
  1111.        <Optimization>Disabled</Optimization>
  1112. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1113. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1114.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1115.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1116.        <StringPooling>true</StringPooling>
  1117. @@ -204,7 +204,7 @@
  1118.        </PrecompiledHeader>
  1119.        <Optimization>MaxSpeed</Optimization>
  1120.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1121. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1122. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1123.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1124.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1125.        <StringPooling>true</StringPooling>
  1126. @@ -234,7 +234,7 @@
  1127.        </PrecompiledHeader>
  1128.        <Optimization>MaxSpeed</Optimization>
  1129.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1130. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1131. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1132.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1133.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1134.        <StringPooling>true</StringPooling>
  1135. @@ -264,7 +264,7 @@
  1136.        </PrecompiledHeader>
  1137.        <Optimization>MaxSpeed</Optimization>
  1138.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1139. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1140. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1141.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1142.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1143.        <StringPooling>true</StringPooling>
  1144. diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
  1145. index e922c2e..5806707 100644
  1146. --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
  1147. +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
  1148. @@ -129,7 +129,7 @@
  1149.        </PrecompiledHeader>
  1150.        <WarningLevel>Level4</WarningLevel>
  1151.        <Optimization>Disabled</Optimization>
  1152. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1153. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1154.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1155.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1156.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1157. @@ -150,7 +150,7 @@
  1158.        </PrecompiledHeader>
  1159.        <WarningLevel>Level4</WarningLevel>
  1160.        <Optimization>Disabled</Optimization>
  1161. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1162. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1163.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1164.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1165.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1166. @@ -171,7 +171,7 @@
  1167.        </PrecompiledHeader>
  1168.        <WarningLevel>Level4</WarningLevel>
  1169.        <Optimization>Disabled</Optimization>
  1170. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1171. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1172.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1173.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1174.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1175. @@ -193,7 +193,7 @@
  1176.        <Optimization>MaxSpeed</Optimization>
  1177.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1178.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1179. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1180. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1181.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1182.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1183.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1184. @@ -217,7 +217,7 @@
  1185.        <Optimization>MaxSpeed</Optimization>
  1186.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1187.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1188. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1189. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1190.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1191.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1192.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1193. @@ -241,7 +241,7 @@
  1194.        <Optimization>MaxSpeed</Optimization>
  1195.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1196.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1197. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1198. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1199.        <AdditionalIncludeDirectories>..\..\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1200.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1201.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1202. diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
  1203. index 19b133e..192bdaf 100644
  1204. --- a/build.vc19/nfs_install/nfs_install.vcxproj
  1205. +++ b/build.vc19/nfs_install/nfs_install.vcxproj
  1206. @@ -126,7 +126,7 @@
  1207.        </PrecompiledHeader>
  1208.        <WarningLevel>Level4</WarningLevel>
  1209.        <Optimization>Disabled</Optimization>
  1210. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1211. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1212.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1213.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1214.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1215. @@ -144,7 +144,7 @@
  1216.        </PrecompiledHeader>
  1217.        <WarningLevel>Level4</WarningLevel>
  1218.        <Optimization>Disabled</Optimization>
  1219. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1220. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1221.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1222.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1223.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1224. @@ -162,7 +162,7 @@
  1225.        </PrecompiledHeader>
  1226.        <WarningLevel>Level4</WarningLevel>
  1227.        <Optimization>Disabled</Optimization>
  1228. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1229. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1230.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1231.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1232.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1233. @@ -182,7 +182,7 @@
  1234.        <Optimization>MaxSpeed</Optimization>
  1235.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1236.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1237. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1238. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1239.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1240.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1241.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1242. @@ -203,7 +203,7 @@
  1243.        <Optimization>MaxSpeed</Optimization>
  1244.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1245.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1246. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1247. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1248.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1249.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1250.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1251. @@ -224,7 +224,7 @@
  1252.        <Optimization>MaxSpeed</Optimization>
  1253.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1254.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1255. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1256. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1257.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1258.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1259.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1260. diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
  1261. index 6d590d1..ac139f7 100644
  1262. --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
  1263. +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
  1264. @@ -132,7 +132,7 @@
  1265.        </PrecompiledHeader>
  1266.        <WarningLevel>Level4</WarningLevel>
  1267.        <Optimization>Disabled</Optimization>
  1268. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1269. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1270.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1271.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1272.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1273. @@ -151,7 +151,7 @@
  1274.        </PrecompiledHeader>
  1275.        <WarningLevel>Level4</WarningLevel>
  1276.        <Optimization>Disabled</Optimization>
  1277. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1278. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1279.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1280.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1281.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1282. @@ -170,7 +170,7 @@
  1283.        </PrecompiledHeader>
  1284.        <WarningLevel>Level4</WarningLevel>
  1285.        <Optimization>Disabled</Optimization>
  1286. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1287. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1288.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1289.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1290.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  1291. @@ -191,7 +191,7 @@
  1292.        <Optimization>MaxSpeed</Optimization>
  1293.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1294.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1295. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1296. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1297.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1298.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1299.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1300. @@ -213,7 +213,7 @@
  1301.        <Optimization>MaxSpeed</Optimization>
  1302.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1303.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1304. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1305. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1306.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1307.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1308.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1309. @@ -235,7 +235,7 @@
  1310.        <Optimization>MaxSpeed</Optimization>
  1311.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1312.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1313. -      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1314. +      <PreprocessorDefinitions>WIN32;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1315.        <AdditionalIncludeDirectories>..\..\include;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1316.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1317.        <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  1318. diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
  1319. index 7cfa57a..e38f629 100644
  1320. --- a/build.vc19/nfsd/nfsd.vcxproj
  1321. +++ b/build.vc19/nfsd/nfsd.vcxproj
  1322. @@ -132,7 +132,7 @@
  1323.        </PrecompiledHeader>
  1324.        <WarningLevel>Level4</WarningLevel>
  1325.        <Optimization>Disabled</Optimization>
  1326. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1327. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1328.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1329.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1330.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  1331. @@ -157,7 +157,7 @@
  1332.        </PrecompiledHeader>
  1333.        <WarningLevel>Level4</WarningLevel>
  1334.        <Optimization>Disabled</Optimization>
  1335. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1336. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1337.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1338.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1339.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  1340. @@ -183,7 +183,7 @@
  1341.        </PrecompiledHeader>
  1342.        <WarningLevel>Level4</WarningLevel>
  1343.        <Optimization>Disabled</Optimization>
  1344. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1345. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1346.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1347.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1348.        <BasicRuntimeChecks>Default</BasicRuntimeChecks>
  1349. @@ -210,7 +210,7 @@
  1350.        <Optimization>MaxSpeed</Optimization>
  1351.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1352.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1353. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1354. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1355.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1356.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1357.        <BufferSecurityCheck>false</BufferSecurityCheck>
  1358. @@ -238,7 +238,7 @@
  1359.        <Optimization>MaxSpeed</Optimization>
  1360.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1361.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1362. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1363. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1364.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1365.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1366.        <BufferSecurityCheck>false</BufferSecurityCheck>
  1367. @@ -267,7 +267,7 @@
  1368.        <Optimization>MaxSpeed</Optimization>
  1369.        <FunctionLevelLinking>true</FunctionLevelLinking>
  1370.        <IntrinsicFunctions>true</IntrinsicFunctions>
  1371. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1372. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_WINTIRPC;_CRT_STDIO_ISO_WIDE_SPECIFIERS=1;_MEMCPY_INLINE_=1;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  1373.        <AdditionalIncludeDirectories>..\..\include;..\..\libtirpc\tirpc;..\..\dll;..\..;$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  1374.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  1375.        <BufferSecurityCheck>false</BufferSecurityCheck>
  1376. --
  1377. 2.51.0
  1378.  
  1379. From 055b2219765ba62fbb7a93f6a35d26323732e37c Mon Sep 17 00:00:00 2001
  1380. From: Roland Mainz <roland.mainz@nrubsig.org>
  1381. Date: Mon, 6 Oct 2025 19:59:20 +0200
  1382. Subject: [PATCH 5/6] daemon: Use |restrict|+|const| for |parse_*()| upcall
  1383.  functions
  1384.  
  1385. Use |restrict|+|const| for |parse_*()| upcall functions.
  1386.  
  1387. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  1388. ---
  1389. daemon/acl.c       | 12 ++++++++----
  1390.  daemon/ea.c        | 10 ++++++++--
  1391.  daemon/fsctl.c     | 18 ++++++++++++------
  1392.  daemon/getattr.c   |  5 ++++-
  1393.  daemon/lock.c      | 10 ++++++++--
  1394.  daemon/mount.c     |  9 +++++++--
  1395.  daemon/open.c      | 15 ++++++++++++---
  1396.  daemon/readdir.c   |  5 ++++-
  1397.  daemon/readwrite.c |  5 ++++-
  1398.  daemon/setattr.c   |  5 ++++-
  1399.  daemon/symlink.c   |  8 ++++++--
  1400.  daemon/upcall.c    |  2 +-
  1401.  daemon/upcall.h    |  7 +++++--
  1402.  daemon/volume.c    |  5 ++++-
  1403.  14 files changed, 87 insertions(+), 29 deletions(-)
  1404.  
  1405. diff --git a/daemon/acl.c b/daemon/acl.c
  1406. index c37a7c8..a2f2749 100644
  1407. --- a/daemon/acl.c
  1408. +++ b/daemon/acl.c
  1409. @@ -55,8 +55,10 @@ static void map_winaccessmask2nfs4acemask(ACCESS_MASK win_mask,
  1410.  static void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask,
  1411.      int file_type, bool named_attr_support, ACCESS_MASK *win_mask);
  1412.  
  1413. -static int parse_getacl(unsigned char *buffer, uint32_t length,
  1414. -                        nfs41_upcall *upcall)
  1415. +static int parse_getacl(
  1416. +    const unsigned char *restrict buffer,
  1417. +    uint32_t length,
  1418. +    nfs41_upcall *upcall)
  1419.  {
  1420.      int status;
  1421.      getacl_upcall_args *args = &upcall->args.getacl;
  1422. @@ -518,8 +520,10 @@ const nfs41_upcall_op nfs41_op_getacl = {
  1423.      .arg_size = sizeof(getacl_upcall_args)
  1424.  };
  1425.  
  1426. -static int parse_setacl(unsigned char *buffer, uint32_t length,
  1427. -                        nfs41_upcall *upcall)
  1428. +static int parse_setacl(
  1429. +    const unsigned char *restrict buffer,
  1430. +    uint32_t length,
  1431. +    nfs41_upcall *upcall)
  1432.  {
  1433.      int status;
  1434.      setacl_upcall_args *args = &upcall->args.setacl;
  1435. diff --git a/daemon/ea.c b/daemon/ea.c
  1436. index b6f1613..f33c757 100644
  1437. --- a/daemon/ea.c
  1438. +++ b/daemon/ea.c
  1439. @@ -187,7 +187,10 @@ out:
  1440.  
  1441.  
  1442.  /* NFS41_SYSOP_EA_SET */
  1443. -static int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1444. +static int parse_setexattr(
  1445. +    const unsigned char *restrict buffer,
  1446. +    uint32_t length,
  1447. +    nfs41_upcall *upcall)
  1448.  {
  1449.      int status;
  1450.      setexattr_upcall_args *args = &upcall->args.setexattr;
  1451. @@ -264,7 +267,10 @@ static int marshall_setexattr(unsigned char *buffer, uint32_t *length, nfs41_upc
  1452.  
  1453.  
  1454.  /* NFS41_SYSOP_EA_GET */
  1455. -static int parse_getexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1456. +static int parse_getexattr(
  1457. +    const unsigned char *restrict buffer,
  1458. +    uint32_t length,
  1459. +    nfs41_upcall *upcall)
  1460.  {
  1461.      int status;
  1462.      getexattr_upcall_args *args = &upcall->args.getexattr;
  1463. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  1464. index dbc76f6..096d207 100644
  1465. --- a/daemon/fsctl.c
  1466. +++ b/daemon/fsctl.c
  1467. @@ -31,8 +31,10 @@
  1468.  #define SZDLVL 2 /* dprintf level for "set zero data" logging */
  1469.  #define DDLVL  2 /* dprintf level for "duplicate data" logging */
  1470.  
  1471. -static int parse_queryallocatedranges(unsigned char *buffer,
  1472. -    uint32_t length, nfs41_upcall *upcall)
  1473. +static int parse_queryallocatedranges(
  1474. +    const unsigned char *restrict buffer,
  1475. +    uint32_t length,
  1476. +    nfs41_upcall *upcall)
  1477.  {
  1478.      int status;
  1479.      queryallocatedranges_upcall_args *args = &upcall->args.queryallocatedranges;
  1480. @@ -319,8 +321,10 @@ const nfs41_upcall_op nfs41_op_queryallocatedranges = {
  1481.      .arg_size = sizeof(queryallocatedranges_upcall_args)
  1482.  };
  1483.  
  1484. -static int parse_setzerodata(unsigned char *buffer,
  1485. -    uint32_t length, nfs41_upcall *upcall)
  1486. +static int parse_setzerodata(
  1487. +    const unsigned char *restrict buffer,
  1488. +    uint32_t length,
  1489. +    nfs41_upcall *upcall)
  1490.  {
  1491.      int status;
  1492.      setzerodata_upcall_args *args = &upcall->args.setzerodata;
  1493. @@ -438,8 +442,10 @@ const nfs41_upcall_op nfs41_op_setzerodata = {
  1494.      .arg_size = sizeof(setzerodata_upcall_args)
  1495.  };
  1496.  
  1497. -static int parse_duplicatedata(unsigned char *buffer,
  1498. -    uint32_t length, nfs41_upcall *upcall)
  1499. +static int parse_duplicatedata(
  1500. +    const unsigned char *restrict buffer,
  1501. +    uint32_t length,
  1502. +    nfs41_upcall *upcall)
  1503.  {
  1504.      int status;
  1505.      duplicatedata_upcall_args *args = &upcall->args.duplicatedata;
  1506. diff --git a/daemon/getattr.c b/daemon/getattr.c
  1507. index f5622d2..bc6709f 100644
  1508. --- a/daemon/getattr.c
  1509. +++ b/daemon/getattr.c
  1510. @@ -83,7 +83,10 @@ int nfs41_cached_getattr(
  1511.  }
  1512.  
  1513.  /* NFS41_SYSOP_FILE_QUERY, NFS41_SYSOP_FILE_QUERY_TIME_BASED_COHERENCY */
  1514. -static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1515. +static int parse_getattr(
  1516. +    const unsigned char *restrict buffer,
  1517. +    uint32_t length,
  1518. +    nfs41_upcall *upcall)
  1519.  {
  1520.      int status;
  1521.  
  1522. diff --git a/daemon/lock.c b/daemon/lock.c
  1523. index 7588a3c..03958b5 100644
  1524. --- a/daemon/lock.c
  1525. +++ b/daemon/lock.c
  1526. @@ -168,7 +168,10 @@ static void open_unlock_remove(
  1527.  
  1528.  
  1529.  /* NFS41_SYSOP_LOCK */
  1530. -static int parse_lock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1531. +static int parse_lock(
  1532. +    const unsigned char *restrict buffer,
  1533. +    uint32_t length,
  1534. +    nfs41_upcall *upcall)
  1535.  {
  1536.      int status;
  1537.      lock_upcall_args *args = &upcall->args.lock;
  1538. @@ -351,7 +354,10 @@ out:
  1539.  
  1540.  
  1541.  /* NFS41_SYSOP_UNLOCK */
  1542. -static int parse_unlock(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1543. +static int parse_unlock(
  1544. +    const unsigned char *restrict buffer,
  1545. +    uint32_t length,
  1546. +    nfs41_upcall *upcall)
  1547.  {
  1548.      int status;
  1549.      unlock_upcall_args *args = &upcall->args.unlock;
  1550. diff --git a/daemon/mount.c b/daemon/mount.c
  1551. index 2105375..88c3067 100644
  1552. --- a/daemon/mount.c
  1553. +++ b/daemon/mount.c
  1554. @@ -36,7 +36,10 @@
  1555.  
  1556.  
  1557.  /* NFS41_SYSOP_MOUNT */
  1558. -static int parse_mount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1559. +static int parse_mount(
  1560. +    const unsigned char *restrict buffer,
  1561. +    uint32_t length,
  1562. +    nfs41_upcall *upcall)
  1563.  {
  1564.      int status;
  1565.      mount_upcall_args *args = &upcall->args.mount;
  1566. @@ -346,7 +349,9 @@ const nfs41_upcall_op nfs41_op_mount = {
  1567.  
  1568.  
  1569.  /* NFS41_SYSOP_UNMOUNT */
  1570. -static int parse_unmount(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1571. +static int parse_unmount(const unsigned char *restrict buffer,
  1572. +    uint32_t length,
  1573. +    nfs41_upcall *upcall)
  1574.  {
  1575.      DPRINTF(1, ("parsing NFS41_SYSOP_UNMOUNT: root=0x%p\n", upcall->root_ref));
  1576.  
  1577. diff --git a/daemon/open.c b/daemon/open.c
  1578. index d93ec60..bad410b 100644
  1579. --- a/daemon/open.c
  1580. +++ b/daemon/open.c
  1581. @@ -299,7 +299,10 @@ static int open_or_delegate(
  1582.  }
  1583.  
  1584.  
  1585. -static int parse_abs_path(unsigned char **buffer, uint32_t *length, nfs41_abs_path *path)
  1586. +static int parse_abs_path(
  1587. +    const unsigned char **restrict buffer,
  1588. +    uint32_t *restrict length,
  1589. +    nfs41_abs_path *restrict path)
  1590.  {
  1591.      int status = safe_read(buffer, length, &path->len, sizeof(USHORT));
  1592.      if (status) goto out;
  1593. @@ -317,7 +320,10 @@ out:
  1594.  }
  1595.  
  1596.  /* NFS41_SYSOP_OPEN */
  1597. -static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1598. +static int parse_open(
  1599. +    const unsigned char *restrict buffer,
  1600. +    uint32_t length,
  1601. +    nfs41_upcall *upcall)
  1602.  {
  1603.      int status;
  1604.      open_upcall_args *args = &upcall->args.open;
  1605. @@ -1347,7 +1353,10 @@ out:
  1606.  
  1607.  
  1608.  /* NFS41_SYSOP_CLOSE */
  1609. -static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1610. +static int parse_close(
  1611. +    const unsigned char *restrict buffer,
  1612. +    uint32_t length,
  1613. +    nfs41_upcall *upcall)
  1614.  {
  1615.      int status;
  1616.      close_upcall_args *args = &upcall->args.close;
  1617. diff --git a/daemon/readdir.c b/daemon/readdir.c
  1618. index 407bcfb..c7f0d18 100644
  1619. --- a/daemon/readdir.c
  1620. +++ b/daemon/readdir.c
  1621. @@ -263,7 +263,10 @@ typedef union _FILE_DIR_INFO_UNION {
  1622.  
  1623.  
  1624.  /* NFS41_SYSOP_DIR_QUERY */
  1625. -static int parse_readdir(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1626. +static int parse_readdir(
  1627. +    const unsigned char *restrict buffer,
  1628. +    uint32_t length,
  1629. +    nfs41_upcall *upcall)
  1630.  {
  1631.      int status;
  1632.      readdir_upcall_args *args = &upcall->args.readdir;
  1633. diff --git a/daemon/readwrite.c b/daemon/readwrite.c
  1634. index 2be92b6..4dd610f 100644
  1635. --- a/daemon/readwrite.c
  1636. +++ b/daemon/readwrite.c
  1637. @@ -38,7 +38,10 @@
  1638.  const stateid4 special_read_stateid = {0xffffffff,
  1639.      {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
  1640.  
  1641. -static int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1642. +static int parse_rw(
  1643. +    const unsigned char *restrict buffer,
  1644. +    uint32_t length,
  1645. +    nfs41_upcall *upcall)
  1646.  {
  1647.      int status;
  1648.      readwrite_upcall_args *args = &upcall->args.rw;
  1649. diff --git a/daemon/setattr.c b/daemon/setattr.c
  1650. index fe920a2..aba6aee 100644
  1651. --- a/daemon/setattr.c
  1652. +++ b/daemon/setattr.c
  1653. @@ -42,7 +42,10 @@
  1654.  #endif
  1655.  
  1656.  /* NFS41_SYSOP_FILE_SET */
  1657. -static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1658. +static int parse_setattr(
  1659. +    const unsigned char *restrict buffer,
  1660. +    uint32_t length,
  1661. +    nfs41_upcall *upcall)
  1662.  {
  1663.      int status;
  1664.      setattr_upcall_args *args = &upcall->args.setattr;
  1665. diff --git a/daemon/symlink.c b/daemon/symlink.c
  1666. index 2eb947b..49c3271 100644
  1667. --- a/daemon/symlink.c
  1668. +++ b/daemon/symlink.c
  1669. @@ -236,7 +236,9 @@ out:
  1670.  
  1671.  
  1672.  /* NFS41_SYSOP_SYMLINK_GET */
  1673. -static int parse_symlink_get(unsigned char *buffer, uint32_t length,
  1674. +static int parse_symlink_get(
  1675. +    const unsigned char *restrict buffer,
  1676. +    uint32_t length,
  1677.      nfs41_upcall *upcall)
  1678.  {
  1679.      symlink_upcall_args *args = &upcall->args.symlink;
  1680. @@ -332,7 +334,9 @@ const nfs41_upcall_op nfs41_op_symlink_get = {
  1681.  };
  1682.  
  1683.  /* NFS41_SYSOP_SYMLINK_SET */
  1684. -static int parse_symlink_set(unsigned char *buffer, uint32_t length,
  1685. +static int parse_symlink_set(
  1686. +    const unsigned char *restrict buffer,
  1687. +    uint32_t length,
  1688.      nfs41_upcall *upcall)
  1689.  {
  1690.      symlink_upcall_args *args = &upcall->args.symlink;
  1691. diff --git a/daemon/upcall.c b/daemon/upcall.c
  1692. index 53433c4..afd7130 100644
  1693. --- a/daemon/upcall.c
  1694. +++ b/daemon/upcall.c
  1695. @@ -87,7 +87,7 @@ static const uint32_t g_upcall_op_table_size = ARRAYSIZE(g_upcall_op_table);
  1696.  
  1697.  
  1698.  int upcall_parse(
  1699. -    IN unsigned char *buffer,
  1700. +    IN const unsigned char *restrict buffer,
  1701.      IN uint32_t length,
  1702.      OUT nfs41_upcall *upcall)
  1703.  {
  1704. diff --git a/daemon/upcall.h b/daemon/upcall.h
  1705. index b16719b..43016e5 100644
  1706. --- a/daemon/upcall.h
  1707. +++ b/daemon/upcall.h
  1708. @@ -282,7 +282,10 @@ typedef struct __nfs41_upcall {
  1709.  
  1710.  
  1711.  /* upcall operation interface */
  1712. -typedef int (*upcall_parse_proc)(unsigned char*, uint32_t, nfs41_upcall*);
  1713. +typedef int (*upcall_parse_proc)(
  1714. +    const unsigned char *restrict buffer,
  1715. +    uint32_t length,
  1716. +    nfs41_upcall *upcall);
  1717.  typedef int (*upcall_handle_proc)(void*, nfs41_upcall*);
  1718.  typedef int (*upcall_marshall_proc)(unsigned char*, uint32_t*, nfs41_upcall*);
  1719.  typedef void (*upcall_cancel_proc)(nfs41_upcall*);
  1720. @@ -300,7 +303,7 @@ typedef struct __nfs41_upcall_op {
  1721.  
  1722.  /* upcall.c */
  1723.  int upcall_parse(
  1724. -    IN unsigned char *buffer,
  1725. +    IN const unsigned char *restrict buffer,
  1726.      IN uint32_t length,
  1727.      OUT nfs41_upcall *upcall);
  1728.  
  1729. diff --git a/daemon/volume.c b/daemon/volume.c
  1730. index 2eb29bc..8a6ef44 100644
  1731. --- a/daemon/volume.c
  1732. +++ b/daemon/volume.c
  1733. @@ -45,7 +45,10 @@
  1734.  
  1735.  
  1736.  /* NFS41_SYSOP_VOLUME_QUERY */
  1737. -static int parse_volume(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  1738. +static int parse_volume(
  1739. +    const unsigned char *restrict buffer,
  1740. +    uint32_t length,
  1741. +    nfs41_upcall *upcall)
  1742.  {
  1743.      int status;
  1744.      volume_upcall_args *args = &upcall->args.volume;
  1745. --
  1746. 2.51.0
  1747.  
  1748. From 281309b5bc9aab734ad42396ab8f4284f3c4a754 Mon Sep 17 00:00:00 2001
  1749. From: Roland Mainz <roland.mainz@nrubsig.org>
  1750. Date: Mon, 6 Oct 2025 21:09:28 +0200
  1751. Subject: [PATCH 6/6] daemon: Fix clang |const| warnings
  1752.  
  1753. Fix clang |const| warnings.
  1754.  
  1755. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  1756. ---
  1757. daemon/acl.c     | 2 +-
  1758.  daemon/ea.c      | 4 ++--
  1759.  daemon/lock.c    | 4 ++--
  1760.  daemon/open.c    | 2 +-
  1761.  daemon/setattr.c | 2 +-
  1762.  5 files changed, 7 insertions(+), 7 deletions(-)
  1763.  
  1764. diff --git a/daemon/acl.c b/daemon/acl.c
  1765. index a2f2749..d2baf96 100644
  1766. --- a/daemon/acl.c
  1767. +++ b/daemon/acl.c
  1768. @@ -527,7 +527,7 @@ static int parse_setacl(
  1769.  {
  1770.      int status;
  1771.      setacl_upcall_args *args = &upcall->args.setacl;
  1772. -    void *sec_desc_ptr;
  1773. +    const void *sec_desc_ptr;
  1774.      ULONG sec_desc_len;
  1775.  
  1776.      status = safe_read(&buffer, &length, &args->query, sizeof(args->query));
  1777. diff --git a/daemon/ea.c b/daemon/ea.c
  1778. index f33c757..5acf81b 100644
  1779. --- a/daemon/ea.c
  1780. +++ b/daemon/ea.c
  1781. @@ -202,7 +202,7 @@ static int parse_setexattr(
  1782.      status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
  1783.      if (status) goto out;
  1784.      status = get_safe_read_bufferpos(&buffer, &length,
  1785. -        args->buf_len, (void **)&args->buf);
  1786. +        args->buf_len, (const void **)&args->buf);
  1787.      if (status) goto out;
  1788.  
  1789.      EASSERT(length == 0);
  1790. @@ -288,7 +288,7 @@ static int parse_getexattr(
  1791.      status = safe_read(&buffer, &length, &args->ealist_len, sizeof(args->ealist_len));
  1792.      if (status) goto out;
  1793.      status = get_safe_read_bufferpos(&buffer, &length,
  1794. -        args->ealist_len, (void **)&args->ealist);
  1795. +        args->ealist_len, (const void **)&args->ealist);
  1796.      if (status) goto out;
  1797.  
  1798.      EASSERT(length == 0);
  1799. diff --git a/daemon/lock.c b/daemon/lock.c
  1800. index 03958b5..54e05b4 100644
  1801. --- a/daemon/lock.c
  1802. +++ b/daemon/lock.c
  1803. @@ -366,7 +366,7 @@ static int parse_unlock(
  1804.      if (status) goto out;
  1805.      args->buf_len = args->count*2L*sizeof(LONGLONG);
  1806.      status = get_safe_read_bufferpos(&buffer, &length,
  1807. -        args->buf_len, (void **)&args->buf);
  1808. +        args->buf_len, (const void **)&args->buf);
  1809.      if (status) goto out;
  1810.  
  1811.      EASSERT(length == 0);
  1812. @@ -382,7 +382,7 @@ static int handle_unlock(void *daemon_context, nfs41_upcall *upcall)
  1813.      stateid_arg stateid;
  1814.      unlock_upcall_args *args = &upcall->args.unlock;
  1815.      nfs41_open_state *state = upcall->state_ref;
  1816. -    unsigned char *buf = args->buf;
  1817. +    const unsigned char *buf = args->buf;
  1818.      uint32_t buf_len = args->buf_len;
  1819.      uint32_t i;
  1820.      int status = NO_ERROR;
  1821. diff --git a/daemon/open.c b/daemon/open.c
  1822. index bad410b..1d5f30d 100644
  1823. --- a/daemon/open.c
  1824. +++ b/daemon/open.c
  1825. @@ -300,7 +300,7 @@ static int open_or_delegate(
  1826.  
  1827.  
  1828.  static int parse_abs_path(
  1829. -    const unsigned char **restrict buffer,
  1830. +    const unsigned char *restrict *restrict buffer,
  1831.      uint32_t *restrict length,
  1832.      nfs41_abs_path *restrict path)
  1833.  {
  1834. diff --git a/daemon/setattr.c b/daemon/setattr.c
  1835. index aba6aee..8705161 100644
  1836. --- a/daemon/setattr.c
  1837. +++ b/daemon/setattr.c
  1838. @@ -57,7 +57,7 @@ static int parse_setattr(
  1839.      status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
  1840.      if (status) goto out;
  1841.      status = get_safe_read_bufferpos(&buffer, &length,
  1842. -        args->buf_len, (void **)&args->buf);
  1843. +        args->buf_len, (const void **)&args->buf);
  1844.      if (status) goto out;
  1845.  
  1846.      args->root = upcall->root_ref;
  1847. --
  1848. 2.51.0

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