Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andi Kleen
Date: Sunday, August 12, 2007 - 2:36 pm

On Sun, Aug 12, 2007 at 10:48:05AM -0700, Casey Schaufler wrote:

You don't necessarily need more list management if you don't 
plan to remove entries, but just replace them.

e.g. what could work to atomically replace is: 

- Make the buffer a pointer to an allocated buffer that also
contains a struct rcu_head.
- Reader: Does rcu_read_lock() around list walk (that just disables
preemption on preemptible kernels and is otherwise a nop).
Also uses rcu_reference for reading the pointer. 
- Writer: Continues using the mutex to protect against other writers.
When changing an entry allocate a new buffer + rcu_head. Initialize
buffer. Replace pointer.  Free old buffer using call_rcu() 

The RCU would just make sure the buffer is not freed while other
CPUs are still accessing it. It also means they can use stale
rules for a time, but it is a strictly bounded time
(bounded to max time walking the list plus max time any interrupt
handlers inbetween run [admittedly that can be very long in theory, 
but it's all logically only a single rule check])

-Andi

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Sat Aug 11, 10:57 am)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Arjan van de Ven, (Sat Aug 11, 12:12 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Sat Aug 11, 12:56 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Sun Aug 12, 10:48 am)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Sun Aug 12, 12:41 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Sun Aug 12, 12:50 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Andi Kleen, (Sun Aug 12, 2:36 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Valdis.Kletnieks, (Sun Aug 19, 2:12 pm)
Re: [PATCH] Smack: Simplified Mandatory Access Control Kernel, Casey Schaufler, (Wed Aug 22, 11:47 am)