pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for kernel/daemon memory mappings+debug output, 2024-04-10
Posted by Anonymous on Wed 10th Apr 2024 14:41
raw | new post

  1. From 858d15ccf6320483af1beecfa24337922e7c2864 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Sat, 6 Apr 2024 19:38:01 +0200
  4. Subject: [PATCH 1/2] sys: Improve debug messages in case of |MmMap*()|
  5.  failures/exceptions
  6.  
  7. Improve debug messages in case of |MmMap*()| failures/exceptions
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11.  sys/nfs41_driver.c | 26 ++++++++++++++++++--------
  12.  1 file changed, 18 insertions(+), 8 deletions(-)
  13.  
  14. diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
  15. index 2d06e7d..64913d3 100644
  16. --- a/sys/nfs41_driver.c
  17. +++ b/sys/nfs41_driver.c
  18. @@ -752,13 +752,17 @@ NTSTATUS marshal_nfs41_open(
  19.                  MmMapLockedPagesSpecifyCache(entry->u.Open.EaMdl,
  20.                      UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  21.              if (entry->u.Open.EaBuffer == NULL) {
  22. -                print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
  23. +                print_error("marshal_nfs41_open: "
  24. +                    "MmMapLockedPagesSpecifyCache() failed to "
  25. +                    "map pages\n");
  26.                  status = STATUS_INSUFFICIENT_RESOURCES;
  27.                  goto out;
  28.              }
  29.          }
  30.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  31. -        print_error("Call to MmMapLocked failed due to exception 0x%x\n", GetExceptionCode());
  32. +        print_error("marshal_nfs41_open: Call to "
  33. +            "MmMapLockedPagesSpecifyCache() failed "
  34. +            "due to exception 0x%x\n", (int)GetExceptionCode());
  35.          status = STATUS_ACCESS_DENIED;
  36.          goto out;
  37.      }
  38. @@ -823,14 +827,17 @@ NTSTATUS marshal_nfs41_rw(
  39.              MmMapLockedPagesSpecifyCache(entry->u.ReadWrite.MdlAddress,
  40.                  UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  41.          if (entry->buf == NULL) {
  42. -            print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
  43. +            print_error("marshal_nfs41_rw: "
  44. +                "MmMapLockedPagesSpecifyCache() failed to map pages\n");
  45.              status = STATUS_INSUFFICIENT_RESOURCES;
  46.              goto out;
  47.          }
  48.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  49.          NTSTATUS code;
  50.          code = GetExceptionCode();
  51. -        print_error("Call to MmMapLocked failed due to exception 0x%x\n", code);
  52. +        print_error("marshal_nfs41_rw: Call to "
  53. +            "MmMapLockedPagesSpecifyCache() failed due to "
  54. +            "exception 0x%x\n", (int)code);
  55.          status = STATUS_ACCESS_DENIED;
  56.          goto out;
  57.      }
  58. @@ -1005,14 +1012,17 @@ NTSTATUS marshal_nfs41_dirquery(
  59.              MmMapLockedPagesSpecifyCache(entry->u.QueryFile.mdl,
  60.                  UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  61.          if (entry->u.QueryFile.mdl_buf == NULL) {
  62. -            print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
  63. +            print_error("marshal_nfs41_dirquery: "
  64. +                "MmMapLockedPagesSpecifyCache() failed to map pages\n");
  65.              status = STATUS_INSUFFICIENT_RESOURCES;
  66.              goto out;
  67.          }
  68.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  69.          NTSTATUS code;
  70.          code = GetExceptionCode();
  71. -        print_error("Call to MmMapLocked failed due to exception 0x%x\n", code);
  72. +        print_error("marshal_nfs41_dirquery: Call to "
  73. +            "MmMapLockedPagesSpecifyCache() failed "
  74. +            "due to exception 0x%x\n", (int)code);
  75.          status = STATUS_ACCESS_DENIED;
  76.          goto out;
  77.      }
  78. @@ -1747,8 +1757,8 @@ NTSTATUS unmarshal_nfs41_rw(
  79.      } __except(EXCEPTION_EXECUTE_HANDLER) {
  80.          NTSTATUS code;
  81.          code = GetExceptionCode();
  82. -        print_error("Call to MmUnmapLockedPages failed due to"
  83. -            " exception 0x%0x\n", code);
  84. +        print_error("unmarshal_nfs41_rw: Call to MmUnmapLockedPages() "
  85. +            "failed due to exception 0x%0x\n", (int)code);
  86.          status = STATUS_ACCESS_DENIED;
  87.      }
  88.  #endif
  89. --
  90. 2.43.0
  91.  
  92. From 0d38b62a1bd610030f6220b09808e39aa1c731ca Mon Sep 17 00:00:00 2001
  93. From: Roland Mainz <roland.mainz@nrubsig.org>
  94. Date: Sat, 6 Apr 2024 19:40:01 +0200
  95. Subject: [PATCH 2/2] sys: Use |MmCached| instead of |MmNonCached|
  96.  
  97. Use |MmCached| instead of |MmNonCached| for memory mappings.
  98.  
  99. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  100. ---
  101.  sys/nfs41_driver.c | 6 +++---
  102.  1 file changed, 3 insertions(+), 3 deletions(-)
  103.  
  104. diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
  105. index 64913d3..b48f7cc 100644
  106. --- a/sys/nfs41_driver.c
  107. +++ b/sys/nfs41_driver.c
  108. @@ -750,7 +750,7 @@ NTSTATUS marshal_nfs41_open(
  109.          if (entry->u.Open.EaMdl) {
  110.              entry->u.Open.EaBuffer =
  111.                  MmMapLockedPagesSpecifyCache(entry->u.Open.EaMdl,
  112. -                    UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  113. +                    UserMode, MmCached, NULL, TRUE, NormalPagePriority);
  114.              if (entry->u.Open.EaBuffer == NULL) {
  115.                  print_error("marshal_nfs41_open: "
  116.                      "MmMapLockedPagesSpecifyCache() failed to "
  117. @@ -825,7 +825,7 @@ NTSTATUS marshal_nfs41_rw(
  118.  #pragma warning( pop )
  119.          entry->buf =
  120.              MmMapLockedPagesSpecifyCache(entry->u.ReadWrite.MdlAddress,
  121. -                UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  122. +                UserMode, MmCached, NULL, TRUE, NormalPagePriority);
  123.          if (entry->buf == NULL) {
  124.              print_error("marshal_nfs41_rw: "
  125.                  "MmMapLockedPagesSpecifyCache() failed to map pages\n");
  126. @@ -1010,7 +1010,7 @@ NTSTATUS marshal_nfs41_dirquery(
  127.      __try {
  128.          entry->u.QueryFile.mdl_buf =
  129.              MmMapLockedPagesSpecifyCache(entry->u.QueryFile.mdl,
  130. -                UserMode, MmNonCached, NULL, TRUE, NormalPagePriority);
  131. +                UserMode, MmCached, NULL, TRUE, NormalPagePriority);
  132.          if (entry->u.QueryFile.mdl_buf == NULL) {
  133.              print_error("marshal_nfs41_dirquery: "
  134.                  "MmMapLockedPagesSpecifyCache() failed to map pages\n");
  135. --
  136. 2.43.0

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

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




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