- From 10d6ab01b7a430e850d8ee2598a0c89951475847 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 21 Oct 2025 21:27:53 +0200
- Subject: [PATCH 1/9] sys: |nfs41_downcall()| should unlock kernel pages if an
- updowncall entry gets orphaned
- |nfs41_downcall()| should unlock kernel pages if an updowncall entry gets
- orphaned.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_dir.c | 10 ++++++----
- sys/nfs41sys_openclose.c | 16 ++++++++++------
- sys/nfs41sys_updowncall.c | 4 ++++
- 3 files changed, 20 insertions(+), 10 deletions(-)
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 6cdcbfc..3dd40a8 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -286,8 +286,6 @@ NTSTATUS nfs41_QueryDirectory(
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- - (void)nfs41_UnlockKernelPages(entry->u.QueryFile.mdl);
- -
- if (status) {
- /* Timeout - |nfs41_downcall()| will free |entry|+contents */
- entry = NULL;
- @@ -315,10 +313,14 @@ NTSTATUS nfs41_QueryDirectory(
- /* map windows ERRORs to NTSTATUS */
- status = map_querydir_errors(entry->status);
- }
- - IoFreeMdl(entry->u.QueryFile.mdl);
- - entry->u.QueryFile.mdl = NULL;
- +
- out:
- if (entry) {
- + if (entry->u.QueryFile.mdl) {
- + (void)nfs41_UnlockKernelPages(entry->u.QueryFile.mdl);
- + IoFreeMdl(entry->u.QueryFile.mdl);
- + entry->u.QueryFile.mdl = NULL;
- + }
- nfs41_UpcallDestroy(entry);
- }
- #ifdef ENABLE_TIMINGS
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index 4f71146..16090a2 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -746,18 +746,22 @@ retry_on_link:
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- - if (entry->u.Open.EaMdl) {
- - (void)nfs41_UnlockKernelPages(entry->u.Open.EaMdl);
- - IoFreeMdl(entry->u.Open.EaMdl);
- - entry->u.Open.EaMdl = NULL;
- - }
- -
- if (status) {
- /* Timeout - |nfs41_downcall()| will free |entry|+contents */
- entry = NULL;
- goto out;
- }
- + /*
- + * Unlock |entry->u.Open.EaMdl| here because symlink reparse can cause
- + * more upcalls (which need |u.Open.EaMdl|)
- + */
- + if (entry->u.Open.EaMdl) {
- + (void)nfs41_UnlockKernelPages(entry->u.Open.EaMdl);
- + IoFreeMdl(entry->u.Open.EaMdl);
- + entry->u.Open.EaMdl = NULL;
- + }
- +
- if (entry->status == NO_ERROR && entry->errno == ERROR_REPARSE) {
- /* symbolic link handling. when attempting to open a symlink when the
- * FILE_OPEN_REPARSE_POINT flag is not set, replace the filename with
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index aba635b..5315ba4 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -692,6 +692,7 @@ NTSTATUS nfs41_downcall(
- (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- cur->u.QueryFile.mdl_buf,
- cur->u.QueryFile.mdl);
- + (void)nfs41_UnlockKernelPages(cur->u.QueryFile.mdl);
- IoFreeMdl(cur->u.QueryFile.mdl);
- cur->u.QueryFile.mdl_buf = NULL;
- cur->u.QueryFile.mdl = NULL;
- @@ -702,6 +703,7 @@ NTSTATUS nfs41_downcall(
- (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- cur->u.Open.EaBuffer,
- cur->u.Open.EaMdl);
- + (void)nfs41_UnlockKernelPages(cur->u.Open.EaMdl);
- IoFreeMdl(cur->u.Open.EaMdl);
- cur->u.Open.EaBuffer = NULL;
- cur->u.Open.EaMdl = NULL;
- @@ -712,6 +714,8 @@ NTSTATUS nfs41_downcall(
- (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- cur->u.QueryAllocatedRanges.Buffer,
- cur->u.QueryAllocatedRanges.BufferMdl);
- + (void)nfs41_UnlockKernelPages(
- + cur->u.QueryAllocatedRanges.BufferMdl);
- IoFreeMdl(cur->u.QueryAllocatedRanges.BufferMdl);
- cur->u.QueryAllocatedRanges.Buffer = NULL;
- cur->u.QueryAllocatedRanges.BufferMdl = NULL;
- --
- 2.51.0
- From 084fe69b816c259032e99f711e9f73b9c546da28 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 21 Oct 2025 21:40:12 +0200
- Subject: [PATCH 2/9] build.vc19: Fix XML layout for <SignFile> to match Visual
- Studio 2019 default
- Fix XML layout for <SignFile> to match Visual Studio 2019 default.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/nfs_install/nfs_install.vcxproj | 5 +----
- build.vc19/nfs_mount/nfs_mount.vcxproj | 5 +----
- build.vc19/nfsd/nfsd.vcxproj | 5 +----
- 3 files changed, 3 insertions(+), 12 deletions(-)
- diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
- index 7e313e7..9335136 100644
- --- a/build.vc19/nfs_install/nfs_install.vcxproj
- +++ b/build.vc19/nfs_install/nfs_install.vcxproj
- @@ -1,10 +1,7 @@
- <?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Target Name="Sign" AfterTargets="Build">
- - <SignFile
- - CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
- - SigningTarget="$(OutputPath)\nfs_install.exe"
- - TargetFrameworkVersion="v4.5" />
- + <SignFile CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)" SigningTarget="$(OutputPath)\nfs_install.exe" TargetFrameworkVersion="v4.5" />
- </Target>
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
- index 2b25d55..fc906db 100644
- --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
- +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
- @@ -1,10 +1,7 @@
- <?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Target Name="Sign" AfterTargets="Build">
- - <SignFile
- - CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
- - SigningTarget="$(OutputPath)\nfs_mount.exe"
- - TargetFrameworkVersion="v4.5" />
- + <SignFile CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)" SigningTarget="$(OutputPath)\nfs_mount.exe" TargetFrameworkVersion="v4.5" />
- </Target>
- <Target Name="generate_git_version_header" BeforeTargets="ClCompile">
- <Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index fc5f5d4..97c2c2f 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -1,10 +1,7 @@
- <?xml version="1.0" encoding="utf-8"?>
- <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Target Name="Sign" AfterTargets="Build">
- - <SignFile
- - CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)"
- - SigningTarget="$(OutputPath)\nfsd.exe"
- - TargetFrameworkVersion="v4.5" />
- + <SignFile CertificateThumbprint="$(CERTIFICATE_THUMBPRINT)" SigningTarget="$(OutputPath)\nfsd.exe" TargetFrameworkVersion="v4.5" />
- </Target>
- <Target Name="generate_git_version_header" BeforeTargets="ClCompile">
- <Exec Command="git describe --long --always --dirty --exclude=* --abbrev=8" ConsoleToMSBuild="True" IgnoreExitCode="False">
- --
- 2.51.0
- From a71c239392e5d3f33589191675233796505b2e2a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 21 Oct 2025 22:32:46 +0200
- Subject: [PATCH 3/9] build.vc19: Build VS 32bit binaries with
- /LARGEADDRESSAWARE
- Build 32bit binaries build with Visual Studio with /LARGEADDRESSAWARE
- linker option.
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/nfs_install/nfs_install.vcxproj | 2 ++
- build.vc19/nfs_mount/nfs_mount.vcxproj | 2 ++
- build.vc19/nfsclientdctl/nfsclientdctl.vcxproj | 2 ++
- build.vc19/nfsd/nfsd.vcxproj | 2 ++
- 4 files changed, 8 insertions(+)
- diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
- index 9335136..d15ebb2 100644
- --- a/build.vc19/nfs_install/nfs_install.vcxproj
- +++ b/build.vc19/nfs_install/nfs_install.vcxproj
- @@ -133,6 +133,7 @@
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- @@ -190,6 +191,7 @@
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
- index fc906db..3b4bab2 100644
- --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
- +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
- @@ -140,6 +140,7 @@
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- @@ -200,6 +201,7 @@
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- diff --git a/build.vc19/nfsclientdctl/nfsclientdctl.vcxproj b/build.vc19/nfsclientdctl/nfsclientdctl.vcxproj
- index afe031e..1656b9c 100755
- --- a/build.vc19/nfsclientdctl/nfsclientdctl.vcxproj
- +++ b/build.vc19/nfsclientdctl/nfsclientdctl.vcxproj
- @@ -133,6 +133,7 @@
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- @@ -190,6 +191,7 @@
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index 97c2c2f..dfff050 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -146,6 +146,7 @@
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;icu.lib;ntdll.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- @@ -225,6 +226,7 @@
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;icu.lib;ntdll.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- + <LargeAddressAware>true</LargeAddressAware>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- --
- 2.51.0
- From 82be91b0b1354f76127bbded95bca2ff0876e6a2 Mon Sep 17 00:00:00 2001
- From: Lionel Cons <lionelcons1972@gmail.com>
- Date: Wed, 22 Oct 2025 13:35:03 +0200
- Subject: [PATCH 4/9] tests: nfs_ea.exe should be able to handle EAs with
- values up to 8kb
- nfs_ea.exe should be able to handle EAs with values up to 8kb.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/ea/main.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/tests/ea/main.c b/tests/ea/main.c
- index d8fa00b..e05cc13 100644
- --- a/tests/ea/main.c
- +++ b/tests/ea/main.c
- @@ -39,8 +39,8 @@ typedef unsigned long DWORD, *PDWORD, *LPDWORD;
- #include "nfs_ea.h"
- -#define MAX_LIST_LEN 4096
- -#define MAX_EA_VALUE 256
- +#define MAX_LIST_LEN 16384
- +#define MAX_EA_VALUE 8192
- #define MAX_GETEA (sizeof(FILE_GET_EA_INFORMATION) + MAX_EA_VALUE)
- #define MAX_FULLEA (sizeof(FILE_FULL_EA_INFORMATION) + 2 * MAX_EA_VALUE)
- --
- 2.51.0
- From 73c8f8d8f45090f48b4dc06430d8ce4bf4e97217 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 22 Oct 2025 13:41:12 +0200
- Subject: [PATCH 5/9] sys: Move |nfs41_updowncall_entry.buf| into per op union
- structs
- Move |nfs41_updowncall_entry.buf| into per op union structs.
- That avoids usage of |buf|/|buf_len| which are unused for that
- specific op.
- Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_acl.c | 46 +++++++++++++++++++--------------------
- sys/nfs41sys_dir.c | 17 +++++++--------
- sys/nfs41sys_driver.c | 4 ++--
- sys/nfs41sys_driver.h | 16 ++++++++++++--
- sys/nfs41sys_ea.c | 26 +++++++++++-----------
- sys/nfs41sys_fileinfo.c | 27 ++++++++++++-----------
- sys/nfs41sys_readwrite.c | 39 ++++++++++++++++++---------------
- sys/nfs41sys_updowncall.c | 10 ++++-----
- sys/nfs41sys_volinfo.c | 9 ++++----
- 9 files changed, 105 insertions(+), 89 deletions(-)
- diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
- index e077b26..1846260 100644
- --- a/sys/nfs41sys_acl.c
- +++ b/sys/nfs41sys_acl.c
- @@ -114,7 +114,7 @@ NTSTATUS marshal_nfs41_setacl(
- else tmp += *len;
- header_len = *len + sizeof(SECURITY_INFORMATION) +
- - sizeof(ULONG) + entry->buf_len;
- + sizeof(ULONG) + entry->u.Acl.buf_len;
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -122,14 +122,14 @@ NTSTATUS marshal_nfs41_setacl(
- RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
- tmp += sizeof(SECURITY_INFORMATION);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.Acl.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, entry->buf, entry->buf_len);
- + RtlCopyMemory(tmp, entry->u.Acl.buf, entry->u.Acl.buf_len);
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_setacl: class=0x%x sec_desc_len=%lu\n",
- - (int)entry->u.Acl.query, (long)entry->buf_len);
- + (int)entry->u.Acl.query, (long)entry->u.Acl.buf_len);
- #endif
- out:
- return status;
- @@ -144,17 +144,17 @@ NTSTATUS unmarshal_nfs41_getacl(
- RtlCopyMemory(&buf_len, *buf, sizeof(DWORD));
- *buf += sizeof(DWORD);
- - cur->buf = RxAllocatePoolWithTag(NonPagedPoolNx,
- + cur->u.Acl.buf = RxAllocatePoolWithTag(NonPagedPoolNx,
- buf_len, NFS41_MM_POOLTAG_ACL);
- - if (cur->buf == NULL) {
- + if (cur->u.Acl.buf == NULL) {
- cur->status = status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- }
- - RtlCopyMemory(cur->buf, *buf, buf_len);
- + RtlCopyMemory(cur->u.Acl.buf, *buf, buf_len);
- *buf += buf_len;
- - if (buf_len > cur->buf_len)
- + if (buf_len > cur->u.Acl.buf_len)
- cur->status = STATUS_BUFFER_TOO_SMALL;
- - cur->buf_len = buf_len;
- + cur->u.Acl.buf_len = buf_len;
- out:
- return status;
- @@ -284,7 +284,7 @@ NTSTATUS nfs41_QuerySecurityInformation(
- /* we can't provide RxContext->CurrentIrp->UserBuffer to the upcall thread
- * because it becomes an invalid pointer with that execution context
- */
- - entry->buf_len = querysecuritylength;
- + entry->u.Acl.buf_len = querysecuritylength;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- if (status) {
- @@ -298,13 +298,13 @@ NTSTATUS nfs41_QuerySecurityInformation(
- "STATUS_BUFFER_OVERFLOW for entry, "
- "got %lu, need %lu\n",
- (unsigned long)querysecuritylength,
- - (unsigned long)entry->buf_len);
- + (unsigned long)entry->u.Acl.buf_len);
- status = STATUS_BUFFER_OVERFLOW;
- - RxContext->InformationToReturn = entry->buf_len;
- + RxContext->InformationToReturn = entry->u.Acl.buf_len;
- - if (entry->buf) {
- - RxFreePool(entry->buf);
- - entry->buf = NULL;
- + if (entry->u.Acl.buf) {
- + RxFreePool(entry->u.Acl.buf);
- + entry->u.Acl.buf = NULL;
- }
- } else if (entry->status == STATUS_SUCCESS) {
- /*
- @@ -317,9 +317,9 @@ NTSTATUS nfs41_QuerySecurityInformation(
- nfs41_fobx->acl_len = 0;
- }
- - nfs41_fobx->acl = entry->buf;
- - nfs41_fobx->acl_len = entry->buf_len;
- - entry->buf = NULL;
- + nfs41_fobx->acl = entry->u.Acl.buf;
- + nfs41_fobx->acl_len = entry->u.Acl.buf_len;
- + entry->u.Acl.buf = NULL;
- KeQuerySystemTime(&nfs41_fobx->time);
- PSECURITY_DESCRIPTOR sec_desc = (PSECURITY_DESCRIPTOR)
- @@ -336,9 +336,9 @@ NTSTATUS nfs41_QuerySecurityInformation(
- } else {
- status = map_query_acl_error(entry->status);
- - if (entry->buf) {
- - RxFreePool(entry->buf);
- - entry->buf = NULL;
- + if (entry->u.Acl.buf) {
- + RxFreePool(entry->u.Acl.buf);
- + entry->u.Acl.buf = NULL;
- }
- }
- out:
- @@ -443,8 +443,8 @@ NTSTATUS nfs41_SetSecurityInformation(
- if (status) goto out;
- entry->u.Acl.query = info_class;
- - entry->buf = sec_desc;
- - entry->buf_len = RtlLengthSecurityDescriptor(sec_desc);
- + entry->u.Acl.buf = sec_desc;
- + entry->u.Acl.buf_len = RtlLengthSecurityDescriptor(sec_desc);
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&setacl.sops);
- InterlockedAdd64(&setacl.size, entry->u.Acl.buf_len);
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 3dd40a8..64f16c5 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -91,7 +91,7 @@ NTSTATUS marshal_nfs41_dirquery(
- RtlCopyMemory(tmp, &entry->u.QueryFile.InfoClass, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.QueryFile.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- status = marshall_unicode_as_utf8(&tmp, entry->u.QueryFile.filter);
- if (status) goto out;
- @@ -121,7 +121,7 @@ NTSTATUS marshal_nfs41_dirquery(
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_dirquery: filter='%wZ' class=%d len=%d "
- "1st\\restart\\single=%d\\%d\\%d\n", entry->u.QueryFile.filter,
- - entry->u.QueryFile.InfoClass, entry->buf_len,
- + entry->u.QueryFile.InfoClass, entry->u.QueryFile.buf_len,
- entry->u.QueryFile.initial_query, entry->u.QueryFile.restart_scan,
- entry->u.QueryFile.return_single);
- #endif
- @@ -144,9 +144,9 @@ NTSTATUS unmarshal_nfs41_dirquery(
- (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- cur->u.QueryFile.mdl_buf,
- cur->u.QueryFile.mdl);
- - if (buf_len > cur->buf_len)
- + if (buf_len > cur->u.QueryFile.buf_len)
- cur->status = STATUS_BUFFER_TOO_SMALL;
- - cur->buf_len = buf_len;
- + cur->u.QueryFile.buf_len = buf_len;
- return status;
- }
- @@ -253,8 +253,7 @@ NTSTATUS nfs41_QueryDirectory(
- if (status) goto out;
- entry->u.QueryFile.InfoClass = InfoClass;
- - entry->buf_len = RxContext->Info.LengthRemaining;
- - entry->buf = RxContext->Info.Buffer;
- + entry->u.QueryFile.buf_len = RxContext->Info.LengthRemaining;
- entry->u.QueryFile.mdl = IoAllocateMdl(RxContext->Info.Buffer,
- RxContext->Info.LengthRemaining, FALSE, FALSE, NULL);
- if (entry->u.QueryFile.mdl == NULL) {
- @@ -294,15 +293,15 @@ NTSTATUS nfs41_QueryDirectory(
- if (entry->status == STATUS_BUFFER_TOO_SMALL) {
- DbgP("nfs41_QueryDirectory: buffer too small provided %d need %lu\n",
- - RxContext->Info.LengthRemaining, entry->buf_len);
- - RxContext->InformationToReturn = entry->buf_len;
- + RxContext->Info.LengthRemaining, entry->u.QueryFile.buf_len);
- + RxContext->InformationToReturn = entry->u.QueryFile.buf_len;
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&readdir.sops);
- InterlockedAdd64(&readdir.size, entry->u.QueryFile.buf_len);
- #endif
- - RxContext->Info.LengthRemaining -= entry->buf_len;
- + RxContext->Info.LengthRemaining -= entry->u.QueryFile.buf_len;
- status = STATUS_SUCCESS;
- } else if ((entry->status == STATUS_ACCESS_VIOLATION) ||
- (entry->status == STATUS_INSUFFICIENT_RESOURCES)) {
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index c5c2a99..0cff2bd 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -1358,8 +1358,8 @@ VOID fcbopen_main(PVOID ctx)
- if (status) goto out;
- entry->u.QueryFile.InfoClass = FileBasicInformation;
- - entry->buf = &binfo;
- - entry->buf_len = sizeof(binfo);
- + entry->u.QueryFile.buf = &binfo;
- + entry->u.QueryFile.buf_len = sizeof(binfo);
- status = nfs41_UpcallWaitForReply(entry, UPCALL_TIMEOUT_DEFAULT);
- if (status) goto out;
- diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
- index 3f50257..ff9b82e 100644
- --- a/sys/nfs41sys_driver.h
- +++ b/sys/nfs41sys_driver.h
- @@ -186,8 +186,6 @@ typedef struct _updowncall_entry {
- HANDLE open_state;
- HANDLE session;
- PUNICODE_STRING filename;
- - PVOID buf;
- - ULONG buf_len;
- ULONGLONG ChangeTime;
- union {
- struct {
- @@ -211,6 +209,8 @@ typedef struct _updowncall_entry {
- struct {
- PMDL MdlAddress;
- ULONGLONG offset;
- + PVOID buf;
- + ULONG buf_len;
- PRX_CONTEXT rxcontext;
- } ReadWrite;
- struct {
- @@ -263,12 +263,18 @@ typedef struct _updowncall_entry {
- BOOLEAN initial_query;
- PMDL mdl;
- PVOID mdl_buf;
- + PVOID buf;
- + ULONG buf_len;
- } QueryFile;
- struct {
- FILE_INFORMATION_CLASS InfoClass;
- + PVOID buf;
- + ULONG buf_len;
- } SetFile;
- struct {
- DWORD mode;
- + PVOID buf;
- + ULONG buf_len;
- } SetEa;
- struct {
- PVOID EaList;
- @@ -277,15 +283,21 @@ typedef struct _updowncall_entry {
- ULONG EaIndex;
- BOOLEAN ReturnSingleEntry;
- BOOLEAN RestartScan;
- + PVOID buf;
- + ULONG buf_len;
- } QueryEa;
- struct {
- PUNICODE_STRING target;
- } Symlink;
- struct {
- FS_INFORMATION_CLASS query;
- + PVOID buf;
- + ULONG buf_len;
- } Volume;
- struct {
- SECURITY_INFORMATION query;
- + PVOID buf;
- + ULONG buf_len;
- } Acl;
- struct {
- FILE_ALLOCATED_RANGE_BUFFER inrange;
- diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
- index 53b0790..c479555 100644
- --- a/sys/nfs41sys_ea.c
- +++ b/sys/nfs41sys_ea.c
- @@ -83,7 +83,7 @@ NTSTATUS marshal_nfs41_easet(
- else tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- - sizeof(ULONG) + entry->buf_len + sizeof(DWORD);
- + sizeof(ULONG) + entry->u.SetEa.buf_len + sizeof(DWORD);
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -93,15 +93,15 @@ NTSTATUS marshal_nfs41_easet(
- if (status) goto out;
- RtlCopyMemory(tmp, &entry->u.SetEa.mode, sizeof(DWORD));
- tmp += sizeof(DWORD);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.SetEa.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, entry->buf, entry->buf_len);
- + RtlCopyMemory(tmp, entry->u.SetEa.buf, entry->u.SetEa.buf_len);
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_easet: filename='%wZ', buflen=%d mode=0x%x\n",
- entry->filename,
- - (int)entry->buf_len,
- + (int)entry->u.SetEa.buf_len,
- (int)entry->u.SetEa.mode);
- #endif
- out:
- @@ -138,7 +138,7 @@ NTSTATUS marshal_nfs41_eaget(
- tmp += sizeof(BOOLEAN);
- RtlCopyMemory(tmp, &entry->u.QueryEa.ReturnSingleEntry, sizeof(BOOLEAN));
- tmp += sizeof(BOOLEAN);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.QueryEa.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, &entry->u.QueryEa.EaListLength, sizeof(ULONG));
- tmp += sizeof(ULONG);
- @@ -163,11 +163,11 @@ void unmarshal_nfs41_eaget(
- {
- RtlCopyMemory(&cur->u.QueryEa.Overflow, *buf, sizeof(ULONG));
- *buf += sizeof(ULONG);
- - RtlCopyMemory(&cur->buf_len, *buf, sizeof(ULONG));
- + RtlCopyMemory(&cur->u.QueryEa.buf_len, *buf, sizeof(ULONG));
- *buf += sizeof(ULONG);
- if (cur->u.QueryEa.Overflow != ERROR_INSUFFICIENT_BUFFER) {
- - RtlCopyMemory(cur->buf, *buf, cur->buf_len);
- - *buf += cur->buf_len;
- + RtlCopyMemory(cur->u.QueryEa.buf, *buf, cur->u.QueryEa.buf_len);
- + *buf += cur->u.QueryEa.buf_len;
- }
- }
- @@ -375,8 +375,8 @@ NTSTATUS nfs41_SetEaInformation(
- goto out;
- }
- }
- - entry->buf = eainfo;
- - entry->buf_len = buflen;
- + entry->u.SetEa.buf = eainfo;
- + entry->u.SetEa.buf_len = buflen;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- if (status) {
- @@ -642,8 +642,8 @@ NTSTATUS nfs41_QueryEaInformation(
- pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry);
- if (status) goto out;
- - entry->buf_len = buflen;
- - entry->buf = RxContext->Info.Buffer;
- + entry->u.QueryEa.buf_len = buflen;
- + entry->u.QueryEa.buf = RxContext->Info.Buffer;
- entry->u.QueryEa.EaList = query;
- entry->u.QueryEa.EaListLength = query == NULL ? 0 :
- RxContext->QueryEa.UserEaListLength;
- @@ -671,7 +671,7 @@ NTSTATUS nfs41_QueryEaInformation(
- RxContext->IoStatusBlock.Status = STATUS_SUCCESS;
- break;
- }
- - RxContext->InformationToReturn = entry->buf_len;
- + RxContext->InformationToReturn = entry->u.QueryEa.buf_len;
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&getexattr.sops);
- InterlockedAdd64(&getexattr.size, entry->u.QueryEa.buf_len);
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index a2cc9c1..651405a 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -90,7 +90,7 @@ NTSTATUS marshal_nfs41_filequery(
- }
- RtlCopyMemory(tmp, &entry->u.QueryFile.InfoClass, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.QueryFile.buf_len, sizeof(ULONG));
- /* tmp += sizeof(ULONG); */
- *len = header_len;
- @@ -116,7 +116,7 @@ NTSTATUS marshal_nfs41_fileset(
- else tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- - 2 * sizeof(ULONG) + entry->buf_len;
- + 2 * sizeof(ULONG) + entry->u.SetFile.buf_len;
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -125,9 +125,9 @@ NTSTATUS marshal_nfs41_fileset(
- if (status) goto out;
- RtlCopyMemory(tmp, &entry->u.SetFile.InfoClass, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
- + RtlCopyMemory(tmp, &entry->u.SetFile.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - RtlCopyMemory(tmp, entry->buf, entry->buf_len);
- + RtlCopyMemory(tmp, entry->u.SetFile.buf, entry->u.SetFile.buf_len);
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- @@ -154,7 +154,8 @@ void unmarshal_nfs41_getattr(
- nfs41_updowncall_entry *cur,
- const unsigned char *restrict *restrict buf)
- {
- - unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, FALSE);
- + unmarshal_nfs41_attrget(cur,
- + cur->u.QueryFile.buf, &cur->u.QueryFile.buf_len, buf, FALSE);
- RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
- *buf += sizeof(cur->ChangeTime);
- #ifdef DEBUG_MARSHAL_DETAIL
- @@ -396,8 +397,8 @@ NTSTATUS nfs41_QueryFileInformation(
- }
- entry->u.QueryFile.InfoClass = InfoClass;
- - entry->buf = RxContext->Info.Buffer;
- - entry->buf_len = RxContext->Info.LengthRemaining;
- + entry->u.QueryFile.buf = RxContext->Info.Buffer;
- + entry->u.QueryFile.buf_len = RxContext->Info.LengthRemaining;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- if (status) {
- @@ -407,7 +408,7 @@ NTSTATUS nfs41_QueryFileInformation(
- }
- if (entry->status == STATUS_BUFFER_TOO_SMALL) {
- - RxContext->InformationToReturn = entry->buf_len;
- + RxContext->InformationToReturn = entry->u.QueryFile.buf_len;
- print_error("entry->status == STATUS_BUFFER_TOO_SMALL\n");
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- @@ -419,7 +420,7 @@ NTSTATUS nfs41_QueryFileInformation(
- InterlockedIncrement(&getattr.sops);
- InterlockedAdd64(&getattr.size, entry->u.QueryFile.buf_len);
- #endif
- - RxContext->Info.LengthRemaining -= entry->buf_len;
- + RxContext->Info.LengthRemaining -= entry->u.QueryFile.buf_len;
- status = STATUS_SUCCESS;
- switch (InfoClass) {
- @@ -768,14 +769,14 @@ NTSTATUS nfs41_SetFileInformation(
- * thus we changed the local variable infoclass */
- if (RxContext->Info.FileInformationClass == FileDispositionInformation &&
- InfoClass == FileRenameInformation) {
- - entry->buf = &rinfo;
- - entry->buf_len = sizeof(rinfo);
- + entry->u.SetFile.buf = &rinfo;
- + entry->u.SetFile.buf_len = sizeof(rinfo);
- }
- else
- #endif /* FORCE_POSIX_SEMANTICS_DELETE */
- {
- - entry->buf = RxContext->Info.Buffer;
- - entry->buf_len = RxContext->Info.Length;
- + entry->u.SetFile.buf = RxContext->Info.Buffer;
- + entry->u.SetFile.buf_len = RxContext->Info.Length;
- }
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&setattr.sops);
- diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
- index f0c8beb..35aeaf4 100644
- --- a/sys/nfs41sys_readwrite.c
- +++ b/sys/nfs41sys_readwrite.c
- @@ -97,15 +97,16 @@ NTSTATUS marshal_nfs41_rw(
- if (status) goto out;
- else tmp += *len;
- - header_len = *len + sizeof(entry->buf_len) +
- + header_len = *len + sizeof(entry->u.ReadWrite.buf_len) +
- sizeof(entry->u.ReadWrite.offset) + sizeof(HANDLE);
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- }
- - RtlCopyMemory(tmp, &entry->buf_len, sizeof(entry->buf_len));
- - tmp += sizeof(entry->buf_len);
- + RtlCopyMemory(tmp, &entry->u.ReadWrite.buf_len,
- + sizeof(entry->u.ReadWrite.buf_len));
- + tmp += sizeof(entry->u.ReadWrite.buf_len);
- RtlCopyMemory(tmp, &entry->u.ReadWrite.offset,
- sizeof(entry->u.ReadWrite.offset));
- tmp += sizeof(entry->u.ReadWrite.offset);
- @@ -128,7 +129,7 @@ NTSTATUS marshal_nfs41_rw(
- prio_writeflags |= MdlMappingNoWrite;
- status = nfs41_MapLockedPagesInNfsDaemonAddressSpace(
- - &entry->buf,
- + &entry->u.ReadWrite.buf,
- entry->u.ReadWrite.MdlAddress,
- MmCached,
- (NormalPagePriority|prio_writeflags));
- @@ -140,14 +141,14 @@ NTSTATUS marshal_nfs41_rw(
- goto out;
- }
- - RtlCopyMemory(tmp, &entry->buf, sizeof(HANDLE));
- + RtlCopyMemory(tmp, &entry->u.ReadWrite.buf, sizeof(HANDLE));
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL_RW
- DbgP("marshal_nfs41_rw: len=%lu offset=%llu "
- "MdlAddress=0x%p Userspace=0x%p\n",
- - entry->buf_len, entry->u.ReadWrite.offset,
- - entry->u.ReadWrite.MdlAddress, entry->buf);
- + entry->u.ReadWrite.buf_len, entry->u.ReadWrite.offset,
- + entry->u.ReadWrite.MdlAddress, entry->u.ReadWrite.buf);
- #endif
- out:
- return status;
- @@ -159,13 +160,14 @@ NTSTATUS unmarshal_nfs41_rw(
- {
- NTSTATUS status = STATUS_SUCCESS;
- - RtlCopyMemory(&cur->buf_len, *buf, sizeof(cur->buf_len));
- - *buf += sizeof(cur->buf_len);
- + RtlCopyMemory(&cur->u.ReadWrite.buf_len, *buf,
- + sizeof(cur->u.ReadWrite.buf_len));
- + *buf += sizeof(cur->u.ReadWrite.buf_len);
- RtlCopyMemory(&cur->ChangeTime, *buf, sizeof(cur->ChangeTime));
- *buf += sizeof(cur->ChangeTime);
- #ifdef DEBUG_MARSHAL_DETAIL_RW
- DbgP("unmarshal_nfs41_rw: returned len %lu ChangeTime %llu\n",
- - cur->buf_len, cur->ChangeTime);
- + cur->u.ReadWrite.buf_len, cur->ChangeTime);
- #endif
- #if 1
- /*
- @@ -174,9 +176,10 @@ NTSTATUS unmarshal_nfs41_rw(
- * MmMapLockedPagesSpecifyCache() as the MDL passed to us
- * is already locked.
- */
- - (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(cur->buf,
- + (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- + cur->u.ReadWrite.buf,
- cur->u.ReadWrite.MdlAddress);
- - cur->buf = NULL;
- + cur->u.ReadWrite.buf = NULL;
- #endif
- return status;
- }
- @@ -248,7 +251,7 @@ NTSTATUS nfs41_Read(
- if (status) goto out;
- entry->u.ReadWrite.MdlAddress = LowIoContext->ParamsFor.ReadWrite.Buffer;
- - entry->buf_len = LowIoContext->ParamsFor.ReadWrite.ByteCount;
- + entry->u.ReadWrite.buf_len = LowIoContext->ParamsFor.ReadWrite.ByteCount;
- entry->u.ReadWrite.offset = LowIoContext->ParamsFor.ReadWrite.ByteOffset;
- if (FlagOn(RxContext->CurrentIrpSp->FileObject->Flags,
- FO_SYNCHRONOUS_IO) == FALSE) {
- @@ -258,7 +261,7 @@ NTSTATUS nfs41_Read(
- /* Add extra timeout depending on buffer size */
- io_delay = pVNetRootContext->timeout +
- - EXTRA_TIMEOUT_PER_BYTE(entry->buf_len);
- + EXTRA_TIMEOUT_PER_BYTE(entry->u.ReadWrite.buf_len);
- status = nfs41_UpcallWaitForReply(entry, io_delay);
- if (status) {
- /* Timeout - |nfs41_downcall()| will free |entry|+contents */
- @@ -281,7 +284,7 @@ NTSTATUS nfs41_Read(
- InterlockedAdd64(&read.size, entry->u.ReadWrite.len);
- #endif
- status = RxContext->CurrentIrp->IoStatus.Status = STATUS_SUCCESS;
- - RxContext->IoStatusBlock.Information = entry->buf_len;
- + RxContext->IoStatusBlock.Information = entry->u.ReadWrite.buf_len;
- if ((!BooleanFlagOn(LowIoContext->ParamsFor.ReadWrite.Flags,
- LOWIO_READWRITEFLAG_PAGING_IO) &&
- @@ -374,7 +377,7 @@ NTSTATUS nfs41_Write(
- if (status) goto out;
- entry->u.ReadWrite.MdlAddress = LowIoContext->ParamsFor.ReadWrite.Buffer;
- - entry->buf_len = LowIoContext->ParamsFor.ReadWrite.ByteCount;
- + entry->u.ReadWrite.buf_len = LowIoContext->ParamsFor.ReadWrite.ByteCount;
- entry->u.ReadWrite.offset = LowIoContext->ParamsFor.ReadWrite.ByteOffset;
- if (FlagOn(RxContext->CurrentIrpSp->FileObject->Flags,
- @@ -385,7 +388,7 @@ NTSTATUS nfs41_Write(
- /* Add extra timeout depending on buffer size */
- io_delay = pVNetRootContext->timeout +
- - EXTRA_TIMEOUT_PER_BYTE(entry->buf_len);
- + EXTRA_TIMEOUT_PER_BYTE(entry->u.ReadWrite.buf_len);
- status = nfs41_UpcallWaitForReply(entry, io_delay);
- if (status) {
- /* Timeout - |nfs41_downcall()| will free |entry|+contents */
- @@ -409,7 +412,7 @@ NTSTATUS nfs41_Write(
- InterlockedAdd64(&write.size, entry->u.ReadWrite.len);
- #endif
- status = RxContext->CurrentIrp->IoStatus.Status = STATUS_SUCCESS;
- - RxContext->IoStatusBlock.Information = entry->buf_len;
- + RxContext->IoStatusBlock.Information = entry->u.ReadWrite.buf_len;
- nfs41_fcb->changeattr = entry->ChangeTime;
- //re-enable write buffering
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index 5315ba4..64b0432 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -426,7 +426,7 @@ NTSTATUS nfs41_UpcallCreate(
- switch(entry->opcode) {
- case NFS41_SYSOP_WRITE:
- case NFS41_SYSOP_READ:
- - entry->buf = NULL;
- + entry->u.ReadWrite.buf = NULL;
- break;
- case NFS41_SYSOP_DIR_QUERY:
- entry->u.QueryFile.mdl_buf = NULL;
- @@ -680,11 +680,11 @@ NTSTATUS nfs41_downcall(
- switch(cur->opcode) {
- case NFS41_SYSOP_WRITE:
- case NFS41_SYSOP_READ:
- - if (cur->buf) {
- + if (cur->u.ReadWrite.buf) {
- (void)nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- - cur->buf,
- + cur->u.ReadWrite.buf,
- cur->u.ReadWrite.MdlAddress);
- - cur->buf = NULL;
- + cur->u.ReadWrite.buf = NULL;
- }
- break;
- case NFS41_SYSOP_DIR_QUERY:
- @@ -821,7 +821,7 @@ NTSTATUS nfs41_downcall(
- cur->u.ReadWrite.rxcontext->StoredStatus =
- STATUS_SUCCESS;
- cur->u.ReadWrite.rxcontext->InformationToReturn =
- - cur->buf_len;
- + cur->u.ReadWrite.buf_len;
- } else {
- cur->u.ReadWrite.rxcontext->StoredStatus =
- map_readwrite_errors(cur->status);
- diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
- index 2caad54..8250775 100644
- --- a/sys/nfs41sys_volinfo.c
- +++ b/sys/nfs41sys_volinfo.c
- @@ -103,7 +103,8 @@ void unmarshal_nfs41_volume(
- nfs41_updowncall_entry *cur,
- const unsigned char *restrict *restrict buf)
- {
- - unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, TRUE);
- + unmarshal_nfs41_attrget(cur,
- + cur->u.Volume.buf, &cur->u.Volume.buf_len, buf, TRUE);
- }
- static void print_queryvolume_args(
- @@ -201,8 +202,8 @@ NTSTATUS nfs41_QueryVolumeInformation(
- if (status) goto out;
- entry->u.Volume.query = InfoClass;
- - entry->buf = RxContext->Info.Buffer;
- - entry->buf_len = RxContext->Info.LengthRemaining;
- + entry->u.Volume.buf = RxContext->Info.Buffer;
- + entry->u.Volume.buf_len = RxContext->Info.LengthRemaining;
- status = nfs41_UpcallWaitForReply(entry, pVNetRootContext->timeout);
- if (status) {
- @@ -223,7 +224,7 @@ NTSTATUS nfs41_QueryVolumeInformation(
- InterlockedIncrement(&volume.sops);
- InterlockedAdd64(&volume.size, entry->u.Volume.buf_len);
- #endif
- - RxContext->Info.LengthRemaining -= entry->buf_len;
- + RxContext->Info.LengthRemaining -= entry->u.Volume.buf_len;
- status = STATUS_SUCCESS;
- } else {
- status = map_volume_errors(entry->status);
- --
- 2.51.0
- From 8615c8ea8631bfbcff1cc38ad8d9a2e01269aeec Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 22 Oct 2025 17:23:20 +0200
- Subject: [PATCH 6/9] sys: |marshal_nfs41_*()| functions should verify how many
- bytes they write into upcall buffer
- |marshal_nfs41_*()| functions should verify how many bytes they
- write into the upcall buffer.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_acl.c | 30 +++++++++++++++++++++------
- sys/nfs41sys_dir.c | 15 +++++++++++---
- sys/nfs41sys_driver.c | 28 ++++++++++++++++++++-----
- sys/nfs41sys_ea.c | 33 ++++++++++++++++++++++-------
- sys/nfs41sys_fileinfo.c | 31 ++++++++++++++++++++-------
- sys/nfs41sys_fsctl.c | 45 +++++++++++++++++++++++++++++++---------
- sys/nfs41sys_lock.c | 31 ++++++++++++++++++++-------
- sys/nfs41sys_mount.c | 17 ++++++++++-----
- sys/nfs41sys_openclose.c | 32 +++++++++++++++++++++-------
- sys/nfs41sys_readwrite.c | 15 +++++++++++---
- sys/nfs41sys_symlink.c | 14 ++++++++++---
- sys/nfs41sys_volinfo.c | 15 +++++++++++---
- 12 files changed, 240 insertions(+), 66 deletions(-)
- diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
- index 1846260..d9647b9 100644
- --- a/sys/nfs41sys_acl.c
- +++ b/sys/nfs41sys_acl.c
- @@ -80,8 +80,9 @@ NTSTATUS marshal_nfs41_getacl(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(SECURITY_INFORMATION);
- if (header_len > buf_len) {
- @@ -90,7 +91,15 @@ NTSTATUS marshal_nfs41_getacl(
- }
- RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
- - *len = header_len;
- + tmp += sizeof(SECURITY_INFORMATION);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_getacl: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_getacl: class=0x%x\n", (int)entry->u.Acl.query);
- @@ -110,8 +119,9 @@ NTSTATUS marshal_nfs41_setacl(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(SECURITY_INFORMATION) +
- sizeof(ULONG) + entry->u.Acl.buf_len;
- @@ -125,7 +135,15 @@ NTSTATUS marshal_nfs41_setacl(
- RtlCopyMemory(tmp, &entry->u.Acl.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, entry->u.Acl.buf, entry->u.Acl.buf_len);
- - *len = header_len;
- + tmp += entry->u.Acl.buf_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_setacl: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_setacl: class=0x%x sec_desc_len=%lu\n",
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 64f16c5..608f83a 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -79,8 +79,9 @@ NTSTATUS marshal_nfs41_dirquery(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + 2 * sizeof(ULONG) + sizeof(HANDLE) +
- length_as_utf8(entry->u.QueryFile.filter) + 3 * sizeof(BOOLEAN);
- @@ -116,7 +117,15 @@ NTSTATUS marshal_nfs41_dirquery(
- }
- RtlCopyMemory(tmp, &entry->u.QueryFile.mdl_buf, sizeof(HANDLE));
- - *len = header_len;
- + tmp += sizeof(HANDLE);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_dirquery: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_dirquery: filter='%wZ' class=%d len=%d "
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 0cff2bd..53ab74a 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -239,8 +239,9 @@ NTSTATUS marshal_nfs41_header(
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- }
- - else
- - *len = header_len;
- +
- + *len = header_len;
- +
- RtlCopyMemory(tmp, &entry->version, sizeof(entry->version));
- tmp += sizeof(entry->version);
- RtlCopyMemory(tmp, &entry->xid, sizeof(entry->xid));
- @@ -252,6 +253,14 @@ NTSTATUS marshal_nfs41_header(
- RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
- tmp += sizeof(HANDLE);
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_header: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- +
- #ifdef DEBUG_MARSHAL_HEADER
- DbgP("[upcall hdr] xid=%lld op='%s'%s filename='%wZ' vers=%d "
- "sess=0x%p open_state=0x%x\n",
- @@ -321,8 +330,9 @@ NTSTATUS marshal_nfs41_set_daemon_debuglevel(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(LONG);
- if (header_len > buf_len) {
- @@ -333,7 +343,15 @@ NTSTATUS marshal_nfs41_set_daemon_debuglevel(
- RtlCopyMemory(tmp, &entry->u.SetDaemonDebugLevel.debuglevel,
- sizeof(entry->u.SetDaemonDebugLevel.debuglevel));
- tmp += sizeof(entry->u.SetDaemonDebugLevel.debuglevel);
- - *len = header_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_set_daemon_debuglevel: "
- + "*len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- out:
- return status;
- diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
- index c479555..1d415da 100644
- --- a/sys/nfs41sys_ea.c
- +++ b/sys/nfs41sys_ea.c
- @@ -79,8 +79,9 @@ NTSTATUS marshal_nfs41_easet(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- sizeof(ULONG) + entry->u.SetEa.buf_len + sizeof(DWORD);
- @@ -96,7 +97,15 @@ NTSTATUS marshal_nfs41_easet(
- RtlCopyMemory(tmp, &entry->u.SetEa.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, entry->u.SetEa.buf, entry->u.SetEa.buf_len);
- - *len = header_len;
- + tmp += entry->u.SetEa.buf_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_easet: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_easet: filename='%wZ', buflen=%d mode=0x%x\n",
- @@ -119,8 +128,9 @@ NTSTATUS marshal_nfs41_eaget(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- 3 * sizeof(ULONG) + entry->u.QueryEa.EaListLength + 2 * sizeof(BOOLEAN);
- @@ -142,10 +152,19 @@ NTSTATUS marshal_nfs41_eaget(
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, &entry->u.QueryEa.EaListLength, sizeof(ULONG));
- tmp += sizeof(ULONG);
- - if (entry->u.QueryEa.EaList && entry->u.QueryEa.EaListLength)
- + if (entry->u.QueryEa.EaList && entry->u.QueryEa.EaListLength) {
- RtlCopyMemory(tmp, entry->u.QueryEa.EaList,
- entry->u.QueryEa.EaListLength);
- - *len = header_len;
- + tmp += entry->u.QueryEa.EaListLength;
- + }
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_eaget: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_eaget: filename='%wZ', index=%d list_len=%d "
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 651405a..8d26824 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -80,8 +80,9 @@ NTSTATUS marshal_nfs41_filequery(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + 2 * sizeof(ULONG);
- if (header_len > buf_len) {
- @@ -91,8 +92,15 @@ NTSTATUS marshal_nfs41_filequery(
- RtlCopyMemory(tmp, &entry->u.QueryFile.InfoClass, sizeof(ULONG));
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, &entry->u.QueryFile.buf_len, sizeof(ULONG));
- - /* tmp += sizeof(ULONG); */
- - *len = header_len;
- + tmp += sizeof(ULONG);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_filequery: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_filequery: class=%d\n", entry->u.QueryFile.InfoClass);
- @@ -112,8 +120,9 @@ NTSTATUS marshal_nfs41_fileset(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- 2 * sizeof(ULONG) + entry->u.SetFile.buf_len;
- @@ -128,7 +137,15 @@ NTSTATUS marshal_nfs41_fileset(
- RtlCopyMemory(tmp, &entry->u.SetFile.buf_len, sizeof(ULONG));
- tmp += sizeof(ULONG);
- RtlCopyMemory(tmp, entry->u.SetFile.buf, entry->u.SetFile.buf_len);
- - *len = header_len;
- + tmp += entry->u.SetFile.buf_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_fileset: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_fileset: filename='%wZ' class=%d\n",
- diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
- index de9eb2d..adc322e 100644
- --- a/sys/nfs41sys_fsctl.c
- +++ b/sys/nfs41sys_fsctl.c
- @@ -259,8 +259,9 @@ NTSTATUS marshal_nfs41_queryallocatedranges(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(FILE_ALLOCATED_RANGE_BUFFER) +
- sizeof(ULONG) +
- @@ -292,8 +293,17 @@ NTSTATUS marshal_nfs41_queryallocatedranges(
- }
- }
- RtlCopyMemory(tmp, &entry->u.QueryAllocatedRanges.Buffer,
- - sizeof(HANDLE));
- - *len = header_len;
- + sizeof(entry->u.QueryAllocatedRanges.Buffer));
- + tmp += sizeof(sizeof(entry->u.QueryAllocatedRanges.Buffer));
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_queryallocatedranges: "
- + "*len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- DbgP("marshal_nfs41_queryallocatedranges: name='%wZ' "
- "buffersize=0x%ld, buffer=0x%p\n",
- @@ -534,8 +544,9 @@ NTSTATUS marshal_nfs41_setzerodata(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(FILE_ZERO_DATA_INFORMATION);
- if (header_len > buf_len) {
- @@ -547,7 +558,13 @@ NTSTATUS marshal_nfs41_setzerodata(
- sizeof(entry->u.SetZeroData.setzerodata));
- tmp += sizeof(entry->u.SetZeroData.setzerodata);
- - *len = header_len;
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_setzerodata: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- DbgP("marshal_nfs41_setzerodata: name='%wZ'\n",
- entry->filename);
- @@ -842,8 +859,9 @@ NTSTATUS marshal_nfs41_duplicatedata(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len +
- sizeof(void *) +
- @@ -865,7 +883,14 @@ NTSTATUS marshal_nfs41_duplicatedata(
- RtlCopyMemory(tmp, &entry->u.DuplicateData.bytecount,
- sizeof(entry->u.DuplicateData.bytecount));
- tmp += sizeof(entry->u.DuplicateData.bytecount);
- - *len = header_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_duplicatedata: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- DbgP("marshal_nfs41_duplicatedata: name='%wZ'\n",
- entry->filename);
- diff --git a/sys/nfs41sys_lock.c b/sys/nfs41sys_lock.c
- index b73821d..31ed0ec 100644
- --- a/sys/nfs41sys_lock.c
- +++ b/sys/nfs41sys_lock.c
- @@ -81,8 +81,9 @@ NTSTATUS marshal_nfs41_lock(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + 2 * sizeof(LONGLONG) + 2 * sizeof(BOOLEAN);
- if (header_len > buf_len) {
- @@ -96,7 +97,15 @@ NTSTATUS marshal_nfs41_lock(
- RtlCopyMemory(tmp, &entry->u.Lock.exclusive, sizeof(BOOLEAN));
- tmp += sizeof(BOOLEAN);
- RtlCopyMemory(tmp, &entry->u.Lock.blocking, sizeof(BOOLEAN));
- - *len = header_len;
- + tmp += sizeof(BOOLEAN);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_lock: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_lock: "
- @@ -122,11 +131,12 @@ NTSTATUS marshal_nfs41_unlock(
- PLOWIO_LOCK_LIST lock;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(ULONG) +
- - (size_t)entry->u.Unlock.count * 2 * sizeof(LONGLONG);
- + ((size_t)entry->u.Unlock.count * 2) * sizeof(LONGLONG);
- if (header_len > buf_len) {
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- @@ -142,7 +152,14 @@ NTSTATUS marshal_nfs41_unlock(
- tmp += sizeof(LONGLONG);
- lock = lock->Next;
- }
- - *len = header_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_unlock: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_unlock: count=%u\n", entry->u.Unlock.count);
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index 062b076..80c4c3b 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -104,8 +104,9 @@ NTSTATUS marshal_nfs41_mount(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->u.Mount.srv_name) +
- length_as_utf8(entry->u.Mount.root) + 5 * sizeof(DWORD)
- @@ -130,17 +131,23 @@ NTSTATUS marshal_nfs41_mount(
- RtlCopyMemory(tmp, &entry->u.Mount.use_nfspubfh, sizeof(DWORD));
- tmp += sizeof(DWORD);
- RtlCopyMemory(tmp, &entry->u.Mount.nfsvers, sizeof(DWORD));
- -#ifdef NFS41_DRIVER_HACK_FORCE_FILENAME_CASE_MOUNTOPTIONS
- tmp += sizeof(DWORD);
- +#ifdef NFS41_DRIVER_HACK_FORCE_FILENAME_CASE_MOUNTOPTIONS
- RtlCopyMemory(tmp, &entry->u.Mount.force_case_preserving,
- sizeof(tristate_bool));
- tmp += sizeof(tristate_bool);
- RtlCopyMemory(tmp, &entry->u.Mount.force_case_insensitive,
- sizeof(tristate_bool));
- - /* tmp += sizeof(tristate_bool); */
- + tmp += sizeof(tristate_bool);
- #endif /* NFS41_DRIVER_HACK_FORCE_FILENAME_CASE_MOUNTOPTIONS */
- - *len = header_len;
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_mount: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_mount: server name='%wZ' mount point='%wZ' "
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index 16090a2..2d9ae41 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -115,8 +115,9 @@ NTSTATUS marshal_nfs41_open(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->filename) +
- 1 * sizeof(tristate_bool) +
- @@ -176,7 +177,15 @@ NTSTATUS marshal_nfs41_open(
- entry->u.Open.EaBuffer = NULL;
- }
- RtlCopyMemory(tmp, &entry->u.Open.EaBuffer, sizeof(HANDLE));
- - *len = header_len;
- + tmp += sizeof(HANDLE);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_open: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_open: name='%wZ' mask=0x%x access=0x%x attrs=0x%x "
- @@ -202,8 +211,9 @@ NTSTATUS marshal_nfs41_close(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(BOOLEAN) + sizeof(HANDLE);
- if (entry->u.Close.remove)
- @@ -217,13 +227,21 @@ NTSTATUS marshal_nfs41_close(
- RtlCopyMemory(tmp, &entry->u.Close.remove, sizeof(BOOLEAN));
- tmp += sizeof(BOOLEAN);
- RtlCopyMemory(tmp, &entry->u.Close.srv_open, sizeof(HANDLE));
- + tmp += sizeof(HANDLE);
- if (entry->u.Close.remove) {
- - tmp += sizeof(HANDLE);
- status = marshall_unicode_as_utf8(&tmp, entry->filename);
- if (status) goto out;
- RtlCopyMemory(tmp, &entry->u.Close.renamed, sizeof(BOOLEAN));
- + tmp += sizeof(BOOLEAN);
- + }
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_close: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- }
- - *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_close: name='%wZ' remove=%d srv_open=0x%p renamed=%d\n",
- diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
- index 35aeaf4..a2c023a 100644
- --- a/sys/nfs41sys_readwrite.c
- +++ b/sys/nfs41sys_readwrite.c
- @@ -94,8 +94,9 @@ NTSTATUS marshal_nfs41_rw(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(entry->u.ReadWrite.buf_len) +
- sizeof(entry->u.ReadWrite.offset) + sizeof(HANDLE);
- @@ -142,7 +143,15 @@ NTSTATUS marshal_nfs41_rw(
- }
- RtlCopyMemory(tmp, &entry->u.ReadWrite.buf, sizeof(HANDLE));
- - *len = header_len;
- + tmp += sizeof(HANDLE);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_rw: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL_RW
- DbgP("marshal_nfs41_rw: len=%lu offset=%llu "
- diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
- index 2e85f48..2c81f9a 100644
- --- a/sys/nfs41sys_symlink.c
- +++ b/sys/nfs41sys_symlink.c
- @@ -83,8 +83,9 @@ NTSTATUS marshal_nfs41_symlink(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + length_as_utf8(entry->filename);
- if (entry->opcode == NFS41_SYSOP_SYMLINK_SET)
- @@ -100,7 +101,14 @@ NTSTATUS marshal_nfs41_symlink(
- status = marshall_unicode_as_utf8(&tmp, entry->u.Symlink.target);
- if (status) goto out;
- }
- - *len = header_len;
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_symlink: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- if (entry->opcode == NFS41_SYSOP_SYMLINK_SET) {
- diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
- index 8250775..017dcb6 100644
- --- a/sys/nfs41sys_volinfo.c
- +++ b/sys/nfs41sys_volinfo.c
- @@ -80,8 +80,9 @@ NTSTATUS marshal_nfs41_volume(
- unsigned char *tmp = buf;
- status = marshal_nfs41_header(entry, tmp, buf_len, len);
- - if (status) goto out;
- - else tmp += *len;
- + if (status)
- + goto out;
- + tmp += *len;
- header_len = *len + sizeof(FS_INFORMATION_CLASS);
- if (header_len > buf_len) {
- @@ -90,7 +91,15 @@ NTSTATUS marshal_nfs41_volume(
- }
- RtlCopyMemory(tmp, &entry->u.Volume.query, sizeof(FS_INFORMATION_CLASS));
- - *len = header_len;
- + tmp += sizeof(FS_INFORMATION_CLASS);
- +
- + *len = (ULONG)(tmp - buf);
- + if (*len != header_len) {
- + DbgP("marshal_nfs41_volume: *len(=%ld) != header_len(=%ld)\n",
- + (long)*len, (long)header_len);
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_volume: class=%d\n", entry->u.Volume.query);
- --
- 2.51.0
- From ec3c7cf4b231ef2701a1fa694c686ef36c4bdb6b Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 22 Oct 2025 18:15:03 +0200
- Subject: [PATCH 7/9] sys: Add function names to |print_error()| users
- Add function names to |print_error()| users.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_dir.c | 5 +++--
- sys/nfs41sys_driver.c | 45 ++++++++++++++++++++++++++-------------
- sys/nfs41sys_fileinfo.c | 20 +++++++++++------
- sys/nfs41sys_updowncall.c | 4 +++-
- sys/nfs41sys_util.c | 6 +++---
- 5 files changed, 52 insertions(+), 28 deletions(-)
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 608f83a..7e6e4a0 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -251,8 +251,9 @@ NTSTATUS nfs41_QueryDirectory(
- case FileIdExtdBothDirectoryInformation:
- break;
- default:
- - print_error("nfs41_QueryDirectory: unhandled dir query class %d\n",
- - InfoClass);
- + print_error("nfs41_QueryDirectory: "
- + "unhandled dir query class %d\n",
- + (int)InfoClass);
- status = STATUS_NOT_SUPPORTED;
- goto out;
- }
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 53ab74a..39689ab 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -426,12 +426,16 @@ NTSTATUS SharedMemoryInit(
- status = RtlCreateSecurityDescriptor(&SecurityDesc,
- SECURITY_DESCRIPTOR_REVISION);
- if (status) {
- - print_error("RtlCreateSecurityDescriptor() failed with %08X\n", status);
- + print_error("SharedMemoryInit: "
- + "RtlCreateSecurityDescriptor() failed with status=0x%lx\n",
- + (long)status);
- goto out;
- }
- status = RtlSetDaclSecurityDescriptor(&SecurityDesc, TRUE, NULL, FALSE);
- if (status) {
- - print_error("RtlSetDaclSecurityDescriptor() failed with %08X\n", status);
- + print_error("SharedMemoryInit: "
- + "RtlSetDaclSecurityDescriptor() failed with status=0x%lx\n",
- + (long)status);
- goto out;
- }
- @@ -480,7 +484,9 @@ NTSTATUS nfs41_Start(
- status = SharedMemoryInit(&DevExt->SharedMemorySection);
- if (status) {
- - print_error("InitSharedMemory failed with %08X\n", status);
- + print_error("nfs41_Start: "
- + "InitSharedMemory failed with status=0x%lx\n",
- + (long)status);
- status = STATUS_INSUFFICIENT_RESOURCES;
- goto out;
- }
- @@ -698,7 +704,8 @@ NTSTATUS _nfs41_CreateSrvCall(
- #endif
- if (pSrvCall->pSrvCallName->Length > SERVER_NAME_BUFFER_SIZE) {
- - print_error("Server name '%wZ' too long for server entry (max %u)\n",
- + print_error("_nfs41_CreateSrvCall: "
- + "Server name '%wZ' too long for server entry (max %u)\n",
- pSrvCall->pSrvCallName, SERVER_NAME_BUFFER_SIZE);
- status = STATUS_NAME_TOO_LONG;
- goto out;
- @@ -748,8 +755,9 @@ NTSTATUS nfs41_CreateSrvCall(
- status = RxDispatchToWorkerThread(nfs41_dev, DelayedWorkQueue,
- (PRX_WORKERTHREAD_ROUTINE)_nfs41_CreateSrvCall, pCallbackContext);
- if (status != STATUS_SUCCESS) {
- - print_error("RxDispatchToWorkerThread returned status 0x%08lx\n",
- - status);
- + print_error("nfs41_CreateSrvCall: "
- + "RxDispatchToWorkerThread returned status 0x%lx\n",
- + (long)status);
- pCallbackContext->Status = status;
- pCallbackContext->SrvCalldownStructure->CallBack(pCallbackContext);
- status = STATUS_PENDING;
- @@ -1075,7 +1083,7 @@ NTSTATUS nfs41_FsdDispatch(
- #endif
- if (dev != (PDEVICE_OBJECT)nfs41_dev) {
- - print_error("*** not ours ***\n");
- + print_error("nfs41_FsdDispatch: *** not ours ***\n");
- Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp, IO_NFS41FS_INCREMENT);
- @@ -1452,7 +1460,8 @@ NTSTATUS DriverEntry(
- status = RxDriverEntry(drv, path);
- if (status != STATUS_SUCCESS) {
- - print_error("RxDriverEntry failed: 0x%08lx\n", status);
- + print_error("DriverEntry: RxDriverEntry failed, status=0x%lx\n",
- + (long)status);
- goto out;
- }
- @@ -1461,11 +1470,12 @@ NTSTATUS DriverEntry(
- status = nfs41_init_ops();
- if (status != STATUS_SUCCESS) {
- - print_error("nfs41_init_ops failed to initialize dispatch table\n");
- + print_error("DriverEntry: "
- + "nfs41_init_ops failed to initialize dispatch table\n");
- goto out;
- }
- - DbgP("calling RxRegisterMinirdr\n");
- + DbgP("DriverEntry: calling RxRegisterMinirdr\n");
- status = RxRegisterMinirdr(&nfs41_dev, drv, &nfs41_ops, flags, &dev_name,
- sizeof(NFS41_DEVICE_EXTENSION),
- FILE_DEVICE_NETWORK_FILE_SYSTEM, FILE_REMOTE_DEVICE);
- @@ -1482,10 +1492,13 @@ NTSTATUS DriverEntry(
- dev_exts->DeviceObject = nfs41_dev;
- RtlInitUnicodeString(&user_dev_name, NFS41_SHADOW_DEVICE_NAME);
- - DbgP("calling IoCreateSymbolicLink '%wZ' '%wZ'\n", &user_dev_name, &dev_name);
- + DbgP("DriverEntry: calling IoCreateSymbolicLink '%wZ' '%wZ'\n",
- + &user_dev_name, &dev_name);
- status = IoCreateSymbolicLink(&user_dev_name, &dev_name);
- if (status != STATUS_SUCCESS) {
- - print_error("Device name IoCreateSymbolicLink failed: 0x%08lx\n", status);
- + print_error("DriverEntry: "
- + "Device name IoCreateSymbolicLink failed: status=0x%lx\n",
- + (long)status);
- goto out_unregister;
- }
- @@ -1568,15 +1581,17 @@ unload:
- RtlInitUnicodeString(&dev_name, NFS41_SHADOW_DEVICE_NAME);
- status = IoDeleteSymbolicLink(&dev_name);
- if (status != STATUS_SUCCESS) {
- - print_error("couldn't delete device symbolic link\n");
- + print_error("nfs41_driver_unload: "
- + "could not delete device symbolic link\n");
- }
- RtlInitUnicodeString(&pipe_name, NFS41_SHADOW_PIPE_NAME);
- status = IoDeleteSymbolicLink(&pipe_name);
- if (status != STATUS_SUCCESS) {
- - print_error("couldn't delete pipe symbolic link\n");
- + print_error("nfs41_driver_unload: "
- + "could not delete pipe symbolic link\n");
- }
- RxUnload(drv);
- - DbgP("driver unloaded 0x%p\n", drv);
- + DbgP("nfs41_driver_unload: driver unloaded 0x%p\n", drv);
- DbgR();
- }
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 8d26824..c86838c 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -226,7 +226,8 @@ NTSTATUS nfs41_QueryFileInformation(
- status = check_nfs41_dirquery_args(RxContext);
- if (status) {
- - print_error("check_nfs41_dirquery_args failed.\n");
- + print_error("nfs41_QueryFileInformation: "
- + "check_nfs41_dirquery_args failed.\n");
- goto out;
- }
- @@ -399,7 +400,8 @@ NTSTATUS nfs41_QueryFileInformation(
- #endif /* NFS41_DRIVER_WSL_SUPPORT */
- break;
- default:
- - print_error("nfs41_QueryFileInformation: unhandled class %d\n", InfoClass);
- + print_error("nfs41_QueryFileInformation: "
- + "unhandled class %d\n", (int)InfoClass);
- status = STATUS_NOT_SUPPORTED;
- goto out;
- }
- @@ -408,7 +410,8 @@ NTSTATUS nfs41_QueryFileInformation(
- pVNetRootContext->session, nfs41_fobx->nfs41_open_state,
- pNetRootContext->nfs41d_version, SrvOpen->pAlreadyPrefixedName, &entry);
- if (status) {
- - print_error("nfs41_UpcallCreate() failed, status=0x%lx\n",
- + print_error("nfs41_QueryFileInformation: "
- + "nfs41_UpcallCreate() failed, status=0x%lx\n",
- (long)status);
- goto out;
- }
- @@ -426,11 +429,12 @@ NTSTATUS nfs41_QueryFileInformation(
- if (entry->status == STATUS_BUFFER_TOO_SMALL) {
- RxContext->InformationToReturn = entry->u.QueryFile.buf_len;
- - print_error("entry->status == STATUS_BUFFER_TOO_SMALL\n");
- + print_error("nfs41_QueryFileInformation: "
- + "entry->status == STATUS_BUFFER_TOO_SMALL\n");
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- #ifdef DEBUG_FILE_QUERY
- - print_error("entry->status == STATUS_SUCCESS\n");
- + print_error("nfs41_QueryFileInformation: entry->status == STATUS_SUCCESS\n");
- #endif
- BOOLEAN DeletePending = FALSE;
- #ifdef ENABLE_TIMINGS
- @@ -498,11 +502,13 @@ NTSTATUS nfs41_QueryFileInformation(
- #endif /* NFS41_DRIVER_WSL_SUPPORT */
- break;
- default:
- - print_error("Unhandled/unsupported InfoClass(%d)\n", (int)InfoClass);
- + print_error("nfs41_QueryFileInformation: "
- + "Unhandled/unsupported InfoClass(%d)\n", (int)InfoClass);
- }
- } else {
- status = map_queryfile_error(entry->status);
- - print_error("status(0x%lx) = map_queryfile_error(entry->status(0x%lx));\n",
- + print_error("nfs41_QueryFileInformation: "
- + "status(0x%lx) = map_queryfile_error(entry->status(0x%lx));\n",
- (long)status, (long)entry->status);
- }
- out:
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index 64b0432..5a4c250 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -335,7 +335,9 @@ NTSTATUS handle_upcall(
- break;
- default:
- status = STATUS_INVALID_PARAMETER;
- - print_error("Unknown nfs41 ops %d\n", entry->opcode);
- + print_error("handle_upcall: Unknown nfs41 ops %d\n",
- + (int)entry->opcode);
- + break;
- }
- // if (status == STATUS_SUCCESS)
- diff --git a/sys/nfs41sys_util.c b/sys/nfs41sys_util.c
- index 65c1990..6cceee8 100644
- --- a/sys/nfs41sys_util.c
- +++ b/sys/nfs41sys_util.c
- @@ -128,7 +128,7 @@ NTSTATUS nfs41_ProbeAndLockKernelPages(
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- NTSTATUS code;
- code = GetExceptionCode();
- - print_error("marshal_nfs41_dirquery: Call to "
- + print_error("nfs41_ProbeAndLockKernelPages: Call to "
- "MmMapLockedPagesSpecifyCache() failed "
- "due to exception 0x%lx\n", (long)code);
- status = STATUS_ACCESS_VIOLATION;
- @@ -186,8 +186,8 @@ NTSTATUS nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace(
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- NTSTATUS code;
- code = GetExceptionCode();
- - print_error("nfs41_UnmapLockedKernelPages: "
- - "MmUnmapLockedPages thrown exception=0x%lx\n",
- + print_error("nfs41_UnmapLockedKernelPagesInNfsDaemonAddressSpace: "
- + "MmUnmapLockedPages() thrown exception=0x%lx\n",
- (long)code);
- status = STATUS_ACCESS_VIOLATION;
- }
- --
- 2.51.0
- From c3d823b20c0c96affd7cae9db9a3f538ba194cf2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 22 Oct 2025 22:16:12 +0200
- Subject: [PATCH 8/9] daemon: |handle_nfs41_setattr_basicinfo()| should only
- return read delegations for unsafe attributes
- |handle_nfs41_setattr_basicinfo()| should only return read delegations for
- unsafe attributes (e.g. |FATTR4_WORD1_MODE|, |FATTR4_WORD1_TIME_CREATE|),
- the NFS server will issue a delegation recall anyway if it disagrees.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/setattr.c | 26 +++++++++++++++++++++++---
- 1 file changed, 23 insertions(+), 3 deletions(-)
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index 90b177a..a45e782 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -174,9 +174,29 @@ static int handle_nfs41_setattr_basicinfo(void *daemon_context, setattr_upcall_a
- if (info.attrmask.count == 0)
- goto out;
- - /* break read delegations before SETATTR */
- - nfs41_delegation_return(state->session, &state->file,
- - OPEN_DELEGATE_READ, FALSE);
- + /*
- + * Break read delegations before SETATTR, but only for attributes
- + * which are unsafe even if we hold a read delegation.
- + *
- + * FIXME:
- + * 1. Should we do this if we own a write delegation ?
- + * 2. Should we do this for |FATTR4_WORD1_TIME_MODIFY_SET| too,
- + * even if we have the file open for writing, and/or have a write
- + * delegation (well, the NFS server will do a delegation recall
- + * via CB if it disagrees...) ?
- + * 3. The NFSv4 RFCs really should have a list of attributes which
- + * would trigger a recall for read or write delegations
- + */
- + if (bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_MODE) ||
- + bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_TIME_CREATE)) {
- + DPRINTF(0, ("handle_nfs41_setattr_basicinfo(args->path='%s'): "
- + "returning read delegation because of mode=%d, time_create=%d\n",
- + args->path,
- + (int)bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_MODE),
- + (int)bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_TIME_CREATE)));
- + nfs41_delegation_return(state->session, &state->file,
- + OPEN_DELEGATE_READ, FALSE);
- + }
- nfs41_open_stateid_arg(state, &stateid);
- --
- 2.51.0
- From 9ad4b6c07b18930a33028b2af1bfbf5d7d27c62e Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Wed, 22 Oct 2025 22:23:12 +0200
- Subject: [PATCH 9/9] sys: Implement |FSCTL_SET_PURGE_FAILURE_MODE| dummy
- support like OpenAFS does
- Implement |FSCTL_SET_PURGE_FAILURE_MODE| dummy support like OpenAFS does
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_fsctl.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
- diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
- index adc322e..f6d44da 100644
- --- a/sys/nfs41sys_fsctl.c
- +++ b/sys/nfs41sys_fsctl.c
- @@ -1399,6 +1399,14 @@ NTSTATUS nfs41_FsCtl(
- case FSCTL_OFFLOAD_WRITE:
- status = nfs41_OffloadWrite(RxContext);
- break;
- + case FSCTL_SET_PURGE_FAILURE_MODE:
- + /*
- + * For the time being just succeed this call, as OpenAFS
- + * does in openafs.git commit #0af079f2d03d1b76bd4221cb56b27091b5635fd0
- + * (https://git.openafs.org/?p=openafs.git;a=commit;h=0af079f2d03d1b76bd4221cb56b27091b5635fd0)
- + */
- + status = STATUS_SUCCESS;
- + break;
- default:
- break;
- }
- --
- 2.51.0
msnfs41client: Patches for kernel upcall size verification, returning read delegations on SETATTR only for unsafe attributes+misc, 2025-10-22
Posted by Anonymous on Wed 22nd Oct 2025 21:38
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
rovema.kpaste.net RSS