[LTP] arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Sat Oct 10 00:23:51 CEST 2026


Hi Dmitry,

On Fri Oct 9 2026, Dmitry Chestnykh wrote:
> arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests

> diff --git a/testcases/kernel/syscalls/arch_prctl/arch_prctl02.c b/testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
> +static int arch_prctl_get(int code, unsigned long *out)
> +{
> +	return tst_syscall(__NR_arch_prctl, code, out);
> +}

High severity: x32 also defines __x86_64__ and passes .supported_archs,
but its unsigned long is four bytes. The raw getters still write eight
bytes, overrunning fs_prctl and gs_prctl; glibc's x32 arch_prctl wrapper
uses a uint64_t temporary for this reason. Use uint64_t or unsigned long
long consistently for the output pointer, result buffers and bases read
by the instructions.

> +	if (gs == 0) {
> +		unsigned long test_gs = 0xabababab;
> +		TST_EXP_PASS_SILENT(set_gs(test_gs));
> +		if (TST_PASS) {
> +			TEST_GS_BASE();
> +		}
> +	}

Low severity: the checkpatch stage of make check-arch_prctl02 fails on
declaration spacing, single-statement braces, a trailing blank line and
bare unsigned declarations. Add blank lines after declarations, remove
the unnecessary braces/blank line, and spell the types unsigned int;
make ignores checker errors, so its zero exit status does not mean this
check passed.

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