[LTP] landlock08: add UDP bind/connect test variants

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Tue Jun 30 17:31:00 CEST 2026


Hi Andrea,

On Tue, 30 Jun 2026 16:16:08 +0200, Andrea Cervesato wrote:
> landlock08: add UDP bind/connect test variants

> static void setup(void)
> {
> 	landlock_abi = verify_landlock_is_enabled();
> 	if (landlock_abi < 4)
> 		tst_brk(TCONF, "Landlock network is not supported");
>
> 	addr_port = TST_GET_UNUSED_PORT(AF_INET, SOCK_STREAM);

TST_GET_UNUSED_PORT is called with SOCK_STREAM, but addr_port is
also used for the UDP variants (tst_variant 2 and 3) where the
socket type is SOCK_DGRAM.

A port verified free for TCP is not guaranteed to be free for UDP.
Should the port acquisition be moved into run() and use the
variant's socket type instead?

> /*\
>  * Verify the landlock support for bind()/connect() syscalls in IPV4 and IPV6
>  * protocols, using both TCP and UDP. In particular, check that bind() is
>  ...
>  * [Algorithm]
>  *
>  * Repeat the following procedure for {TCP, UDP} x {IPV4, IPV6}:
>  *
>  ...
>  * - create a server listening on PORT1

The algorithm says "create a server listening on PORT1", but for
UDP variants the server only binds -- there is no listen() call.
The code handles this correctly (the SAFE_LISTEN is guarded by
SOCK_STREAM), but the description should probably say something
like "create a server bound on PORT1" or split the TCP/UDP steps.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list