History

landlock: Clarify documentation for the LANDLOCK_ACCESS_FS_REFER right

Clarify the "refer" documentation by splitting up a big paragraph of text. - Call out specifically that the denial by default applies to ABI v1 as well. - Turn the three additional constraints for link/rename operations into bullet points, to give it more structure.

Günther Noack committed 3 years ago

Commit ed35e2f1 parent 1c1ea1c1 file · +31 −15Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/landlock.h+31−15
@@ -130,21 +130,37 @@ struct landlock_path_beneath_attr { · 129 unmodified lines
130 * - %LANDLOCK_ACCESS_FS_MAKE_BLOCK: Create (or rename or link) a block device.130 * - %LANDLOCK_ACCESS_FS_MAKE_BLOCK: Create (or rename or link) a block device.
131 * - %LANDLOCK_ACCESS_FS_MAKE_SYM: Create (or rename or link) a symbolic link.131 * - %LANDLOCK_ACCESS_FS_MAKE_SYM: Create (or rename or link) a symbolic link.
132 * - %LANDLOCK_ACCESS_FS_REFER: Link or rename a file from or to a different132 * - %LANDLOCK_ACCESS_FS_REFER: Link or rename a file from or to a different
133 * directory (i.e. reparent a file hierarchy). This access right is133 * directory (i.e. reparent a file hierarchy).
134 * available since the second version of the Landlock ABI. This is also the134 *
135 * only access right which is always considered handled by any ruleset in135 * This access right is available since the second version of the Landlock
136 * such a way that reparenting a file hierarchy is always denied by default.136 * ABI.
137 * To avoid privilege escalation, it is not enough to add a rule with this137 *
138 * access right. When linking or renaming a file, the destination directory138 * This is the only access right which is denied by default by any ruleset,
139 * hierarchy must also always have the same or a superset of restrictions of139 * even if the right is not specified as handled at ruleset creation time.
140 * the source hierarchy. If it is not the case, or if the domain doesn't140 * The only way to make a ruleset grant this right is to explicitly allow it
141 * handle this access right, such actions are denied by default with errno141 * for a specific directory by adding a matching rule to the ruleset.
142 * set to ``EXDEV``. Linking also requires a ``LANDLOCK_ACCESS_FS_MAKE_*``142 *
143 * access right on the destination directory, and renaming also requires a143 * In particular, when using the first Landlock ABI version, Landlock will
144 * ``LANDLOCK_ACCESS_FS_REMOVE_*`` access right on the source's (file or144 * always deny attempts to reparent files between different directories.
145 * directory) parent. Otherwise, such actions are denied with errno set to145 *
146 * ``EACCES``. The ``EACCES`` errno prevails over ``EXDEV`` to let user space146 * In addition to the source and destination directories having the
147 * efficiently deal with an unrecoverable error.147 * %LANDLOCK_ACCESS_FS_REFER access right, the attempted link or rename
148 * operation must meet the following constraints:
149 *
150 * * The reparented file may not gain more access rights in the destination
151 * directory than it previously had in the source directory. If this is
152 * attempted, the operation results in an ``EXDEV`` error.
153 *
154 * * When linking or renaming, the ``LANDLOCK_ACCESS_FS_MAKE_*`` right for the
155 * respective file type must be granted for the destination directory.
156 * Otherwise, the operation results in an ``EACCES`` error.
157 *
158 * * When renaming, the ``LANDLOCK_ACCESS_FS_REMOVE_*`` right for the
159 * respective file type must be granted for the source directory. Otherwise,
160 * the operation results in an ``EACCES`` error.
161 *
162 * If multiple requirements are not met, the ``EACCES`` error code takes
163 * precedence over ``EXDEV``.
148 *164 *
149 * .. warning::165 * .. warning::
150 *166 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t