Skip to main content

RestrictionSet

Struct RestrictionSet 

Source
pub struct RestrictionSet { /* private fields */ }
Expand description

Liste blanche de ce qu’un ring confiné pourra faire (décision S3). Default-deny : ce qui n’est pas explicitement autorisé est refusé par le kernel. Construite par combinateurs, puis passée à IoUringBuilder::restrict via as_slice.

Default = ensemble vide : aucune restriction (le ring n’est pas confiné). Le confinement commence dès la première entrée (allow_* / require_*).

Implementations§

Source§

impl RestrictionSet

Source

pub fn new() -> Self

Ensemble vide (équivaut à Default).

Source

pub fn allow_op(self, op: IoUringOpcode) -> Self

Autorise un opcode de soumission (RESTRICTION_SQE_OP). Dès le premier allow_op, seuls les opcodes listés passent (default-deny).

Source

pub fn allow_register(self, op: RegisterOp) -> Self

Autorise un register opcode (RESTRICTION_REGISTER_OP).

Source

pub fn allow_sqe_flags(self, flags: SqeFlagSet) -> Self

Déclare les drapeaux SQE autorisés (RESTRICTION_SQE_FLAGS_ALLOWED) : un SQE ne peut porter que des drapeaux de cet ensemble.

Source

pub fn require_sqe_flags(self, flags: SqeFlagSet) -> Self

Déclare les drapeaux SQE requis sur chaque soumission (RESTRICTION_SQE_FLAGS_REQUIRED) : un SQE sans ces drapeaux est refusé. Combiné à SqeFlagSet::fixed_file, impose l’usage de FD enregistrés (interdit les FD bruts — moindre privilège).

Source

pub fn from_entitlements<I>(allowed_ops: I) -> Self
where I: IntoIterator<Item = IoUringOpcode>,

Point d’intégration couche 5 (ADR-010). Un composant de confiance (air-launchd/air-trust) traduit les entitlements signés du manifeste d’un .airservice/.airapp en l’ensemble d’opcodes que le ring pourra émettre, puis appelle ceci. La politique (quel entitlement ⇒ quels opcodes) vit en couche 5 ; la couche 0 ne fournit que le mécanisme default-deny. Équivaut à un allow_op répété sur allowed_ops.

Source

pub fn as_slice(&self) -> &[Restriction]

Vue des restrictions, à passer à IoUringBuilder::restrict.

Source

pub fn len(&self) -> usize

Nombre de restrictions accumulées.

Source

pub fn is_empty(&self) -> bool

true si aucune restriction (ring non confiné).

Trait Implementations§

Source§

impl Clone for RestrictionSet

Source§

fn clone(&self) -> RestrictionSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RestrictionSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RestrictionSet

Source§

fn default() -> RestrictionSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.