From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03A853812F6 for ; Thu, 21 May 2026 16:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779379634; cv=none; b=dNgadO1qgLu8tGSJwWTlXtLjyXCv1S9APwqpDU4NXh06F5qPr8L5u3Uo7gkrPogF/4XjIyi6sgeLCfXw1qeMDhBC8fJmFMT9gKBBh7pywhQuiGzvIBOGV9fZ7i1sBP5okJurtXM5n6pGms5G5dVLSJBd8fEU8Q3nc5MFLQQBPZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779379634; c=relaxed/simple; bh=nGhsmtgWyFPjr/aq1yL0y+wlRu69TvN1tcwIESDlxZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AYKsfSdgZDGI7KvbHnt5ZlMhmvnNroRKj1Hy6W6Xo9wW7AI1w2tATRf3zgv+b8F0lc6oV/InoXlzOgBvpoBx5yQSc2Yl7Za7mMBv3nW0hCh2lCu/kF4HFvmgZ1ulCxwFsYFC7b/2tWaiKXxoqIh7lFt8n/epZDsyjvPo8ngia10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G2pPvKIj; arc=none smtp.client-ip=209.85.128.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G2pPvKIj" Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-7bdf83185bbso60535387b3.2 for ; Thu, 21 May 2026 09:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779379632; x=1779984432; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kpCxEzWYsgGR14o06zRZo2uJlStV20Rqwj1IODcyfdc=; b=G2pPvKIjkUj57Pgrp1NTxwuwJOPd4gZJFmZAVqZ63lNOaD2oIk7GYdVr57vmd+NU66 Trf7TpuQ3ehueGLtcRCyEdrryjVQkMlNIJPAl7KckASzKy40HzpSWzOyTIJZVlGvmEY1 aYHs0r1fEHz6e0MiW4DxbVAieO4Ujc05olMnGqspvEZ5Q6gCUsklgZUr6U+DMABo7aQj t+dZoPcm+jjpW0ETb764GWfaPsUsmQL+nDoiO77jfJ4FCa1vw/Fa1JAkQN+pfvHfmiyN ckMlMK8UWhdcZz0/Uh4P3meYGk73vNCIWJImLCaUS1eVl6yl7sQyscX7zEZ8jR5o3lEN 5seQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779379632; x=1779984432; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kpCxEzWYsgGR14o06zRZo2uJlStV20Rqwj1IODcyfdc=; b=oxHGZqNJ2wzXOu3jP43LOloM8YtAROhQ3cGiYa3tmhlCJmGy7tJNuFQJwRA34NoDJ2 H5xck+wZblqkaROeV3rdfE4S9ANJewJTvmTzQfzfTMI8Mp66pdzgaxSRpahUkCMq8B1m s5pNGdUZwairsm0BwnrmqQe3dXEXg61O4mU6voUxNH/FQcZN5UkgYgv9DrRua3jUpbX5 7m2oi29yWLGnnrH5PqNJDfHF2uP7Rok3f9B9JP7tHLuZlb/ECvZjd0wsP5Sfss46qNJh Ze6ifQKR2QBci19M1zWib81t3oZhIDgIzYKH0uSc25joNUdcMCsVLbwhJAoWM3NRcFvn At+g== X-Gm-Message-State: AOJu0YwhBIEPTMdWTDEWU33g/JbGo6MwQx+i+0ITFszPvB4rJpOG1jnD B6rett+x0mo+Tb3p8BEL4fOJ0Ne1uaeH4DxuIt6I9accLQXVHBxnSyju X-Gm-Gg: Acq92OHauKmducomin/wAyZIyThzLYxqXm8KRHV1TlLntnWwkp/2z/gioGkGA2sbt8i IUJYBPtc1HfhmBtEj6urGi9IPiZL1rILDyEopsCVKmzHnOsIEd6nhdcTE9YJyphVA8bmlLnzQnJ BPKiFTG1dEHEuY/J/WiyM20nIA3WM3VV/BcjG26VWHgbdCnFQjOrDGVK5sZTi+XBOjSXZSWq/vA 8kJveX2l12lIDRVRrGB0LxOZMIhxaXPAp2YDPifvB7bUHdwZYLoizHbT6wZ4hdSWTO/p/OXWrrf AdQbm7BYHIriHyCAYzyheQcJzND8tigrWygpCP03+fFAmGRgBBpHnpMgUzX2DXQzEYU5/JOUScw iGKcvu3anS7U6tOkZ64lB/p126yAC0MUO+z2iYARJPf1Gl5kuaWjJ5lgUQ978me7uXTvHy+lIkB uu+xvefAePEiXkwlbtUS6MuX6jiKL7wWARw1RhOLHkLXOu+JlbGn1Pq7t5B2NWaYQDy3UlbbM= X-Received: by 2002:a05:690c:4442:b0:7d1:cd93:c8e4 with SMTP id 00721157ae682-7d20ad8f545mr36338967b3.18.1779379631731; Thu, 21 May 2026 09:07:11 -0700 (PDT) Received: from zenbox.prizrak.me ([2600:1700:18fb:6011:c2cf:2e92:9a48:97a]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7d2c7abad87sm4657587b3.2.2026.05.21.09.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 09:07:11 -0700 (PDT) From: Justin Suess To: gnoack3000@gmail.com, mic@digikod.net Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Justin Suess Subject: [PATCH 6/6] landlock: Document LANDLOCK_SCOPE_SYSV_MESSAGE_QUEUE Date: Thu, 21 May 2026 12:06:40 -0400 Message-ID: <20260521160640.1716746-7-utilityemal77@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260521160640.1716746-1-utilityemal77@gmail.com> References: <20260521160640.1716746-1-utilityemal77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Document the new SysV message queue scope restriction. Make clear that because these queues do not use persistent handles, subsequent operations on a queue already obtained via msgget (or any other means) may be restricted once this right is enforced. Also note that denials surface as -EACCES rather than -EPERM, since the generic SysV IPC permission path maps every LSM denial to -EACCES. Signed-off-by: Justin Suess --- Documentation/admin-guide/LSM/landlock.rst | 1 + Documentation/userspace-api/landlock.rst | 30 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/LSM/landlock.rst b/Documentation/admin-guide/LSM/landlock.rst index 9923874e2156..e983d903bdf9 100644 --- a/Documentation/admin-guide/LSM/landlock.rst +++ b/Documentation/admin-guide/LSM/landlock.rst @@ -58,6 +58,7 @@ AUDIT_LANDLOCK_ACCESS **scope.*** - IPC scoping restrictions (ABI 6+): - scope.abstract_unix_socket - Abstract UNIX socket connection denied - scope.signal - Signal sending denied + - scope.sysv_msg_queue - SysV message queue operation denied (ABI 10+) Multiple blockers can appear in a single event (comma-separated) when multiple access rights are missing. For example, creating a regular file diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst index 45861fa75685..933b2994fec4 100644 --- a/Documentation/userspace-api/landlock.rst +++ b/Documentation/userspace-api/landlock.rst @@ -84,7 +84,8 @@ to be explicit about the denied-by-default access rights. LANDLOCK_ACCESS_NET_CONNECT_TCP, .scoped = LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET | - LANDLOCK_SCOPE_SIGNAL, + LANDLOCK_SCOPE_SIGNAL | + LANDLOCK_SCOPE_SYSV_MSG_QUEUE, }; Because we may not know which kernel version an application will be executed @@ -132,6 +133,10 @@ version, and only use the available subset of access rights: case 6 ... 8: /* Removes LANDLOCK_ACCESS_FS_RESOLVE_UNIX for ABI < 9 */ ruleset_attr.handled_access_fs &= ~LANDLOCK_ACCESS_FS_RESOLVE_UNIX; + __attribute__((fallthrough)); + case 9: + /* Removes LANDLOCK_SCOPE_SYSV_MSG_QUEUE for ABI < 10 */ + ruleset_attr.scoped &= ~LANDLOCK_SCOPE_SYSV_MSG_QUEUE; } This enables the creation of an inclusive ruleset that will contain our rules. @@ -380,6 +385,22 @@ The operations which can be scoped are: A :manpage:`sendto(2)` on a socket which was previously connected will not be restricted. This works for both datagram and stream sockets. +``LANDLOCK_SCOPE_SYSV_MSG_QUEUE`` + This limits the set of System V message queues to which we can perform + :manpage:`msgget(2)`, :manpage:`msgrcv(2)`, :manpage:`msgsnd(2)`, and + :manpage:`msgctl(2)` calls to only message queues which were created by a + process in the same or a nested Landlock domain. + + Since System V message queues are IPC namespace global constructs and do + not use file descriptors, enforcement of a ruleset with this scoping may + cause subsequent operations on an msqid that were allowed prior to + enforcement to be denied. + + Denials are reported as ``EACCES``. Unlike other Landlock scopes, + the check shares the generic SysV IPC permission path + (``ipcperms(3)``), which maps every denial to ``EACCES`` before it + reaches user space. + IPC scoping does not support exceptions via :manpage:`landlock_add_rule(2)`. If an operation is scoped within a domain, no rules can be added to allow access to resources or processes outside of the scope. @@ -722,6 +743,13 @@ Starting with the Landlock ABI version 9, it is possible to restrict connections to pathname UNIX domain sockets (:manpage:`unix(7)`) using the new ``LANDLOCK_ACCESS_FS_RESOLVE_UNIX`` right. +System V message queue (ABI < 10) +--------------------------------- + +Starting with the Landlock ABI version 10, it is possible to restrict +operations on System V message queues by setting +``LANDLOCK_SCOPE_SYSV_MSG_QUEUE`` to the ``scoped`` ruleset attribute. + .. _kernel_support: Kernel support -- 2.53.0