summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-11-18 09:16:17 +0100
committerNeal H. Walfield <neal@gnu.org>2008-11-18 09:16:17 +0100
commit0308062ac3cf091e50afc739ff2e5e39e7c5faad (patch)
treef70b25f11b8af548c882676a4774873d3aefc7c3 /hurd
parente8cee2af7063c37b32457d9af9d2b2f9152d5f1d (diff)
Correctly detect type mismatches when copying capabilities.
2008-11-18 Neal H. Walfield <neal@gnu.org> * cap.h (cap_copy_x): Correctly detect type mismatches.
Diffstat (limited to 'hurd')
-rw-r--r--hurd/ChangeLog4
-rw-r--r--hurd/cap.h12
2 files changed, 10 insertions, 6 deletions
diff --git a/hurd/ChangeLog b/hurd/ChangeLog
index 72ac590..312aac4 100644
--- a/hurd/ChangeLog
+++ b/hurd/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-18 Neal H. Walfield <neal@gnu.org>
+
+ * cap.h (cap_copy_x): Correctly detect type mismatches.
+
2008-11-14 Neal H. Walfield <neal@gnu.org>
* rpc.h: Include <l4/space.h>.
diff --git a/hurd/cap.h b/hurd/cap.h
index d6b2151..eae17db 100644
--- a/hurd/cap.h
+++ b/hurd/cap.h
@@ -636,6 +636,10 @@ cap_copy_x (activity_t activity,
gbits = CAP_GUARD_BITS (&source);
}
+ int type = source.type;
+ if ((flags & CAP_COPY_WEAKEN))
+ type = cap_type_weaken (type);
+
#ifdef RM_INTERN
/* Changing a capability can change how addresses are translated.
In this case, we need to shoot down all cached translations. */
@@ -668,9 +672,7 @@ cap_copy_x (activity_t activity,
changes_translation = true;
}
- if (target->type != source.type
- && ! ((flags & CAP_COPY_WEAKEN)
- && cap_type_weaken (source.type) == target->type))
+ if (type != target->type)
{
debug (5, "Type changed, invalidating translation");
changes_translation = true;
@@ -704,9 +706,7 @@ cap_copy_x (activity_t activity,
*target = source;
target->addr_trans = properties.addr_trans;
-
- if ((flags & CAP_COPY_WEAKEN))
- target->type = cap_type_weaken (target->type);
+ target->type = type;
if ((flags & CAP_COPY_DISCARDABLE_SET))
target->discardable = properties.policy.discardable;