- From 20f3ff6b6319ff9bcf0258430f31565cfc49f5ce Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 14 Oct 2024 14:45:31 +0200
- Subject: [PATCH 1/3] sys: Fix |DbgPrintEx()| fmt %x to %x/%lx/%llx to match
- the datatypes
- Fix |DbgPrintEx()| fmt %x to %x/%lx/%llx to match the datatypes,
- mainly |NTSTATUS| to |long| and |LARGE_INTEGER.Quadpart| to
- |long long|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_acl.c | 17 ++++++++++-------
- sys/nfs41sys_debug.c | 18 +++++++++++-------
- sys/nfs41sys_debug.h | 8 ++++----
- sys/nfs41sys_dir.c | 14 ++++++++------
- sys/nfs41sys_driver.c | 18 ++++++++++--------
- sys/nfs41sys_ea.c | 20 +++++++++++++-------
- sys/nfs41sys_fileinfo.c | 21 ++++++++++++---------
- sys/nfs41sys_lock.c | 16 ++++++++++------
- sys/nfs41sys_mount.c | 23 +++++++++++++----------
- sys/nfs41sys_openclose.c | 17 ++++++++++-------
- sys/nfs41sys_readwrite.c | 15 ++++++++-------
- sys/nfs41sys_symlink.c | 5 +++--
- sys/nfs41sys_updowncall.c | 8 ++++----
- sys/nfs41sys_volinfo.c | 5 +++--
- 14 files changed, 119 insertions(+), 86 deletions(-)
- diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
- index 02e7324..1ad4c77 100644
- --- a/sys/nfs41sys_acl.c
- +++ b/sys/nfs41sys_acl.c
- @@ -93,7 +93,7 @@ NTSTATUS marshal_nfs41_getacl(
- *len = header_len;
- #ifdef DEBUG_MARSHAL_DETAIL
- - DbgP("marshal_nfs41_getacl: class=0x%x\n", entry->u.Acl.query);
- + DbgP("marshal_nfs41_getacl: class=0x%x\n", (int)entry->u.Acl.query);
- #endif
- out:
- return status;
- @@ -129,7 +129,7 @@ NTSTATUS marshal_nfs41_setacl(
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_setacl: class=0x%x sec_desc_len=%lu\n",
- - entry->u.Acl.query, entry->buf_len);
- + (int)entry->u.Acl.query, (long)entry->buf_len);
- #endif
- out:
- return status;
- @@ -172,8 +172,9 @@ NTSTATUS map_query_acl_error(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_query_acl_error: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long long)error);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- @@ -230,8 +231,9 @@ NTSTATUS nfs41_QuerySecurityInformation(
- LARGE_INTEGER current_time;
- KeQuerySystemTime(¤t_time);
- #ifdef DEBUG_ACL_QUERY
- - DbgP("CurrentTime 0x%lx Saved Acl time 0x%lx\n",
- - current_time.QuadPart, nfs41_fobx->time.QuadPart);
- + DbgP("CurrentTime 0x%llx Saved Acl time 0x%llx\n",
- + (long long)current_time.QuadPart,
- + (long long)nfs41_fobx->time.QuadPart);
- #endif
- if (current_time.QuadPart - nfs41_fobx->time.QuadPart <= 20*1000) {
- PSECURITY_DESCRIPTOR sec_desc = (PSECURITY_DESCRIPTOR)
- @@ -380,7 +382,8 @@ NTSTATUS nfs41_SetSecurityInformation(
- status = RtlGetDaclSecurityDescriptor(sec_desc, &present, &acl,
- &dacl_default);
- if (status) {
- - DbgP("RtlGetDaclSecurityDescriptor failed 0x%x\n", status);
- + DbgP("RtlGetDaclSecurityDescriptor failed status=0x%lx\n",
- + (long)status);
- goto out;
- }
- if (present == FALSE) {
- diff --git a/sys/nfs41sys_debug.c b/sys/nfs41sys_debug.c
- index 7bb0f33..d19a1f2 100644
- --- a/sys/nfs41sys_debug.c
- +++ b/sys/nfs41sys_debug.c
- @@ -218,18 +218,21 @@ void print_basic_info(int on, PFILE_BASIC_INFORMATION info)
- {
- if (!on) return;
- DbgP("BASIC_INFO: "
- - "Create=0x%lx Access=0x%lx Write=0x%lx Change=0x%lx Attr=0x%x\n",
- - info->CreationTime.QuadPart, info->LastAccessTime.QuadPart,
- - info->LastWriteTime.QuadPart, info->ChangeTime.QuadPart,
- - info->FileAttributes);
- + "Create=0x%llx Access=0x%llx Write=0x%llx Change=0x%llx Attr=0x%x\n",
- + (long long)info->CreationTime.QuadPart,
- + (long long)info->LastAccessTime.QuadPart,
- + (long long)info->LastWriteTime.QuadPart,
- + (long long)info->ChangeTime.QuadPart,
- + (int)info->FileAttributes);
- }
- void print_std_info(int on, PFILE_STANDARD_INFORMATION info)
- {
- if (!on) return;
- DbgP("STD_INFO: "
- - "Type='%s' #Links=%d Alloc=0x%lx EOF=0x%lx Delete=%d\n",
- + "Type='%s' #Links=%d Alloc=0x%llx EOF=0x%llx Delete=%d\n",
- info->Directory?"DIR":"FILE", info->NumberOfLinks,
- - info->AllocationSize.QuadPart, info->EndOfFile.QuadPart,
- + (long long)info->AllocationSize.QuadPart,
- + (long long)info->EndOfFile.QuadPart,
- info->DeletePending);
- }
- @@ -767,7 +770,8 @@ dprintk(
- if (!NT_SUCCESS(status))
- rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags,
- - "RtlStringCbVPrintfA failed 0x%x \n", status);
- + "RtlStringCbVPrintfA failed 0x%lx \n",
- + (long)status);
- else
- rv = DbgPrintEx(PNFS_FLTR_ID, DPFLTR_MASK | flags, "'%s' '%s': '%s'\n",
- PNFS_TRACE_TAG, func, debugMessageBuffer);
- diff --git a/sys/nfs41sys_debug.h b/sys/nfs41sys_debug.h
- index d5e0f03..d199ddf 100644
- --- a/sys/nfs41sys_debug.h
- +++ b/sys/nfs41sys_debug.h
- @@ -70,18 +70,18 @@ void print_debug_header(PRX_CONTEXT RxContext);
- __func__); __try {
- #define DbgEx() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
- - "<-- [%s] [%04x] %s status = 0x%08lx\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
- - __func__, status); \
- + "<-- [%s] [%04x] %s status=0x%lx\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
- + __func__, (long)status); \
- } __except (EXCEPTION_EXECUTE_HANDLER) { \
- status = GetExceptionCode() ; \
- - DbgP("Exception encountered with value = Ox%x\n", status); \
- + DbgP("Exception encountered with value = 0x%lx\n", (long)status); \
- }
- #define DbgR() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
- "<-- [%s] [%04x] %s\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), __func__); \
- } __except (EXCEPTION_EXECUTE_HANDLER) { \
- NTSTATUS exc_status; \
- exc_status = GetExceptionCode() ; \
- - DbgP("Exception encountered with value = 0x%x\n", (int)exc_status); \
- + DbgP("Exception encountered with value = 0x%lx\n", (long)exc_status); \
- }
- /* These are for ToasterDebugPrint */
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 01f078a..83109ed 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -117,7 +117,7 @@ NTSTATUS marshal_nfs41_dirquery(
- code = GetExceptionCode();
- print_error("marshal_nfs41_dirquery: Call to "
- "MmMapLockedPagesSpecifyCache() failed "
- - "due to exception 0x%x\n", (int)code);
- + "due to exception 0x%lx\n", (long)code);
- status = STATUS_ACCESS_VIOLATION;
- goto out;
- }
- @@ -152,7 +152,8 @@ NTSTATUS unmarshal_nfs41_dirquery(
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- NTSTATUS code;
- code = GetExceptionCode();
- - print_error("MmUnmapLockedPages thrown exception=0x%0x\n", code);
- + print_error("MmUnmapLockedPages thrown exception=0x%lx\n",
- + (long)code);
- status = STATUS_ACCESS_VIOLATION;
- }
- if (buf_len > cur->buf_len)
- @@ -199,8 +200,9 @@ NTSTATUS map_querydir_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_querydir_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long)status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- @@ -303,8 +305,8 @@ NTSTATUS nfs41_QueryDirectory(
- status = STATUS_SUCCESS;
- } else if ((entry->status == STATUS_ACCESS_VIOLATION) ||
- (entry->status == STATUS_INSUFFICIENT_RESOURCES)) {
- - DbgP("nfs41_QueryDirectory: internal error: entry->status=0x%x\n",
- - (int)entry->status);
- + DbgP("nfs41_QueryDirectory: internal error: entry->status=0x%lx\n",
- + (long)entry->status);
- status = STATUS_INSUFFICIENT_RESOURCES;
- } else {
- /* map windows ERRORs to NTSTATUS */
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 193ab28..246ba36 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -224,7 +224,7 @@ NTSTATUS marshal_nfs41_header(
- MmIsAddressValid(entry->filename->Buffer)) {
- #ifdef DEBUG_MARSHAL_HEADER
- DbgP("[upcall header] xid=%lld opcode='%s' filename='%wZ' version=%d "
- - "session=0x%x open_state=0x%x\n", entry->xid,
- + "session=0x%p open_state=0x%x\n", entry->xid,
- ENTRY_OPCODE2STRING(entry), entry->filename,
- entry->version, entry->session, entry->open_state);
- #endif /* DEBUG_MARSHAL_HEADER */
- @@ -670,17 +670,19 @@ static ULONG nfs41_ExtendForCache(
- PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
- DbgEn();
- print_debug_header(RxContext);
- - DbgP("input: byte count 0x%x filesize 0x%x alloc size 0x%x\n",
- - LowIoContext->ParamsFor.ReadWrite.ByteCount, *pNewFileSize,
- - *pNewAllocationSize);
- + DbgP("input: bytecount=0x%lx filesize=0x%llx allocsize=0x%llx\n",
- + (long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
- + (long long)pNewFileSize->QuadPart,
- + (long long)pNewAllocationSize->QuadPart);
- #endif
- pNewAllocationSize->QuadPart = pNewFileSize->QuadPart + 8192;
- nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
- pNewAllocationSize->QuadPart;
- nfs41_fcb->StandardInfo.EndOfFile.QuadPart = pNewFileSize->QuadPart;
- #ifdef DEBUG_CACHE
- - DbgP("new filesize 0x%x new allocation size 0x%x\n",
- - *pNewFileSize, *pNewAllocationSize);
- + DbgP("newfilesize=0x%llx newallocationsize=0x%llx\n",
- + (long long)pNewFileSize->QuadPart,
- + (long long)pNewAllocationSize->QuadPart);
- #endif
- #ifdef DEBUG_CACHE
- DbgEx();
- @@ -993,7 +995,7 @@ out:
- #ifdef DEBUG_FSDDISPATCH
- DbgP("IoStatus status = 0x%lx info = 0x%x\n",
- (long)Irp->IoStatus.Status,
- - Irp->IoStatus.Information);
- + (int)Irp->IoStatus.Information);
- DbgEx();
- #endif
- return status;
- @@ -1009,7 +1011,7 @@ NTSTATUS nfs41_AreFilesAliased(
- PFCB a,
- PFCB b)
- {
- - DbgP("nfs41_AreFilesAliased: a=0x%p b=%0x%p\n",
- + DbgP("nfs41_AreFilesAliased: a=0x%p b=0x%p\n",
- (void *)a, (void *)b);
- return STATUS_NOT_IMPLEMENTED;
- }
- diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
- index 83943de..dee8ef1 100644
- --- a/sys/nfs41sys_ea.c
- +++ b/sys/nfs41sys_ea.c
- @@ -100,7 +100,9 @@ NTSTATUS marshal_nfs41_easet(
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_easet: filename='%wZ', buflen=%d mode=0x%x\n",
- - entry->filename, entry->buf_len, entry->u.SetEa.mode);
- + entry->filename,
- + (int)entry->buf_len,
- + (int)entry->u.SetEa.mode);
- #endif
- out:
- return status;
- @@ -172,10 +174,13 @@ void unmarshal_nfs41_eaget(
- static void print_nfs3_attrs(
- nfs3_attrs *attrs)
- {
- - DbgP("type=%d mode=0%o nlink=%d size=%d "
- - "atime=0x%x mtime=0x%x ctime=0x%x\n",
- - attrs->type, attrs->mode, attrs->nlink, attrs->size, attrs->atime,
- - attrs->mtime, attrs->ctime);
- + DbgP("type=%d mode=0%o nlink=%d size=%lld "
- + "atime=0x%llx mtime=0x%llx ctime=0x%llx\n",
- + attrs->type, attrs->mode, attrs->nlink,
- + (long long)attrs->size.QuadPart,
- + (long long)attrs->atime,
- + (long long)attrs->mtime,
- + (long long)attrs->ctime);
- }
- static void file_time_to_nfs_time(
- @@ -233,8 +238,9 @@ NTSTATUS map_setea_error(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_setea_error: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_PARAMETER\n", error);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_PARAMETER\n",
- + (long)error);
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- }
- }
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 0839bc2..0f7ca82 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -174,8 +174,9 @@ NTSTATUS map_queryfile_error(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_queryfile_error: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long)error);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- @@ -369,8 +370,8 @@ NTSTATUS nfs41_QueryFileInformation(
- if (nfs41_fcb->StandardInfo.AllocationSize.QuadPart >
- std_info->AllocationSize.QuadPart) {
- #ifdef DEBUG_FILE_QUERY
- - DbgP("Old AllocationSize is bigger: saving 0x%x\n",
- - nfs41_fcb->StandardInfo.AllocationSize.QuadPart);
- + DbgP("Old AllocationSize is bigger: saving 0x%llx\n",
- + (long long)nfs41_fcb->StandardInfo.AllocationSize.QuadPart);
- #endif
- std_info->AllocationSize.QuadPart =
- nfs41_fcb->StandardInfo.AllocationSize.QuadPart;
- @@ -378,8 +379,8 @@ NTSTATUS nfs41_QueryFileInformation(
- if (nfs41_fcb->StandardInfo.EndOfFile.QuadPart >
- std_info->EndOfFile.QuadPart) {
- #ifdef DEBUG_FILE_QUERY
- - DbgP("Old EndOfFile is bigger: saving 0x%x\n",
- - nfs41_fcb->StandardInfo.EndOfFile);
- + DbgP("Old EndOfFile is bigger: saving 0x%llx\n",
- + (long long)nfs41_fcb->StandardInfo.EndOfFile.QuadPart);
- #endif
- std_info->EndOfFile.QuadPart =
- nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
- @@ -420,7 +421,8 @@ out:
- #endif
- #ifdef DEBUG_FILE_QUERY
- DbgEx();
- - DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n", (long)status);
- + DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n",
- + (long)status);
- #endif
- return status;
- }
- @@ -447,8 +449,9 @@ NTSTATUS map_setfile_error(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_setfile_error: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_PARAMETER\n", error);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_PARAMETER\n",
- + (long)error);
- case ERROR_INVALID_PARAMETER: return STATUS_INVALID_PARAMETER;
- }
- }
- diff --git a/sys/nfs41sys_lock.c b/sys/nfs41sys_lock.c
- index 208fc6d..50f0716 100644
- --- a/sys/nfs41sys_lock.c
- +++ b/sys/nfs41sys_lock.c
- @@ -100,7 +100,9 @@ NTSTATUS marshal_nfs41_lock(
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("marshal_nfs41_lock: "
- "offset=0x%llx length=0x%llx exclusive=%u "
- - "blocking=%u\n", entry->u.Lock.offset, entry->u.Lock.length,
- + "blocking=%u\n",
- + (long long)entry->u.Lock.offset,
- + (long long)entry->u.Lock.length,
- entry->u.Lock.exclusive, entry->u.Lock.blocking);
- #endif
- out:
- @@ -158,7 +160,8 @@ NTSTATUS nfs41_IsLockRealizable(
- #ifdef DEBUG_LOCK
- DbgEn();
- DbgP("offset 0x%llx, length 0x%llx, exclusive=%u, blocking=%u\n",
- - ByteOffset->QuadPart,Length->QuadPart,
- + (long long)ByteOffset->QuadPart,
- + (long long)Length->QuadPart,
- BooleanFlagOn(LowIoLockFlags, SL_EXCLUSIVE_LOCK),
- !BooleanFlagOn(LowIoLockFlags, SL_FAIL_IMMEDIATELY));
- #endif
- @@ -191,8 +194,9 @@ NTSTATUS map_lock_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_lock_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long)status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- @@ -204,8 +208,8 @@ static void print_lock_args(
- const ULONG flags = LowIoContext->ParamsFor.Locks.Flags;
- print_debug_header(RxContext);
- DbgP("offset 0x%llx, length 0x%llx, exclusive=%u, blocking=%u\n",
- - LowIoContext->ParamsFor.Locks.ByteOffset,
- - LowIoContext->ParamsFor.Locks.Length,
- + (long long)LowIoContext->ParamsFor.Locks.ByteOffset,
- + (long long)LowIoContext->ParamsFor.Locks.Length,
- BooleanFlagOn(flags, SL_EXCLUSIVE_LOCK),
- !BooleanFlagOn(flags, SL_FAIL_IMMEDIATELY));
- }
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index e062df6..8317980 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -163,8 +163,9 @@ void unmarshal_nfs41_mount(
- *buf += sizeof(DWORD);
- RtlCopyMemory(cur->u.Mount.FsAttrs, *buf, sizeof(FILE_FS_ATTRIBUTE_INFORMATION));
- #ifdef DEBUG_MARSHAL_DETAIL
- - DbgP("unmarshal_nfs41_mount: session pointer 0x%x version %d lease_time "
- - "%d\n", cur->session, cur->version, cur->u.Mount.lease_time);
- + DbgP("unmarshal_nfs41_mount: session=0x%p version=%d lease_time "
- + "%d\n",
- + cur->session, cur->version, cur->u.Mount.lease_time);
- #endif
- }
- @@ -228,8 +229,9 @@ NTSTATUS map_mount_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_mount_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INSUFFICIENT_RESOURCES\n",
- + (long)status);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- }
- @@ -629,13 +631,14 @@ NTSTATUS nfs41_GetLUID(
- FALSE, &clnt_sec_ctx);
- if (status) {
- print_error("nfs41_GetLUID: SeCreateClientSecurityFromSubjectContext "
- - "failed 0x%x\n", status);
- + "failed status=0x%lx\n", (long)status);
- goto release_sec_ctx;
- }
- status = SeQueryAuthenticationIdToken(clnt_sec_ctx.ClientToken, id);
- if (status) {
- print_error("nfs41_GetLUID: "
- - "SeQueryAuthenticationIdToken() failed 0x%x\n", status);
- + "SeQueryAuthenticationIdToken() failed 0x%lx\n",
- + (long)status);
- goto release_clnt_sec_ctx;
- }
- release_clnt_sec_ctx:
- @@ -754,11 +757,11 @@ NTSTATUS nfs41_CreateVNetRoot(
- // print_v_net_root(pVNetRoot);
- DbgP("pVNetRoot=0x%p pNetRoot=0x%p pSrvCall=0x%p\n", pVNetRoot, pNetRoot, pSrvCall);
- - DbgP("pNetRoot='%wZ' Type=%d pSrvCallName='%wZ' VirtualNetRootStatus=0x%x "
- + DbgP("pNetRoot='%wZ' Type=%d pSrvCallName='%wZ' VirtualNetRootStatus=0x%lx "
- "NetRootStatus=0x%x\n", pNetRoot->pNetRootName,
- pNetRoot->Type, pSrvCall->pSrvCallName,
- pCreateNetRootContext->VirtualNetRootStatus,
- - pCreateNetRootContext->NetRootStatus);
- + (long)pCreateNetRootContext->NetRootStatus);
- #endif
- if (pNetRoot->Type != NET_ROOT_DISK && pNetRoot->Type != NET_ROOT_WILD) {
- @@ -1090,7 +1093,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- /* modify existing mount entry */
- #ifdef DEBUG_MOUNT
- DbgP("Using existing %d flavor session 0x%x\n",
- - pVNetRootContext->sec_flavor);
- + (int)pVNetRootContext->sec_flavor);
- #endif
- switch (pVNetRootContext->sec_flavor) {
- case RPCSEC_AUTH_SYS:
- @@ -1105,7 +1108,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- }
- pNetRootContext->nfs41d_version = nfs41d_version;
- #ifdef DEBUG_MOUNT
- - DbgP("Saving new session 0x%x\n", pVNetRootContext->session);
- + DbgP("Saving new session 0x%p\n", pVNetRootContext->session);
- #endif
- out_free:
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index 14f3471..0018105 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -93,7 +93,7 @@ NTSTATUS nfs41_get_sec_ctx(
- FALSE, out_ctx);
- if (status != STATUS_SUCCESS) {
- print_error("SeCreateClientSecurityFromSubjectContext "
- - "failed with 0x%x\n", status);
- + "failed with 0x%lx\n", (long)status);
- }
- #ifdef DEBUG_SECURITY_TOKEN
- DbgP("Created client security token 0x%p\n", out_ctx->ClientToken);
- @@ -175,7 +175,7 @@ NTSTATUS marshal_nfs41_open(
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- print_error("marshal_nfs41_open: Call to "
- "MmMapLockedPagesSpecifyCache() failed "
- - "due to exception 0x%x\n", (int)GetExceptionCode());
- + "due to exception 0x%lx\n", (long)GetExceptionCode());
- status = STATUS_ACCESS_VIOLATION;
- goto out;
- }
- @@ -254,7 +254,8 @@ NTSTATUS unmarshal_nfs41_open(
- if (cur->u.Open.EaBuffer)
- MmUnmapLockedPages(cur->u.Open.EaBuffer, cur->u.Open.EaMdl);
- } __except(EXCEPTION_EXECUTE_HANDLER) {
- - print_error("MmUnmapLockedPages thrown exception=0x%0x\n", GetExceptionCode());
- + print_error("MmUnmapLockedPages thrown exception=0x%lx\n",
- + (long)GetExceptionCode());
- status = cur->status = STATUS_ACCESS_VIOLATION;
- goto out;
- }
- @@ -381,8 +382,9 @@ NTSTATUS map_open_errors(
- case ERROR_FILE_TOO_LARGE: return STATUS_FILE_TOO_LARGE;
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- - print_error("[ERROR] nfs41_Create: upcall returned ERROR_0x%x "
- - "returning STATUS_INSUFFICIENT_RESOURCES\n", status);
- + print_error("[ERROR] nfs41_Create: upcall returned ERROR_0x%lx "
- + "returning STATUS_INSUFFICIENT_RESOURCES\n",
- + (long)status);
- case ERROR_OUTOFMEMORY: return STATUS_INSUFFICIENT_RESOURCES;
- }
- }
- @@ -955,8 +957,9 @@ NTSTATUS map_close_errors(
- case ERROR_FILE_TOO_LARGE: return STATUS_FILE_TOO_LARGE;
- default:
- print_error("map_close_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INTERNAL_ERROR\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INTERNAL_ERROR\n",
- + (long)status);
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- }
- }
- diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
- index d567824..c039d23 100644
- --- a/sys/nfs41sys_readwrite.c
- +++ b/sys/nfs41sys_readwrite.c
- @@ -77,9 +77,9 @@ static void print_readwrite_args(
- PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
- print_debug_header(RxContext);
- - DbgP("Bytecount 0x%x Byteoffset 0x%x Buffer 0x%p\n",
- - LowIoContext->ParamsFor.ReadWrite.ByteCount,
- - LowIoContext->ParamsFor.ReadWrite.ByteOffset,
- + DbgP("Byteoffset=0x%llx Bytecount=0x%llx Buffer=0x%p\n",
- + (long long)LowIoContext->ParamsFor.ReadWrite.ByteOffset,
- + (long long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
- LowIoContext->ParamsFor.ReadWrite.Buffer);
- }
- @@ -132,7 +132,7 @@ NTSTATUS marshal_nfs41_rw(
- code = GetExceptionCode();
- print_error("marshal_nfs41_rw: Call to "
- "MmMapLockedPagesSpecifyCache() failed due to "
- - "exception 0x%x\n", (int)code);
- + "exception 0x%lx\n", (long)code);
- status = STATUS_ACCESS_VIOLATION;
- goto out;
- }
- @@ -174,7 +174,7 @@ NTSTATUS unmarshal_nfs41_rw(
- NTSTATUS code;
- code = GetExceptionCode();
- print_error("unmarshal_nfs41_rw: Call to MmUnmapLockedPages() "
- - "failed due to exception 0x%0x\n", (int)code);
- + "failed due to exception 0x%0x\n", (long)code);
- status = STATUS_ACCESS_VIOLATION;
- }
- #endif
- @@ -198,8 +198,9 @@ NTSTATUS map_readwrite_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_readwrite_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_NET_WRITE_FAULT\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_NET_WRITE_FAULT\n",
- + (long)status);
- case ERROR_NET_WRITE_FAULT: return STATUS_NET_WRITE_FAULT;
- }
- }
- diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
- index ad5d968..938a733 100644
- --- a/sys/nfs41sys_symlink.c
- +++ b/sys/nfs41sys_symlink.c
- @@ -148,8 +148,9 @@ NTSTATUS map_symlink_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_symlink_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long)status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index aff160d..f79712e 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -214,7 +214,7 @@ NTSTATUS handle_upcall(
- NTSTATUS code;
- code = GetExceptionCode();
- print_error("handle_upcall: Call to SeImpersonateClientEx() "
- - "failed due to exception 0x%0x\n", (int)code);
- + "failed due to exception 0x%lx\n", (long)code);
- status = STATUS_INTERNAL_ERROR;
- }
- #else
- @@ -222,7 +222,7 @@ NTSTATUS handle_upcall(
- #endif /* NFS41_DRIVER_STABILITY_HACKS */
- if (status != STATUS_SUCCESS) {
- print_error("handle_upcall: "
- - "SeImpersonateClientEx() failed 0x%x\n", status);
- + "SeImpersonateClientEx() failed 0x%lx\n", (long)status);
- goto out;
- }
- @@ -349,8 +349,8 @@ NTSTATUS nfs41_UpcallCreate(
- if (status != STATUS_SUCCESS) {
- print_error("nfs41_UpcallCreate: "
- "SeCreateClientSecurityFromSubjectContext() "
- - "failed with 0x%x\n",
- - status);
- + "failed with 0x%lx\n",
- + (long)status);
- nfs41_upcall_free_updowncall_entry(entry);
- entry = NULL;
- }
- diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
- index 253e050..b153ddb 100644
- --- a/sys/nfs41sys_volinfo.c
- +++ b/sys/nfs41sys_volinfo.c
- @@ -139,8 +139,9 @@ NTSTATUS map_volume_errors(
- case ERROR_INTERNAL_ERROR: return STATUS_INTERNAL_ERROR;
- default:
- print_error("map_volume_errors: "
- - "failed to map windows ERROR_0x%x to NTSTATUS; "
- - "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
- + "failed to map windows ERROR_0x%lx to NTSTATUS; "
- + "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n",
- + (long)status);
- case ERROR_BAD_NET_RESP: return STATUS_INVALID_NETWORK_RESPONSE;
- }
- }
- --
- 2.45.1
- From 719e0fd6a45e9352f6842fe83ca1003bd28a1cc2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 14 Oct 2024 17:28:27 +0200
- Subject: [PATCH 2/3] sys: Fix mutex |fcblistLock| release in
- |enable_caching()|
- Fix mutex |fcblistLock| release in |enable_caching()|
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_driver.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 246ba36..362dc82 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -941,7 +941,8 @@ void enable_caching(
- #endif
- oentry = RxAllocatePoolWithTag(NonPagedPoolNx,
- sizeof(nfs41_fcb_list_entry), NFS41_MM_POOLTAG_OPEN);
- - if (oentry == NULL) return;
- + if (oentry == NULL)
- + goto out_release_fcblistlock;
- oentry->fcb = SrvOpen->pFcb;
- oentry->session = session;
- oentry->nfs41_fobx = nfs41_fobx;
- @@ -950,6 +951,7 @@ void enable_caching(
- InsertTailList(&openlist.head, &oentry->next);
- nfs41_fobx->deleg_type = 0;
- }
- +out_release_fcblistlock:
- ExReleaseFastMutex(&fcblistLock);
- }
- --
- 2.45.1
- From f8ad720d25d090ef1c6a37775191e6a24dafb5f5 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Mon, 14 Oct 2024 17:55:56 +0200
- Subject: [PATCH 3/3] build.vc19: Explicitly use "sha256" for driver signing
- for VS2022 support
- Explicitly use "sha256" for driver signing for VS2022 support
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/nfs41_driver/nfs41_driver.vcxproj | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
- diff --git a/build.vc19/nfs41_driver/nfs41_driver.vcxproj b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- index 4481c16..0af98cd 100644
- --- a/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- +++ b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- @@ -174,6 +174,9 @@
- <Link>
- <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
- </Link>
- + <DriverSign>
- + <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- + </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- @@ -188,6 +191,9 @@
- <Link>
- <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
- </Link>
- + <DriverSign>
- + <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- + </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <ClCompile>
- @@ -230,6 +236,9 @@
- <Link>
- <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
- </Link>
- + <DriverSign>
- + <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- + </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- @@ -244,6 +253,9 @@
- <Link>
- <AdditionalDependencies>$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib\10.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
- </Link>
- + <DriverSign>
- + <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- + </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <FilesToPackage Include="$(TargetPath)" />
- --
- 2.45.1
msnfs41client: Patches for debug output, fcblistlock locking+VS2022 driver test signing, 2024-10-14
Posted by Anonymous on Mon 14th Oct 2024 18:15
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.