From: Demi Marie Obenour <demiobenour@gmail.com>
To: "Günther Noack" <gnoack3000@gmail.com>,
"Paul Moore" <paul@paul-moore.com>,
"Christian Brauner" <brauner@kernel.org>,
"Justin Suess" <utilityemal77@gmail.com>
Cc: "Mickaël Salaün" <mic@digikod.net>,
"James Morris" <jmorris@namei.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
linux-security-module@vger.kernel.org,
"Tingmao Wang" <m@maowtm.org>,
"Samasth Norway Ananda" <samasth.norway.ananda@oracle.com>,
"Matthieu Buffet" <matthieu@buffet.re>,
"Mikhail Ivanov" <ivanov.mikhail1@huawei-partners.com>,
konstantin.meskhidze@huawei.com, "Alyssa Ross" <hi@alyssa.is>,
"Jann Horn" <jannh@google.com>,
"Tahera Fahimi" <fahimitahera@gmail.com>,
"Simon Horman" <horms@kernel.org>,
netdev@vger.kernel.org,
"Alexander Viro" <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v2 1/5] lsm: Add hook unix_path_connect
Date: Thu, 15 Jan 2026 16:24:48 -0500 [thread overview]
Message-ID: <4c3956c2-4133-46bb-9ee5-4abf9bf7fff8@gmail.com> (raw)
In-Reply-To: <20260115.b5977d57d52d@gnoack.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 2400 bytes --]
On 1/15/26 05:10, Günther Noack wrote:
> On Tue, Jan 13, 2026 at 06:27:15PM -0500, Paul Moore wrote:
>> On Tue, Jan 13, 2026 at 4:34 AM Christian Brauner <brauner@kernel.org> wrote:
>>> On Sat, Jan 10, 2026 at 03:32:57PM +0100, Günther Noack wrote:
>>>> From: Justin Suess <utilityemal77@gmail.com>
>>>>
>>>> Adds an LSM hook unix_path_connect.
>>>>
>>>> This hook is called to check the path of a named unix socket before a
>>>> connection is initiated.
>>>>
>>>> Cc: Günther Noack <gnoack3000@gmail.com>
>>>> Signed-off-by: Justin Suess <utilityemal77@gmail.com>
>>>> ---
>>>> include/linux/lsm_hook_defs.h | 4 ++++
>>>> include/linux/security.h | 11 +++++++++++
>>>> net/unix/af_unix.c | 9 +++++++++
>>>> security/security.c | 20 ++++++++++++++++++++
>>>> 4 files changed, 44 insertions(+)
>>
>> ...
...
> * Some properties of the resolved socket are still observable to
> userspace:
>
> When we only pass the path to a later LSM hook, there are a variety
> of additional error case checks in af_unix.c which are based on the
> "other" socket which we looked up through the path. Examples:
>
> * was other shutdown(2)? (ECONNREFUSED on connect or EPIPE on dgram_sendmsg)
> * does other support SO_PASSRIGHTS (fd passing)? (EPERM on dgram_sendmsg)
> * would sendmsg pass sk_filter() (on dgram_sendmsg)
>
> For a LSM policy that is supposed to restrict the resolution of a
> UNIX socket by path, I would not expect such properties of the
> resolved socket to be observable?
>
> (And we also can't fix this up in the LSM by returning a matching
> error code, because at least unix_dgram_sendmsg() returns multiple
> different error codes in these error cases.)
>
> I would prefer if the correctness of our LSM did not depend on
> keeping track of the error scenarios in af_unix.c. This seems
> brittle.
Indeed so.
> Overall, I am not convinced that using pre-existing hooks is the right
> way and I would prefer the approach where we have a more dedicated LSM
> hook for the path lookup.
>
> Does that seem reasonable? Let me know what you think.
>
> –Günther
Having a dedicated LSM hook for all path lookups is definitely my
preferred approach. Could this allow limiting directory traversal
as well?
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-01-15 21:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-10 14:32 [PATCH v2 0/5] landlock: Pathname-based UNIX connect() control Günther Noack
2026-01-10 14:32 ` [PATCH v2 1/5] lsm: Add hook unix_path_connect Günther Noack
2026-01-10 16:45 ` Justin Suess
2026-01-11 9:55 ` Günther Noack
2026-01-13 22:51 ` Paul Moore
2026-01-13 23:30 ` Paul Moore
2026-01-13 9:34 ` Christian Brauner
2026-01-13 23:27 ` Paul Moore
2026-01-15 10:10 ` Günther Noack
2026-01-15 21:24 ` Demi Marie Obenour [this message]
2026-01-15 22:32 ` Günther Noack
2026-01-15 21:46 ` Paul Moore
2026-01-12 16:08 ` [PATCH v2 0/5] landlock: Pathname-based UNIX connect() control Mickaël Salaün
2026-01-12 20:53 ` Günther Noack
2026-01-17 18:57 ` Justin Suess
2026-01-18 17:44 ` Günther Noack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c3956c2-4133-46bb-9ee5-4abf9bf7fff8@gmail.com \
--to=demiobenour@gmail.com \
--cc=brauner@kernel.org \
--cc=fahimitahera@gmail.com \
--cc=gnoack3000@gmail.com \
--cc=hi@alyssa.is \
--cc=horms@kernel.org \
--cc=ivanov.mikhail1@huawei-partners.com \
--cc=jannh@google.com \
--cc=jmorris@namei.org \
--cc=konstantin.meskhidze@huawei.com \
--cc=linux-security-module@vger.kernel.org \
--cc=m@maowtm.org \
--cc=matthieu@buffet.re \
--cc=mic@digikod.net \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=samasth.norway.ananda@oracle.com \
--cc=serge@hallyn.com \
--cc=utilityemal77@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox