linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/8] Fix non-TCP restriction and inconsistency of TCP errors
@ 2024-10-17 11:04 Mikhail Ivanov
  2024-10-17 11:04 ` [RFC PATCH v2 1/8] landlock: Fix non-TCP sockets restriction Mikhail Ivanov
                   ` (7 more replies)
  0 siblings, 8 replies; 50+ messages in thread
From: Mikhail Ivanov @ 2024-10-17 11:04 UTC (permalink / raw)
  To: mic, gnoack
  Cc: willemdebruijn.kernel, matthieu, linux-security-module, netdev,
	netfilter-devel, yusongping, artem.kuzin, konstantin.meskhidze

Hello!
This patchset provides two general fixes for TCP Landlock hooks:

First one fixes incorrect restriction of non-TCP bind/connect actions.
There is two commits related to testing MPTCP and SCTP protocols which were
incorrectly restricted. SCTP implementation has invalid check for minimal
address length in bind(2) call [1], therefore commit with SCTP testing can be
applied later after necessary SCTP fixes.

[1] https://lore.kernel.org/all/20241004.Hohpheipieh2@digikod.net/
Closes: https://github.com/landlock-lsm/linux/issues/40

Second one fixes inconsistency of errors in bind and connect hooks for
TCP sockets. It provides per-operation helpers, which consist of a set
of checks from the TCP network stack. Due to TCP connect(2) implementation
it's not possible to obtain full consistency, but the unhandled cases are
rather special scenarios that should almost should not normally appear.
Two new tests were implemented to validate errors consistency.

Diffs of second and third commits were unreadable, so I've decided to
rewrite net.c file to simplify reviewing process.

Code coverage
=============
Code coverage(gcov) report with the launch of net_test selftest:
 * security/landlock/net.c:
lines......: 98.8% (79 of 80 lines)
functions..: 100% (8 of 8 functions)

One uncovered line is documented in check_tcp_connect_consistency_and_get_port().

General changes
===============
 * Rebases on current linux-mic/next (based on Linux v6.12-rc3)
 * Fixes inconsistency of TCP actions errors and implements two related
   tests.
 * Removes SMC test suits.
 * Adds separate commit for SCTP test suits.
 * Adds test suits of protocol fixture for sockets created with
   protocol=IPPROTO_TCP (C.f. socket(2)).

Previous versions
=================
v1: https://lore.kernel.org/all/20241003143932.2431249-1-ivanov.mikhail1@huawei-partners.com/

Mikhail Ivanov (8):
  landlock: Fix non-TCP sockets restriction
  landlock: Make network stack layer checks explicit for each TCP action
  landlock: Fix inconsistency of errors for TCP actions
  selftests/landlock: Test TCP accesses with protocol=IPPROTO_TCP
  selftests/landlock: Test that MPTCP actions are not restricted
  selftests/landlock: Test consistency of errors for TCP actions
  landlock: Add note about errors consistency in documentation
  selftests/landlock: Test that SCTP actions are not restricted

 Documentation/userspace-api/landlock.rst    |   3 +-
 security/landlock/net.c                     | 501 +++++++++++-------
 tools/testing/selftests/landlock/common.h   |   1 +
 tools/testing/selftests/landlock/config     |   4 +
 tools/testing/selftests/landlock/net_test.c | 532 ++++++++++++++++++--
 5 files changed, 825 insertions(+), 216 deletions(-)
 rewrite security/landlock/net.c (36%)


base-commit: fe76bd133024aaef12d12a7d58fa3e8d138d3bf3
-- 
2.34.1


^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2025-01-31 11:04 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 11:04 [RFC PATCH v2 0/8] Fix non-TCP restriction and inconsistency of TCP errors Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 1/8] landlock: Fix non-TCP sockets restriction Mikhail Ivanov
2024-10-17 12:59   ` Matthieu Baerts
2024-10-18 18:08     ` Mickaël Salaün
2024-10-31 16:21       ` Mikhail Ivanov
2024-11-08 17:16         ` David Laight
2024-12-04 19:29           ` Mickaël Salaün
2024-12-12 18:43         ` Mickaël Salaün
2024-12-13 18:19           ` Mikhail Ivanov
2025-01-24 15:02             ` Mickaël Salaün
2025-01-27 12:40               ` Mikhail Ivanov
2025-01-27 19:48                 ` Mickaël Salaün
2025-01-28 10:56                   ` Mikhail Ivanov
2025-01-28 18:14                     ` Matthieu Baerts
2025-01-29  9:52                       ` Mikhail Ivanov
2025-01-29 10:25                         ` Matthieu Baerts
2025-01-29 11:02                           ` Mikhail Ivanov
2025-01-29 11:33                             ` Matthieu Baerts
2025-01-29 11:47                               ` Mikhail Ivanov
2025-01-29 11:57                                 ` Matthieu Baerts
2025-01-29 14:51                                 ` Mickaël Salaün
2025-01-29 15:44                                   ` Matthieu Baerts
2025-01-30  9:51                                     ` Mickaël Salaün
2025-01-30 10:18                                       ` Matthieu Baerts
2025-01-31 11:04                                   ` Mikhail Ivanov
2024-12-04 19:27       ` Mickaël Salaün
2024-12-04 19:35         ` Mickaël Salaün
2024-12-09 10:19           ` Mikhail Ivanov
2024-12-10 18:04             ` Mickaël Salaün
2024-12-10 18:05               ` Mickaël Salaün
2024-12-11 15:24                 ` Mikhail Ivanov
2024-12-12 18:43                   ` Mickaël Salaün
2024-12-13 11:42                     ` Mikhail Ivanov
2024-12-04 19:30   ` Mickaël Salaün
2024-12-09 10:19     ` Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 2/8] landlock: Make network stack layer checks explicit for each TCP action Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 3/8] landlock: Fix inconsistency of errors for TCP actions Mikhail Ivanov
2024-10-17 11:34   ` Mikhail Ivanov
2024-10-17 12:48   ` Tetsuo Handa
2024-11-06  9:27     ` Mikhail Ivanov
2024-12-04 19:32   ` Mickaël Salaün
2024-10-17 11:04 ` [RFC PATCH v2 4/8] selftests/landlock: Test TCP accesses with protocol=IPPROTO_TCP Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 5/8] selftests/landlock: Test that MPTCP actions are not restricted Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 6/8] selftests/landlock: Test consistency of errors for TCP actions Mikhail Ivanov
2024-12-10 18:07   ` Mickaël Salaün
2024-12-11 15:29     ` Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 7/8] landlock: Add note about errors consistency in documentation Mikhail Ivanov
2024-12-10 18:08   ` Mickaël Salaün
2024-12-11 15:30     ` Mikhail Ivanov
2024-10-17 11:04 ` [RFC PATCH v2 8/8] selftests/landlock: Test that SCTP actions are not restricted Mikhail Ivanov

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).