pub struct LandlockScope(/* private fields */);Expand description
Portées Landlock (cf. linux/landlock.h), ABI v6+ (Linux 6.12).
§Ce que le scoping borne, et que rien d’autre ne bornait
Ce ne sont pas des droits par chemin. Ils ne disent pas ce qu’on a le droit de faire sur telle ressource, mais jusqu’où un domaine peut atteindre en dehors de lui-même. Deux voies latérales, précisément celles qu’aucune règle de fichier ne pouvait voir :
- un socket UNIX abstrait n’a pas de chemin — il vit dans un espace de noms à part, sans entrée de système de fichiers. Aucune règle Landlock de fichier ne pouvait donc l’atteindre : deux processus confinés séparément pouvaient dialoguer sans que leur cage en sache rien ;
- un signal ne traverse aucun descripteur et ne touche aucun chemin.
| Bit | Depuis | Ce qui devient interdit |
|---|---|---|
ABSTRACT_UNIX_SOCKET | Landlock v6 (Linux 6.12) | se connecter à un socket UNIX abstrait créé hors du domaine |
SIGNAL | Landlock v6 (Linux 6.12) | envoyer un signal à un processus hors du domaine |
§La direction compte
La borne est sortante : elle empêche le processus confiné d’atteindre l’extérieur, et non l’extérieur de l’atteindre. Un parent non confiné garde donc la main sur son enfant — ce qui est nécessaire, sans quoi un lanceur ne pourrait plus arrêter ce qu’il a lancé.
§À l’intérieur du domaine, rien ne change
Deux processus du même domaine continuent de se joindre et de se signaler. Le scoping isole des domaines les uns des autres, il ne fragmente pas un domaine.
Comme pour LandlockAccessFs et LandlockAccessNet, demander un bit que le noyau
ne connaît pas fait échouer la création du ruleset : interroger
landlock_supported_abi() avant de composer.
Implementations§
Source§impl LandlockScope
impl LandlockScope
Sourcepub const ABSTRACT_UNIX_SOCKET: Self
pub const ABSTRACT_UNIX_SOCKET: Self
Se connecter à un socket UNIX abstrait créé hors du domaine — Landlock v6+.
Source§impl LandlockScope
impl LandlockScope
Sourcepub const fn bits(&self) -> u64
pub const fn bits(&self) -> u64
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u64) -> Option<Self>
pub const fn from_bits(bits: u64) -> Option<Self>
Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u64) -> Self
pub const fn from_bits_truncate(bits: u64) -> Self
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u64) -> Self
pub const fn from_bits_retain(bits: u64) -> Self
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Whether any set bits in other are also set in self.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether all set bits in other are also set in self.
Sourcepub fn remove(&mut self, other: Self)
pub fn remove(&mut self, other: Self)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: Self)
pub fn toggle(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The bitwise and (&) of the bits in self and other.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The bitwise or (|) of the bits in self and other.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
The bitwise negation (!) of the bits in self, truncating the result.
Source§impl LandlockScope
impl LandlockScope
Sourcepub const fn iter(&self) -> Iter<LandlockScope>
pub const fn iter(&self) -> Iter<LandlockScope>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<LandlockScope>
pub const fn iter_names(&self) -> IterNames<LandlockScope>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
Source§impl Binary for LandlockScope
impl Binary for LandlockScope
Source§impl BitAnd for LandlockScope
impl BitAnd for LandlockScope
Source§impl BitAndAssign for LandlockScope
impl BitAndAssign for LandlockScope
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
The bitwise and (&) of the bits in self and other.
Source§impl BitOr for LandlockScope
impl BitOr for LandlockScope
Source§fn bitor(self, other: LandlockScope) -> Self
fn bitor(self, other: LandlockScope) -> Self
The bitwise or (|) of the bits in self and other.
Source§type Output = LandlockScope
type Output = LandlockScope
| operator.Source§impl BitOrAssign for LandlockScope
impl BitOrAssign for LandlockScope
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
The bitwise or (|) of the bits in self and other.
Source§impl BitXor for LandlockScope
impl BitXor for LandlockScope
Source§impl BitXorAssign for LandlockScope
impl BitXorAssign for LandlockScope
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in self and other.
Source§impl Clone for LandlockScope
impl Clone for LandlockScope
Source§fn clone(&self) -> LandlockScope
fn clone(&self) -> LandlockScope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LandlockScope
Source§impl Debug for LandlockScope
impl Debug for LandlockScope
Source§impl Default for LandlockScope
impl Default for LandlockScope
Source§fn default() -> LandlockScope
fn default() -> LandlockScope
impl Eq for LandlockScope
Source§impl Extend<LandlockScope> for LandlockScope
impl Extend<LandlockScope> for LandlockScope
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for LandlockScope
impl Flags for LandlockScope
Source§const FLAGS: &'static [Flag<LandlockScope>]
const FLAGS: &'static [Flag<LandlockScope>]
Source§fn from_bits_retain(bits: u64) -> LandlockScope
fn from_bits_retain(bits: u64) -> LandlockScope
§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS].§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.§fn set(&mut self, other: Self, value: bool)where
Self: Sized,
fn set(&mut self, other: Self, value: bool)where
Self: Sized,
Flags::insert] when value is true or [Flags::remove] when value is false.§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl FromIterator<LandlockScope> for LandlockScope
impl FromIterator<LandlockScope> for LandlockScope
Source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
The bitwise or (|) of the bits in each flags value.
Source§impl Hash for LandlockScope
impl Hash for LandlockScope
Source§impl IntoIterator for LandlockScope
impl IntoIterator for LandlockScope
Source§impl LowerHex for LandlockScope
impl LowerHex for LandlockScope
Source§impl Not for LandlockScope
impl Not for LandlockScope
Source§impl Octal for LandlockScope
impl Octal for LandlockScope
Source§impl PartialEq for LandlockScope
impl PartialEq for LandlockScope
Source§impl PublicFlags for LandlockScope
impl PublicFlags for LandlockScope
impl StructuralPartialEq for LandlockScope
Source§impl Sub for LandlockScope
impl Sub for LandlockScope
Source§fn sub(self, other: Self) -> Self
fn sub(self, other: Self) -> Self
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Source§type Output = LandlockScope
type Output = LandlockScope
- operator.Source§impl SubAssign for LandlockScope
impl SubAssign for LandlockScope
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.