arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
PATCH 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
From: Dmitry Chestnykh <[email protected]>
--- .../kernel/syscalls/arch_prctl/.gitignore | 1 + testcases/kernel/syscalls/arch_prctl/Makefile | 2 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 81 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/Makefile +2 -0
@@ -6,3 +6,5 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk include $(top_srcdir)/include/mk/generic_leaf_target.mk + +CFLAGS += -mfsgsbase
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +81 -0
81 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
Quoted 3 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GStests+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.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 80
Quoted 3 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +3
-0+ asmvolatile ("rdfsbase %0" :"=r" (__res)); \ + asmvolatile ("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.
Quoted 1 line
+#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.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 22
Quoted 4 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +4
-0+#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.
Quoted 1 line
+/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.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 66
Quoted 5 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +5
-0+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.
Quoted 1 line
+ * Author: Dmitry Chestnykh <[email protected]>
Add the required copyright line with year and author, for example "Copyright (c) 2026 Dmitry Chestnykh <[email protected]>".
Quoted 1 line
+ * Simple test on
arch_prctlto getFS_BASEandGS_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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
In reply to [email protected]From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 87 +++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +87 -0
87 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 70
Quoted 5 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GStests+++
b/testcases/kernel/syscalls/arch_prctl/arch_prctl02.ctestcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +2
-0+unsigned long gs =READ_GS_BASE (); +TST_EXP_EQ_LU (gs_prctl, gs);
The default GS base is zero in ordinary runs, so an always-zero getter passes; replacing ARCH_GET_GS with a successful zero write reproduced this. Also exercise a known nonzero 64-bit GS base and restore the original afterward, without changing the libc-owned FS base.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 66
Quoted 5 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +5
-0+TST_EXP_PASS_SILENT (arch_prctl_get (ARCH_GET_FS , &fs_prctl)); +if (TST_PASS ) +TST_EXP_EQ_LU (fs_prctl, fs); +else +tst_res (TFAIL ,"got wrong fs register value" );
TST_EXP_PASS_SILENT() already reports syscall failures; injecting EINVAL for both getters produces four failures for two calls. Remove both else
branches: they duplicate the failures and claim value mismatches without comparing either value.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 78
Quoted 5 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +5
-0+static void run (unsigned int index) +{ + (void )index; + .test = run, + .tcnt = 1,
Represent FS and GS as two tcases entries and use
.tcnt = ARRAY_SIZE(tcases), with the index selecting the opcode and corresponding register read instead of duplicating both cases in run(0).
Review
Quoted 2 lines
(quoted diff) +2
-0+ unsigned long v = 0; + unsigned long long __res; \
Use a tab for v's indentation; checkpatch reports a warning here. Rename __res to a non-reserved identifier in both register-reading macros.
Quoted 3 lines
+/*\
+ * Simple test onarch_prctlto getFS_BASEandGS_BASE
+ */
Use the :manpage:arch_prctl(2) role and describe the actual assertion:
``ARCH_GET_FS`` and ``ARCH_GET_GS`` return the bases read independently by 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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v3 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
In reply to [email protected]From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 122 ++++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +122 -0
122 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 119 ++++++++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +119 -0
119 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 27
Quoted 7 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GSteststestcases/kernel/syscalls/arch_prctl/arch_prctl02.c +4
-0+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.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 86
Quoted 7 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c +7
-0+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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v5 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
In reply to [email protected]From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 119 ++++++++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +119 -0
119 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v6 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 122 ++++++++++++++++++ 5 files changed, 134 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +122 -0
122 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 83
Quoted 5 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GSteststestcases/kernel/syscalls/arch_prctl/arch_prctl02.c +2
-0+if (gs ==0 ) { +unsigned long long test_gs =0xabababab ;
Medium: Both exercised GS bases fit in 32 bits when the initial base is zero, so an ARCH_GET_GS implementation that drops the upper 32 bits still passes. Include a valid base above UINT32_MAX, such as 0x1ababababULL, to exercise the documented 64-bit result.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 89
Quoted 1 line
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c +1
-0+set_gs (orig_gs);
Medium: The restoration syscall's return value is discarded. Injecting EPERM here leaves GS nonzero, but -i 3 exits successfully with seven passes and silently skips the set/read case in subsequent iterations. Use TST_EXP_PASS_SILENT(set_gs(orig_gs)) and abort with TBROK on failure.
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v7 1/1 arch_prctl: add ARCH_GET_FS, ARCH_GET_GS tests
In reply to [email protected]From: Dmitry Chestnykh <[email protected]>
--- configure.ac | 1 + include/lapi/arch_prctl.h | 9 ++ runtest/syscalls | 1 + .../kernel/syscalls/arch_prctl/.gitignore | 1 + .../kernel/syscalls/arch_prctl/arch_prctl02.c | 124 ++++++++++++++++++ 5 files changed, 136 insertions(+) create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl02.c
configure.ac +1 -0
@@ -53,6 +53,7 @@ AC_CHECK_HEADERS_ONCE([ \ aio.h \ asm/ldt.h \ asm/prctl.h \ + asm/hwcap2.h \ cpuid.h \ emmintrin.h \ ifaddrs.h \
include/lapi/arch_prctl.h +9 -0
@@ -19,4 +19,13 @@# define ARCH_SET_CPUID 0x1012#endif +#ifdef __x86_64__ +# ifdef HAVE_ASM_HWCAP2_H +# include <asm/hwcap2.h> +# endif /* HAVE_ASM_HWCAP2_H */ +# ifndef HWCAP2_FSGSBASE +# define HWCAP2_FSGSBASE (1UL << 1) +# endif /* HWCAP2_FSGSBASE */ +#endif /* __x86_64__ */ +#endif /* LAPI_ARCH_PRCTL_H__ */
runtest/syscalls +1 -0
@@ -32,6 +32,7 @@ alarm06 alarm06 alarm07 alarm07 arch_prctl01 arch_prctl01 +arch_prctl02 arch_prctl02 bind01 bind01 bind02 bind02
testcases/kernel/syscalls/arch_prctl/.gitignore +1 -0
@@ -1 +1,2 @@ /arch_prctl01 +/arch_prctl02
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +124 -0
124 lines not on this page · raw message
--
2.56.0
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
Quoted 3 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GStestsSigned-off-by Dmitry Chestnykh <[email protected]>
The commit body lacks a rationale. Explain the coverage gap and why instruction reads are used as the independent oracle.
Quoted 5 lines
#ifdef
HAVE_GETAUXVAL# include <sys/auxv.h> #endifstatic void setup(void)
Quoted 8 lines
{ unsigned long long v = 0;#ifdef AT_HWCAP2 v = getauxval(AT_HWCAP2); #endif tag = v & HWCAP2_FSGSBASE ? true : false; }
Without getauxval support, v stays zero and run() incorrectly reports that the CPU/kernel does not support the instructions. Guard the entire test with HAVE_GETAUXVAL and use TST_TEST_TCONF() to report missing libc support, or provide an auxiliary-vector fallback.
Quoted 5 lines
#define READ_FS_BASE() ({ \ unsigned long long __res_fs; \#define READ_GS_BASE() ({ \ unsigned long long __res_gs; \
These double-underscore names are reserved to the implementation. Rename them to fs_base and gs_base.
Quoted 7 lines
static struct tcase {
unsigned int idx;
void (*test_fn)(void);
} tcases[] = {
{0, test_fs},
{1, test_gs}
};The table dispatches to separate per-case test functions rather than parameterizing a common comparison. Use one comparison handler with entries selecting the ARCH_GET operation and base reader; keep GS-specific preparation in a helper and remove the unused idx member.
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 82
Quoted 5 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GStests+++
b/testcases/kernel/syscalls/arch_prctl/arch_prctl02.ctestcases/kernel/syscalls/arch_prctl/arch_prctl02.c new file +2
-0+if (gs ==0 ) { +unsigned long long test_gs =0xabababab ;
Medium: When the original GS base is zero, both samples fit in 32 bits, so the test misses truncation in ARCH_GET_GS. A probe masking its result to 32 bits still reported all tests passed. Use a canonical user-space base with nonzero upper 32 bits, such as 0x1234ababababULL.
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Dmitry,
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 27
Quoted 7 lines · Dmitry Chestnykh
arch_prctl: addARCH_GET_FS,ARCH_GET_GSteststestcases/kernel/syscalls/arch_prctl/arch_prctl02.c +4
-0+static int arch_prctl_get (int code,unsigned long *out) +{ +return tst_syscall (__NR_arch_prctl, code, out); +}
High: On x32, unsigned long is four bytes, but these raw GET operations write eight bytes, overflowing fs_prctl and gs_prctl. Both __x86_64__ and the framework's x86_64 architecture check admit x32; glibc's x32 arch_prctl wrapper uses a uint64_t temporary, but tst_syscall bypasses it. Use uint64_t for the output pointer, both output objects, and comparison values.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 88
Quoted 7 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c +7
-0+if (gs ==0 ) { +unsigned long test_gs =0xabababab ; +TST_EXP_PASS_SILENT (set_gs (test_gs)); +if (TST_PASS ) { +TEST_GS_BASE (); + } + }
Low: GS remains nonzero after the first iteration, so subsequent -i iterations skip the zero-base comparison and ARCH_SET_GS branch; -i 3 produces seven comparisons rather than repeating all three each time. Restore the original GS base after the changed-base comparison.
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c line 101
Quoted 7 lines
testcases/kernel/syscalls/arch_prctl/arch_prctl02.c +7
-0+unsigned long long __res_fs; \ +unsigned long long __res_gs; \ +if (TST_PASS ) { +TEST_GS_BASE (); + } +unsigned idx; +static void run (unsigned index)
Low: check-arch_prctl02 reports missing blank lines after declarations, unnecessary single-statement braces, an unnecessary blank line before a closing brace, and bare unsigned declarations; fix these and use unsigned int. Rename __res_fs and __res_gs to avoid reserved identifiers.
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp