[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 59/64: utils/rpctrace: make `trace_and_forward' payload-aware
From: |
Samuel Thibault |
Subject: |
[hurd] 59/64: utils/rpctrace: make `trace_and_forward' payload-aware |
Date: |
Wed, 10 Dec 2014 15:17:08 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 02ae7e436efa33b11227c251eb9bb3a036082fe1
Author: Justus Winter <address@hidden>
Date: Thu Nov 28 12:21:49 2013 +0100
utils/rpctrace: make `trace_and_forward' payload-aware
As the protected payloads were retrofitted into the Mach message
format, the local port type is lost.
* utils/rpctrace.c (is_notification): New function
(trace_and_forward): Recover the original local port type.
---
utils/rpctrace.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index c954e51..62d3c87 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1195,6 +1195,16 @@ wrap_new_task (mach_msg_header_t *inp, struct req_info
*req)
ports_port_deref (task_wrapper1);
}
+/* Returns true if the given message is a Mach notification. */
+static inline int
+is_notification (const mach_msg_header_t *InHeadP)
+{
+ int msgh_id = InHeadP->msgh_id - 64;
+ if ((msgh_id > 8) || (msgh_id < 0))
+ return 0;
+ return 1;
+}
+
int
trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp)
{
@@ -1219,7 +1229,24 @@ 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 = ports_lookup_payload (traced_bucket, inp->msgh_protected_payload,
+ NULL);
+ if (info)
+ {
+ /* Undo the protected payload optimization. */
+ inp->msgh_bits = MACH_MSGH_BITS (
+ MACH_MSGH_BITS_REMOTE (inp->msgh_bits),
+ is_notification (inp)? MACH_MSG_TYPE_MOVE_SEND_ONCE: info->type)
+ | MACH_MSGH_BITS_OTHER (inp->msgh_bits);
+ inp->msgh_local_port = ports_payload_get_name (info);
+ }
+ }
+ else
+ info = ports_lookup_port (traced_bucket, inp->msgh_local_port, NULL);
+
assert (info);
/* A notification message from the kernel appears to have been sent
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 34/64: Revert "random: fix a receiver lookup", (continued)
- [hurd] 34/64: Revert "random: fix a receiver lookup", Samuel Thibault, 2014/12/10
- [hurd] 61/64: Fix mode of nodes created with mkfile, Samuel Thibault, 2014/12/10
- [hurd] 62/64: include: don't install nonexistent refcount.h, Samuel Thibault, 2014/12/10
- [hurd] 37/64: libports: add `ports_lookup_payload' and `ports_payload_get_name', Samuel Thibault, 2014/12/10
- [hurd] 44/64: auth: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 45/64: console: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 30/64: libpager: make the request queue more memory-efficient, Samuel Thibault, 2014/12/10
- [hurd] 63/64: fakeroot: Fix initializing default faked field of nodes, Samuel Thibault, 2014/12/10
- [hurd] 60/64: hurd: add intranpayload functions to all hurd types, Samuel Thibault, 2014/12/10
- [hurd] 33/64: Add atomicity support to fshelp_acquire_lock, Samuel Thibault, 2014/12/10
- [hurd] 59/64: utils/rpctrace: make `trace_and_forward' payload-aware,
Samuel Thibault <=
- [hurd] 53/64: term: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 57/64: trans/streamio: make the translator payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 64/64: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/12/10
- [hurd] 04/64: Fix mach-defpager's kalloc values, Samuel Thibault, 2014/12/10
- [hurd] 06/64: utils/rpctrace: fix crash while printing messages, Samuel Thibault, 2014/12/10
- [hurd] 03/64: Avoid hitting VM_MAX_ADDRESS, Samuel Thibault, 2014/12/10
- [hurd] 05/64: Make procfs appear in /proc/mounts, Samuel Thibault, 2014/12/10
- [hurd] 08/64: Fix recording complete path of passive relative translators, Samuel Thibault, 2014/12/10
- [hurd] 07/64: Let pty readers always read end of writer output, Samuel Thibault, 2014/12/10
- [hurd] 54/64: trans/fakeroot: make the demuxer payload-aware, Samuel Thibault, 2014/12/10