Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: berringtoni36@gmail.com
Cc: Wenqiang Zhao via B4 Relay
	<devnull+berringtoni36.gmail.com@kernel.org>,
	Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] syscalls/select: use kernel timeval for _newselect
Date: Wed, 11 Nov 2026 14:24:18 +0100	[thread overview]
Message-ID: <20261111132418.GA747242@pevik> (raw)
In-Reply-To: <20261019-research-select-time64-rk3576-v1-1-a65d6b72e21f@gmail.com>

Hi Wenqiang Zhao,

> With _TIME_BITS=64, struct timeval has 64-bit fields on 32-bit ARM,
> but _newselect still expects the old kernel timeval layout. Passing
> the libc structure directly makes a subsecond timeout appear as zero.

> Convert valid timeouts to struct __kernel_old_timeval before the syscall
> and copy the remaining time back afterwards. Pass NULL and deliberately
> faulty timeout pointers through unchanged.

> On an RK3576 running a 6.1.118-rt36 aarch64 kernel with CONFIG_COMPAT=y,
> the unmodified ARM32 time64 select02 reports 22 passes and 6 failures.
> With this change it reports 28 passes and no failures. Both runs skip
> the unsupported SYS_select variant.

> Tested select01-select04 on the same board with ARM32 time32, ARM32
> time64 and AArch64 static builds: 250 passes, 55 configuration skips,
> no failures or broken tests. Additional local checks cover timeout
> copy-back, ready fds, NULL, EFAULT, EINVAL and EINTR.

> Closes: https://github.com/linux-test-project/ltp/issues/1314

LGTM, thanks!

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Signed-off-by: Wenqiang Zhao <berringtoni36@gmail.com>
> ---
> syscalls/select: use kernel timeval for _newselect
> ---
>  testcases/kernel/syscalls/select/select_var.h | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)

> diff --git a/testcases/kernel/syscalls/select/select_var.h b/testcases/kernel/syscalls/select/select_var.h
> index a945fa6..e23f1fa 100644
> --- a/testcases/kernel/syscalls/select/select_var.h
> +++ b/testcases/kernel/syscalls/select/select_var.h
> @@ -84,14 +84,30 @@ static int do_select_faulty_to(int nfds, fd_set *readfds, fd_set *writefds,
>  #endif
>  		return ret;
>  	}
> -	case 4:
> +	case 4: {
>  #ifdef __NR__newselect
> -		return tst_syscall(__NR__newselect, nfds, readfds, writefds, exceptfds, timeout);
> +		struct __kernel_old_timeval _tv;
> +		void *tv = timeout;
> +		int ret;
> +
> +		if (timeout && !faulty_to) {
> +			_tv.tv_sec = timeout->tv_sec;
> +			_tv.tv_usec = timeout->tv_usec;
> +			tv = &_tv;
> +		}
> +
> +		ret = tst_syscall(__NR__newselect, nfds, readfds, writefds, exceptfds, tv);
> +		if (timeout && !faulty_to) {
> +			timeout->tv_sec = _tv.tv_sec;
> +			timeout->tv_usec = _tv.tv_usec;
> +		}
> +		return ret;
>  #else
>  		tst_brk(TCONF, "__NR__newselect not implemented");
>  #endif
>  	break;
>  	}
> +	}

>  	return -1;
>  }

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

  parent reply	other threads:[~2026-11-11 13:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  6:22 [LTP] [PATCH] syscalls/select: use kernel timeval for _newselect Wenqiang Zhao via B4 Relay via ltp
2026-10-22 13:38 ` [LTP] " linuxtestproject.agent
2026-11-11 13:24 ` Petr Vorel [this message]
2026-11-11 14:33 ` [LTP] [PATCH] " Cyril Hrubis
2026-11-11 14:45 ` Petr Vorel

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=20261111132418.GA747242@pevik \
    --to=pvorel@suse.cz \
    --cc=berringtoni36@gmail.com \
    --cc=devnull+berringtoni36.gmail.com@kernel.org \
    --cc=ltp@lists.linux.it \
    /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