linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Günther Noack" <gnoack@google.com>
To: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
Cc: mic@digikod.net, willemdebruijn.kernel@gmail.com,
	gnoack3000@gmail.com,  linux-security-module@vger.kernel.org,
	netdev@vger.kernel.org,  netfilter-devel@vger.kernel.org,
	yusongping@huawei.com,  artem.kuzin@huawei.com,
	konstantin.meskhidze@huawei.com
Subject: Re: [RFC PATCH v2 0/9] Support TCP listen access-control
Date: Tue, 20 Aug 2024 15:11:07 +0200	[thread overview]
Message-ID: <ZsSV6-o1guJdpPfu@google.com> (raw)
In-Reply-To: <20240814030151.2380280-1-ivanov.mikhail1@huawei-partners.com>

Hello!

Thanks for sending v2 of this patchset!

On Wed, Aug 14, 2024 at 11:01:42AM +0800, Mikhail Ivanov wrote:
> Hello! This is v2 RFC patch dedicated to restriction of listening sockets.
> 
> It is based on the landlock's mic-next branch on top of 6.11-rc1 kernel
> version.
> 
> Description
> ===========
> LANDLOCK_ACCESS_NET_BIND_TCP is useful to limit the scope of "bindable"
> ports to forbid a malicious sandboxed process to impersonate a legitimate
> server process. However, bind(2) might be used by (TCP) clients to set the
> source port to a (legitimate) value. Controlling the ports that can be
> used for listening would allow (TCP) clients to explicitly bind to ports
> that are forbidden for listening.
> 
> Such control is implemented with a new LANDLOCK_ACCESS_NET_LISTEN_TCP
> access right that restricts listening on undesired ports with listen(2).
> 
> It's worth noticing that this access right doesn't affect changing 
> backlog value using listen(2) on already listening socket. For this case
> test ipv4_tcp.double_listen is provided.

This is a good catch, btw, that seems like the right thing to do. 👍


I am overall happy with this patch set, but left a few remarks in the tests so
far.  There are a few style nits here and there.

A thing that makes me uneasy is that the tests have a lot of logic in
test_restricted_net_fixture(), where instead of the test logic being
straightforward, there are conditionals to tell apart different scenarios and
expect different results.  I wish that the style of these tests was more linear.
This patch set is making it a little bit worse, because the logic in
test_restricted_net_fixture() increases.

I have also made some restructuring suggestions for the kernel code, in the hope
that they simplify things.  If they don't because I overlooked something, we can
skip that though.

—Günther

  parent reply	other threads:[~2024-08-20 13:11 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14  3:01 [RFC PATCH v2 0/9] Support TCP listen access-control Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 1/9] landlock: Refactor current_check_access_socket() access right check Mikhail Ivanov
2024-08-19 21:37   ` Günther Noack
2024-08-20 11:20     ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 2/9] landlock: Support TCP listen access-control Mikhail Ivanov
2024-10-05 16:56   ` Günther Noack
2024-10-05 17:53     ` Mikhail Ivanov
2024-10-05 18:22       ` Günther Noack
2024-10-05 18:32         ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 3/9] selftests/landlock: Support LANDLOCK_ACCESS_NET_LISTEN_TCP Mikhail Ivanov
2024-08-19 21:52   ` Günther Noack
2024-08-20 12:32     ` Mikhail Ivanov
2024-08-20 13:14     ` Günther Noack
2024-08-20 18:27       ` Mikhail Ivanov
2024-09-25 18:31         ` Mickaël Salaün
2024-09-26 11:59           ` Mikhail Ivanov
2024-08-19 21:53   ` Günther Noack
2024-08-20 12:35     ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 4/9] selftests/landlock: Test listening restriction Mikhail Ivanov
2024-08-20 12:31   ` Günther Noack
2024-08-20 18:46     ` Mikhail Ivanov
2024-09-25 18:31       ` Mickaël Salaün
2024-09-26 13:51         ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 5/9] selftests/landlock: Test listen on connected socket Mikhail Ivanov
2024-08-20 13:01   ` Günther Noack
2024-08-20 13:42     ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 6/9] selftests/landlock: Test listening without explicit bind restriction Mikhail Ivanov
2024-08-20 13:02   ` Günther Noack
2024-08-20 13:46     ` Mikhail Ivanov
2024-08-21 11:52       ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 7/9] selftests/landlock: Test listen on ULP socket without clone method Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 8/9] selftests/landlock: Test changing socket backlog with listen(2) Mikhail Ivanov
2024-10-05 16:57   ` Günther Noack
2024-10-05 17:29     ` Mikhail Ivanov
2024-08-14  3:01 ` [RFC PATCH v2 9/9] samples/landlock: Support LANDLOCK_ACCESS_NET_LISTEN Mikhail Ivanov
2024-10-05 16:57   ` Günther Noack
2024-10-05 17:30     ` Mikhail Ivanov
2024-08-20 13:11 ` Günther Noack [this message]
2024-08-20 13:23   ` [RFC PATCH v2 0/9] Support TCP listen access-control Günther Noack
2024-08-20 13:53     ` Mikhail Ivanov

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=ZsSV6-o1guJdpPfu@google.com \
    --to=gnoack@google.com \
    --cc=artem.kuzin@huawei.com \
    --cc=gnoack3000@gmail.com \
    --cc=ivanov.mikhail1@huawei-partners.com \
    --cc=konstantin.meskhidze@huawei.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yusongping@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).