All of lore.kernel.org
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: dm.chestnykh@gmail.com
Cc: ltp@lists.linux.it
Subject: Re: [LTP] arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
Date: Fri,  9 Oct 2026 10:12:28 +0000	[thread overview]
Message-ID: <20261009101228.9426-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20261008194725.1198-1-dm.chestnykh@gmail.com>

Hi Dmitry,

On Thu, 8 Oct 2026, Dmitry Chestnykh wrote:
> arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests

> +CFLAGS += -mfsgsbase

This directory-wide x86 option breaks supported non-x86 builds, including
the existing arch_prctl01 target; AArch64 clang rejects it. Remove the
option: the new test's inline assembly compiles without it on x86_64.

> +	asm volatile("rdfsbase %0" : "=r"(__res));         \
> +	asm volatile("rdgsbase %0" : "=r"(__res));         \
> +	.supported_archs = (const char *const []){"x86_64", NULL}

Removing the compiler option alone is insufficient: the unconditional
assembly still fails on AArch64, and lapi/arch_prctl.h supplies no
ARCH_GET_FS/ARCH_GET_GS definitions on non-x86 targets. The supported_archs
check runs only after compilation; provide a buildable unsupported-feature
path or filter the target appropriately in the Makefile.

> +#if defined(__has_include) && __has_include(<asm/hwcap2.h>)

GCC 4.8.5, a supported compiler, cannot parse this expression: the left
operand does not protect an undefined function-like preprocessing operator.
The repository's sparse check also rejects this line. Use separately nested
checks or configured optional-header inclusion.

> +#include <asm/hwcap2.h>
> +#else
> +#warning "Cannot obtain HWCAP2_FSGSBASE from system headers"
> +#define HWCAP2_FSGSBASE (1UL << 1)

An existing older header bypasses the fallback even when it lacks this bit:
compilation against Linux 5.4's hwcap2.h fails with HWCAP2_FSGSBASE
undeclared.
Apply the fallback after optional header inclusion, independently of header
availability, and put the compatibility definition in include/lapi.

> +/arch_prctl02

The new binary has no entry in any runtest file, so normal syscall-suite
runs never execute it. Add "arch_prctl02 arch_prctl02" to runtest/syscalls.

> +	TEST(arch_prctl_get(ARCH_GET_FS, &fs_prctl));
> +	if (TST_RET == 0 && fs_prctl == fs)
> +		tst_res(TPASS, "get fs succeed");
> +	else
> +		tst_res(TFAIL, "got wrong fs register value");

These messages discard errno and the expected/actual bases, and report a
syscall failure as a register mismatch. Use TST_EXP_PASS_SILENT(), then
TST_EXP_EQ_LU() only when TST_PASS is true; apply the same change to GS.

> + * Author: Dmitry Chestnykh <dm.chestnykh@gmail.com>

Add the required copyright line with year and author, for example
"Copyright (c) 2026 Dmitry Chestnykh <dm.chestnykh@gmail.com>".

> + * Simple test on arch_prctl to get FS_BASE and GS_BASE

Use the required manpage role and describe the comparison, for example:
"Check that :manpage:`arch_prctl(2)` with ``ARCH_GET_FS`` and ``ARCH_GET_GS``
returns bases matching ``rdfsbase`` and ``rdgsbase``."

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

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

  reply	other threads:[~2026-10-09 10:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 19:47 [LTP] [PATCH] arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests dm.chestnykh
2026-10-09 10:12 ` linuxtestproject.agent [this message]
2026-10-09 15:52 ` [LTP] [PATCH v2] " dm.chestnykh
2026-10-09 17:27   ` [LTP] " linuxtestproject.agent
2026-10-09 18:35   ` [LTP] [PATCH v3] " dm.chestnykh
2026-10-09 18:39     ` [LTP] [PATCH v4] " dm.chestnykh
2026-10-09 22:23       ` [LTP] " linuxtestproject.agent
2026-10-10  6:38       ` [LTP] [PATCH v5] " dm.chestnykh
2026-10-10  6:42         ` [LTP] [PATCH v6] " dm.chestnykh
2026-10-10  9:35           ` [LTP] " linuxtestproject.agent
2026-10-10  9:44           ` [LTP] [PATCH v7] " dm.chestnykh
2026-10-10 15:49             ` [LTP] " linuxtestproject.agent
2026-10-10  9:35         ` linuxtestproject.agent
2026-10-09 22:23     ` linuxtestproject.agent

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=20261009101228.9426-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=dm.chestnykh@gmail.com \
    --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 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.