Linux Kernel Architecture

(Jacob Rumans) #1

Extended Attributes and


Access Control Lists


Many filesystems provide features that extend thestandard functionality offered by the VFS layer.
It is impossible for the virtual filesystem to providespecific data structures for every feature that can
be imagined — fortunately, there’s lots of room in our imagination, and developers are not exactly
short of new ideas. Additional features that go beyond the standardUnixfile model often require
an extended set of attributes associated with everyfilesystem object. What the kernel can provide,
however, is a framework that allows filesystem-specific extensions.Extended attributes(xattrs) are
(more or less) arbitrary attributes that can be associated with a file. Since usually every file will
possess only a subset of all possible extended attributes, the attributes are stored outside the regular
inode data structure to avoid increasing its size in memory and wasting disk space. This allows a
really generic set of attributes without any significant impact on filesystem performance or disk
space requirements.

One use of extended attributes is the implementation ofaccess control liststhat extend theUnix-style
permission model: They allow implementation of finer-grained access rights by not only using the
concept of the classesuser,group,andothers, but also by associating an explicit list of users and their
allowed operations on the file. Such lists fit naturally into the extended attribute model. Another
use of extended attributes is to providelabeling informationfor SE-Linux.

11.1 Extended Attributes


From the filesystem user’s point of view, an extended attribute is a name/value pair associated
with objects in the filesystem. While the name is given by a regular string, the kernel imposes no
restrictions on the contents of the value. It can be atext string, but may contain arbitrary binary data
as well. An attribute may be defined or not (this is the case if no attribute was associated with a file).
If it is defined, it may or may not have a value. No one can blame the kernel for not being liberal in
this respect.
Free download pdf