All of lore.kernel.org
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] connect01: Convert to new API
Date: Mon, 25 May 2026 10:12:54 +0000	[thread overview]
Message-ID: <20260525101254.4042-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260525090228.11895-2-wegao@suse.com>

Hi Wei,

On Mon, 25 May 2026, Wei Gao wrote:
> connect01: Convert to new API

> +// SPDX-License-Identifier: GPL-2.0-or-later
>  /*
> - *
> - *   Copyright (c) International Business Machines  Corp., 2001
> + * Copyright (c) International Business Machines  Corp., 2001
> + * Copyright (c) Linux Test Project, 2006-2024

The patch is from 2026; the LTP copyright year should be updated to 2006-2026.

> +static int sys_connect(int sockfd, const struct sockaddr *addr,
> +	socklen_t addrlen)

Indentation regressed from two tabs to one. The continuation parameter should
be aligned with the opening parenthesis (or at minimum two tabs to match the
original), per kernel coding style.

> +	pid = SAFE_FORK();
> +
> +	if (!pid) {
> +		int nfd = SAFE_ACCEPT(fd_server, NULL, NULL);
> +
> +		SAFE_CLOSE(nfd);
> +		exit(0);
> +	}
> +	close(fd_server);

Use SAFE_CLOSE() here for consistency.

[...]

--- [PATCH 2/2] connect01: Add negative tests ---

> +	fd_unix_server = SAFE_SOCKET(AF_UNIX, SOCK_STREAM, 0);
> +	SAFE_BIND(fd_unix_server, (struct sockaddr *)&sock4, sizeof(sock4));
> +	SAFE_LISTEN(fd_unix_server, 5);
> +
> +	fd_unix_dgram = SAFE_SOCKET(AF_UNIX, SOCK_DGRAM, 0);
> +	fd_unix_stream = SAFE_SOCKET(AF_UNIX, SOCK_STREAM, 0);
> +
> +	pw = SAFE_GETPWNAM("nobody");

The EACCES test relies on "nobody" not having write permission to SOCK_FILE.
The socket file's permissions are umask-dependent; with umask 0000 the file
gets mode 0777 and the test would fail spuriously. Add an explicit
`SAFE_CHMOD(SOCK_FILE, 0700)` after the SAFE_BIND() to make this reliable.

> +	if (tc->exp_errno == EACCES) {
> +		if (!SAFE_FORK()) {
> +			SAFE_SETUID(pw->pw_uid);
> +			TST_EXP_FAIL(sys_connect(*tc->fd, addr, tc->salen),
> +				tc->exp_errno, "%s", tc->desc);
> +			exit(0);
> +		}

Result propagation via shared memory with .forks_child = 1 is correct, but
the exit code is always 0 even on failure. Use `tst_exit()` or exit with the
appropriate code so that unexpected crashes are also caught by the parent.
Alternatively this is a style nit if tst_exit() is not the expected pattern
here.

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/26394925194

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-05-25 10:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14  4:51 [LTP] [PATCH v2 1/2] connect01: Convert to new API Yang Xu via ltp
2024-05-14  4:51 ` [LTP] [PATCH v2 2/2] connect01: Add negative tests Yang Xu via ltp
2024-07-17 12:30 ` [LTP] [PATCH v2 1/2] connect01: Convert to new API Cyril Hrubis
2026-05-25  9:02 ` [LTP] [PATCH v3 0/2] " Wei Gao via ltp
2026-05-25  9:02   ` [LTP] [PATCH v3 1/2] " Wei Gao via ltp
2026-05-25 10:12     ` linuxtestproject.agent [this message]
2026-05-28  4:43       ` [LTP] " Wei Gao via ltp
2026-06-04  4:49     ` [LTP] [PATCH v4 0/2] " Wei Gao via ltp
2026-06-04  4:49       ` [LTP] [PATCH v4 1/2] " Wei Gao via ltp
2026-06-04  7:15         ` [LTP] " linuxtestproject.agent
2026-06-16  1:47         ` [LTP] [PATCH v5 0/2] " Wei Gao via ltp
2026-06-16  1:47           ` [LTP] [PATCH v5 1/2] " Wei Gao via ltp
2026-06-16  4:07             ` [LTP] " linuxtestproject.agent
2026-06-16  5:24             ` [LTP] [PATCH v6 0/2] " Wei Gao via ltp
2026-06-16  5:24               ` [LTP] [PATCH v6 1/2] " Wei Gao via ltp
2026-06-16  8:35                 ` [LTP] " linuxtestproject.agent
2026-06-16  9:31                 ` [LTP] [PATCH v7 0/2] " Wei Gao via ltp
2026-06-16  9:31                   ` [LTP] [PATCH v7 1/2] " Wei Gao via ltp
2026-06-16  9:31                   ` [LTP] [PATCH v7 2/2] connect01: Add negative tests Wei Gao via ltp
2026-06-16  5:24               ` [LTP] [PATCH v6 " Wei Gao via ltp
2026-06-16  1:47           ` [LTP] [PATCH v5 " Wei Gao via ltp
2026-06-04  4:49       ` [LTP] [PATCH v4 " Wei Gao via ltp
2026-05-25  9:02   ` [LTP] [PATCH v3 " Wei Gao via ltp

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=20260525101254.4042-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.