History

Merge tag 'landlock-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux

Pull landlock updates from Mickaël Salaün: "This brings ioctl control to Landlock, contributed by Günther Noack. This also adds him as a Landlock reviewer, and fixes an issue in the sample" * tag 'landlock-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux: MAINTAINERS: Add Günther Noack as Landlock reviewer fs/ioctl: Add a comment to keep the logic in sync with LSM policies MAINTAINERS: Notify Landlock maintainers about changes to fs/ioctl.c landlock: Document IOCTL support samples/landlock: Add support for LANDLOCK_ACCESS_FS_IOCTL_DEV selftests/landlock: Exhaustive test for the IOCTL allow-list selftests/landlock: Check IOCTL restrictions for named UNIX domain sockets selftests/landlock: Test IOCTLs on named pipes selftests/landlock: Test ioctl(2) and ftruncate(2) with open(O_PATH) selftests/landlock: Test IOCTL with memfds selftests/landlock: Test IOCTL support landlock: Add IOCTL access right for character and block devices samples/landlock: Fix incorrect free in populate_ruleset_net

Linus Torvalds committed 2 years ago

Commit 2fc0e782 parents 89721e3 5bf9e5710 files · +811 −46Browse files

Showing the changes to include/uapi/linux (1 of 10 files). Show all

Unified · Split

include/uapi/linux/landlock.h+30−8
@@ -128,7 +128,7 @@ struct landlock_net_port_attr { · 127 unmodified lines
128 * files and directories. Files or directories opened before the sandboxing128 * files and directories. Files or directories opened before the sandboxing
129 * are not subject to these restrictions.129 * are not subject to these restrictions.
130 *130 *
131 * A file can only receive these access rights:131 * The following access rights apply only to files:
132 *132 *
133 * - %LANDLOCK_ACCESS_FS_EXECUTE: Execute a file.133 * - %LANDLOCK_ACCESS_FS_EXECUTE: Execute a file.
134 * - %LANDLOCK_ACCESS_FS_WRITE_FILE: Open a file with write access. Note that134 * - %LANDLOCK_ACCESS_FS_WRITE_FILE: Open a file with write access. Note that
@@ -138,12 +138,13 @@ struct landlock_net_port_attr { · 3 unmodified lines
138 * - %LANDLOCK_ACCESS_FS_READ_FILE: Open a file with read access.138 * - %LANDLOCK_ACCESS_FS_READ_FILE: Open a file with read access.
139 * - %LANDLOCK_ACCESS_FS_TRUNCATE: Truncate a file with :manpage:`truncate(2)`,139 * - %LANDLOCK_ACCESS_FS_TRUNCATE: Truncate a file with :manpage:`truncate(2)`,
140 * :manpage:`ftruncate(2)`, :manpage:`creat(2)`, or :manpage:`open(2)` with140 * :manpage:`ftruncate(2)`, :manpage:`creat(2)`, or :manpage:`open(2)` with
141 * ``O_TRUNC``. Whether an opened file can be truncated with141 * ``O_TRUNC``. This access right is available since the third version of the
142 * :manpage:`ftruncate(2)` is determined during :manpage:`open(2)`, in the142 * Landlock ABI.
143 * same way as read and write permissions are checked during143 *
144 * :manpage:`open(2)` using %LANDLOCK_ACCESS_FS_READ_FILE and144 * Whether an opened file can be truncated with :manpage:`ftruncate(2)` or used
145 * %LANDLOCK_ACCESS_FS_WRITE_FILE. This access right is available since the145 * with `ioctl(2)` is determined during :manpage:`open(2)`, in the same way as
146 * third version of the Landlock ABI.146 * read and write permissions are checked during :manpage:`open(2)` using
147 * %LANDLOCK_ACCESS_FS_READ_FILE and %LANDLOCK_ACCESS_FS_WRITE_FILE.
147 *148 *
148 * A directory can receive access rights related to files or directories. The149 * A directory can receive access rights related to files or directories. The
149 * following access right is applied to the directory itself, and the150 * following access right is applied to the directory itself, and the
@@ -198,13 +199,33 @@ struct landlock_net_port_attr { · 48 unmodified lines
198 * If multiple requirements are not met, the ``EACCES`` error code takes199 * If multiple requirements are not met, the ``EACCES`` error code takes
199 * precedence over ``EXDEV``.200 * precedence over ``EXDEV``.
200 *201 *
202 * The following access right applies both to files and directories:
203 *
204 * - %LANDLOCK_ACCESS_FS_IOCTL_DEV: Invoke :manpage:`ioctl(2)` commands on an opened
205 * character or block device.
206 *
207 * This access right applies to all `ioctl(2)` commands implemented by device
208 * drivers. However, the following common IOCTL commands continue to be
209 * invokable independent of the %LANDLOCK_ACCESS_FS_IOCTL_DEV right:
210 *
211 * * IOCTL commands targeting file descriptors (``FIOCLEX``, ``FIONCLEX``),
212 * * IOCTL commands targeting file descriptions (``FIONBIO``, ``FIOASYNC``),
213 * * IOCTL commands targeting file systems (``FIFREEZE``, ``FITHAW``,
214 * ``FIGETBSZ``, ``FS_IOC_GETFSUUID``, ``FS_IOC_GETFSSYSFSPATH``)
215 * * Some IOCTL commands which do not make sense when used with devices, but
216 * whose implementations are safe and return the right error codes
217 * (``FS_IOC_FIEMAP``, ``FICLONE``, ``FICLONERANGE``, ``FIDEDUPERANGE``)
218 *
219 * This access right is available since the fifth version of the Landlock
220 * ABI.
221 *
201 * .. warning::222 * .. warning::
202 *223 *
203 * It is currently not possible to restrict some file-related actions224 * It is currently not possible to restrict some file-related actions
204 * accessible through these syscall families: :manpage:`chdir(2)`,225 * accessible through these syscall families: :manpage:`chdir(2)`,
205 * :manpage:`stat(2)`, :manpage:`flock(2)`, :manpage:`chmod(2)`,226 * :manpage:`stat(2)`, :manpage:`flock(2)`, :manpage:`chmod(2)`,
206 * :manpage:`chown(2)`, :manpage:`setxattr(2)`, :manpage:`utime(2)`,227 * :manpage:`chown(2)`, :manpage:`setxattr(2)`, :manpage:`utime(2)`,
207 * :manpage:`ioctl(2)`, :manpage:`fcntl(2)`, :manpage:`access(2)`.228 * :manpage:`fcntl(2)`, :manpage:`access(2)`.
208 * Future Landlock evolutions will enable to restrict them.229 * Future Landlock evolutions will enable to restrict them.
209 */230 */
210/* clang-format off */231/* clang-format off */
@@ -223,6 +244,7 @@ struct landlock_net_port_attr { · 12 unmodified lines
223#define LANDLOCK_ACCESS_FS_MAKE_SYM (1ULL << 12)244#define LANDLOCK_ACCESS_FS_MAKE_SYM (1ULL << 12)
224#define LANDLOCK_ACCESS_FS_REFER (1ULL << 13)245#define LANDLOCK_ACCESS_FS_REFER (1ULL << 13)
225#define LANDLOCK_ACCESS_FS_TRUNCATE (1ULL << 14)246#define LANDLOCK_ACCESS_FS_TRUNCATE (1ULL << 14)
247#define LANDLOCK_ACCESS_FS_IOCTL_DEV (1ULL << 15)
226/* clang-format on */248/* clang-format on */
227 249
228/**250/**

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