summaryrefslogtreecommitdiff
path: root/debian/patches/0026-XXX-i-broke-rpctrace.patch
blob: 1889ec2f9cfbef755790ca8be3dde9a28f82bd45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From eab5bb92d45ad645c9d1a5b851d2d17774689621 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Thu, 28 Nov 2013 12:21:49 +0100
Subject: [PATCH hurd 26/29] XXX i broke rpctrace

If we cannot get this to work with protected payloads, we can always
add a switch to libports to disable the optimization.
---
 utils/rpctrace.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index c954e51..18fae83 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1219,7 +1219,25 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
   /* Look up our record for the receiving port.  There is no need to check
      the class, because our port bucket only ever contains one class of
      ports (traced_class).  */
-  info = ports_lookup_port (traced_bucket, inp->msgh_local_port, 0);
+
+  if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == MACH_MSG_TYPE_PROTECTED_PAYLOAD)
+    {
+      info = (struct traced_info *) inp->msgh_protected_payload;
+      if (info && info->pi.bucket == traced_bucket)
+	{
+	  ports_port_ref (info);
+	  /* Undo the protected payload optimization for our tracee.  */
+	  inp->msgh_bits = MACH_MSGH_BITS (
+	    MACH_MSGH_BITS_REMOTE (inp->msgh_bits),
+	    MACH_MSG_TYPE_PORT_SEND); /* XXX we cannot know the real type :( */
+	  inp->msgh_local_port = ports_payload_get_name (info);
+	}
+      else
+	info = NULL;
+    }
+  else
+    info = ports_lookup_port (traced_bucket, inp->msgh_local_port, 0);
+
   assert (info);
 
   /* A notification message from the kernel appears to have been sent
-- 
2.1.3