Re: [PATCH] Version 8 (2.6.23) Smack: Simplified Mandatory Access Control Kernel

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Al Viro <viro@...>, Casey Schaufler <casey@...>
Cc: <torvalds@...>, <akpm@...>, <linux-security-module@...>, <linux-kernel@...>
Date: Thursday, October 18, 2007 - 4:13 pm

--- Al Viro <viro@ftp.linux.org.uk> wrote:


I assume that swapping the two lines,

	initialized = 1;
 	smk_cipso_doi();

although it looks like it would suffice, isn't really good enough.


Help me understand this:

        if (skp == NULL) {
                skp = kzalloc(sizeof(struct smack_known), GFP_KERNEL);
                if (skp != NULL) {
                        skp->smk_next = smack_known;
                        strncpy(skp->smk_known, smack, SMK_MAXLEN);
                        skp->smk_secid = smack_next_secid++;
                        skp->smk_cipso = NULL;
                        spin_lock_init(&skp->smk_cipsolock);
                        smack_known = skp;
                }
        }

CPU1 sets smk_next to smack_known. 
CPU1 fills in the rest of the entry.
CPU1 sets smack_known to skp (the entry).

CPU2 will either see the old value for smack_known,
in which case this entry isn't actually on the list yet,
or it will see the new value in smack_known. Since smk_next
is set before the entry is added to the list, it seems that
the scenario you've outlined shouldn't happen. I assume then
that you're refering to a case where the memory seen by the
two CPUs doesn't match. That still wouldn't account for the
"single entry list" notion. If CPU2 sees anything in smk_next
it should be the old smack_known.



Casey Schaufler
casey@schaufler-ca.com
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Smackv8: Omit non-cipso labels in cipso_seq_start, Ahmed S. Darwish, (Sat Oct 20, 9:40 pm)
[PATCH] Smackv8: Safe lockless {cipso,load} read operation, Ahmed S. Darwish, (Sat Oct 20, 10:25 pm)
Re: [PATCH] Version 8 (2.6.23) Smack: Simplified Mandatory A..., Casey Schaufler, (Thu Oct 18, 4:13 pm)