# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1168063801 -32400 # Node ID 504addd06eeda65eb625b2969fb1d26cde7eb62b # Parent 9865145e53eb02ddc2e2792f80bb7d54bc754a65 PATCHNAME: grow_granttable_acm Signed-off-by: Isaku Yamahata diff -r 9865145e53eb -r 504addd06eed xen/acm/acm_simple_type_enforcement_hooks.c --- a/xen/acm/acm_simple_type_enforcement_hooks.c Fri Jan 05 18:17:36 2007 +0000 +++ b/xen/acm/acm_simple_type_enforcement_hooks.c Sat Jan 06 15:10:01 2007 +0900 @@ -234,18 +234,21 @@ ste_init_state(struct acm_ste_policy_buf } } /* b) check for grant table conflicts on shared pages */ - if ((*pd)->grant_table->shared == NULL) { + spin_lock(&(*pd)->grant_table->lock); + if ((*pd)->grant_table->nr_grant_entries == 0) { + spin_unlock(&(*pd)->grant_table->lock); printkd("%s: Grant ... sharing for domain %x not setup!\n", __func__, (*pd)->domain_id); continue; } - for ( i = 0; i < NR_GRANT_ENTRIES; i++ ) { - sha_copy = (*pd)->grant_table->shared[i]; + for ( i = 0; i < (*pd)->grant_table->nr_grant_entries; i++ ) { + sha_copy = *gnttab_get_entry((*pd)->grant_table, i); if ( sha_copy.flags ) { printkd("%s: grant dom (%hu) SHARED (%d) flags:(%hx) dom:(%hu) frame:(%lx)\n", __func__, (*pd)->domain_id, i, sha_copy.flags, sha_copy.domid, (unsigned long)sha_copy.frame); rdomid = sha_copy.domid; if ((rdom = find_domain_by_id(rdomid)) == NULL) { + spin_unlock(&(*pd)->grant_table->lock); printkd("%s: domain not found ERROR!\n", __func__); goto out; }; @@ -255,6 +258,7 @@ ste_init_state(struct acm_ste_policy_buf ste_rssidref = ste_rssid->ste_ssidref; put_domain(rdom); if (!have_common_type(ste_ssidref, ste_rssidref)) { + spin_unlock(&(*pd)->grant_table->lock); printkd("%s: Policy violation in grant table sharing domain %x -> domain %x.\n", __func__, (*pd)->domain_id, rdomid); goto out; @@ -262,6 +266,7 @@ ste_init_state(struct acm_ste_policy_buf } } } + spin_unlock(&(*pd)->grant_table->lock); violation = 0; out: read_unlock(&domlist_lock);