public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: 路斐 <lufei@uniontech.com>
To: "Cyril Hrubis" <chrubis@suse.cz>
Cc: ltp <ltp@lists.linux.it>
Subject: Re: [LTP] (no subject)
Date: Fri, 26 Apr 2024 20:27:15 +0800	[thread overview]
Message-ID: <tencent_009ECE842B1AB962044FA740@qq.com> (raw)
In-Reply-To: <ZiuB6-9qKfhXrRzg@yuki>

Hi, Cyril.
Here is my case:


```
[root@rocky arch_prctl]# gcc --version
gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.&nbsp; There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@rocky arch_prctl]# uname -a
Linux rocky 5.14.0-362.18.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 11 13:49:23 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

[root@rocky arch_prctl]# cat arch_prctl01.c&nbsp;
// SPDX-License-Identifier: GPL-2.0-or-later
/*
&nbsp;* Copyright (c) UnionTech Software Technology Co.,Ltd., 2024
&nbsp;* Author: Lu Fei <lufei@uniontech.com&gt;
&nbsp;*/


/*\
&nbsp;* [Description]
&nbsp;*
&nbsp;* Simple test on arch_prctl to set and get cpuid instruction of test thread.
&nbsp;*/


#include "tst_test.h"
#include "lapi/syscalls.h"
#include <stdlib.h&gt;
#ifdef HAVE_ASM_PRCTL_H
#include <asm/prctl.h&gt;


static int arch_prctl_get(int code, unsigned long *addr)
{
	return tst_syscall(__NR_arch_prctl, code, *addr);
}


static int arch_prctl_set(int code, unsigned long addr)
{
	return tst_syscall(__NR_arch_prctl, code, addr);
}


static void run(unsigned int index)
{
	unsigned long *addr = malloc(sizeof(long));


	// index == 0 for disable cpuid, 1 for enable cpuid.
	TST_EXP_PASS(arch_prctl_set(ARCH_SET_CPUID, index));


	TEST(arch_prctl_get(ARCH_GET_CPUID, addr));


	if (TST_RET == index)
		tst_res(TPASS, "get cpuid succeed.");
	else
		tst_res(TFAIL, "get cpuid failed.");
}


static struct tst_test test = {
	.test = run,
	.tcnt = 2,
	.min_kver = "4.12",
	.supported_archs = {"x86_64", "x86", NULL},
};


#else /* HAVE_ASM_PRCTL_H */
TST_TEST_TCONF("missing <asm/prctl.h&gt;");
#endif
[root@rocky arch_prctl]# make clean
rm -f -f -r arch_prctl01&nbsp; *.o *.pyc .cache.mk *.dwo .*.dwo
[root@rocky arch_prctl]# make check
CHECK testcases/kernel/syscalls/arch_prctl/arch_prctl01.c
arch_prctl01.c:48:10: warning: bogus scalar initializer
[root@rocky arch_prctl]# make
make -C "/root/Develop/ltp/lib" -f "/root/Develop/ltp/lib/Makefile" all
make[1]: Entering directory '/root/Develop/ltp/lib'
GEN ltp-version.h
make[2]: Nothing to be done for 'all'.
make[2]: Nothing to be done for 'all'.
make[1]: Leaving directory '/root/Develop/ltp/lib'
arch_prctl01.c:48:9: warning: braces around scalar initializer
&nbsp; &nbsp;48 |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.supported_archs = {"x86_64", "x86", NULL},
&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^
arch_prctl01.c:48:9: note: (near initialization for ‘test.supported_archs’)
arch_prctl01.c:48:29: warning: initialization of ‘const char * const*’ from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
&nbsp; &nbsp;48 |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.supported_archs = {"x86_64", "x86", NULL},
&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^~~~~~~~
arch_prctl01.c:48:29: note: (near initialization for ‘test.supported_archs’)
arch_prctl01.c:48:39: warning: excess elements in scalar initializer
&nbsp; &nbsp;48 |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.supported_archs = {"x86_64", "x86", NULL},
&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^~~~~
arch_prctl01.c:48:39: note: (near initialization for ‘test.supported_archs’)
arch_prctl01.c:48:46: warning: excess elements in scalar initializer
&nbsp; &nbsp;48 |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.supported_archs = {"x86_64", "x86", NULL},
&nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^~~~
arch_prctl01.c:48:46: note: (near initialization for ‘test.supported_archs’)
CC testcases/kernel/syscalls/arch_prctl/arch_prctl01
```







 路斐 Fei.Lu
Uniontech Technology
site: www.uniontech.com
tel: 18501012352
addr: Xi'an China



 

&nbsp;
&nbsp;
&nbsp;
------------------&nbsp;Original&nbsp;------------------
From: &nbsp;"Cyril&nbsp;Hrubis"<chrubis@suse.cz&gt;;
Date: &nbsp;Fri, Apr 26, 2024 06:30 PM
To: &nbsp;"路斐"<lufei@uniontech.com&gt;; 
Cc: &nbsp;"ltp"<ltp@lists.linux.it&gt;; 
Subject: &nbsp;Re: Re:

&nbsp;

Hi!
&gt; I tried using NULL, but met `TBROK: Test killed by SIGSEGV!`.&amp;nbsp;

That means that the manual page is wrong and the address is not ignored.

&gt; And the last time you mentioned in response to using
&gt; `supported_archs`, this seems not work properly by now, the ltp
&gt; document(section of writing_tests) says "not applicable".

The supported_archs is supposed to work. How did you set it (the value)
and what happened?

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2024-04-26 12:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  7:07 [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-19 15:46 ` Cyril Hrubis
2024-04-21  6:25 ` lufei
2024-04-21  7:15 ` [LTP] (no subject) lufei
2024-04-21  7:15   ` [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-26  8:36   ` [LTP] (no subject) Cyril Hrubis
2024-04-26  9:42     ` 路斐
2024-04-26 10:28       ` Cyril Hrubis
2024-04-26 12:27         ` 路斐 [this message]
2024-04-26 12:47           ` Jan Stancek
2024-04-23  1:05 ` [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-28  7:44 ` [LTP] (no subject) lufei
2024-04-28  7:44   ` [LTP] [PATCH] Add case about arch_prctl syscall lufei
2024-04-29 15:02     ` Cyril Hrubis
     [not found]     ` <20240506070336.2711930-1-lufei@uniontech.com>
2024-05-06  7:03       ` lufei
2024-05-06  9:53         ` Cyril Hrubis
     [not found]         ` <20240507043235.1692-1-lufei@uniontech.com>
2024-05-07  4:32           ` lufei
2024-05-07 12:50             ` Cyril Hrubis
2024-05-08  2:29               ` 路斐
     [not found]             ` <20240508015852.3362-1-lufei@uniontech.com>
2024-05-08  1:58               ` lufei
2024-05-09 10:27                 ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2025-01-14 15:37 [LTP] (no subject) Avinesh Kumar
2024-08-14  6:38 Indumathi Raju
2024-08-26 11:50 ` Cyril Hrubis
     [not found] <tencent_048887541FB562D43FE2D104@qq.com>
2024-04-28  7:16 ` =?gb18030?B?wrfssw==?=
2021-11-15  8:15 Joerg Vehlow
2019-10-07  6:45 Joerg Vehlow
2019-10-07  6:53 ` Joerg Vehlow
2019-08-21  2:25 Jim Woo
2019-08-22 12:45 ` Cyril Hrubis
2014-03-07 11:39 [LTP] [PATCH 1/2] add tst_get_unused_port() Jan Stancek
2014-03-10 14:22 ` [LTP] (no subject) Jan Stancek
2013-08-05 14:44 Stanislav Kholmanskikh
2009-07-01 20:08 Henry Yei
2009-06-24 22:58 Henry Yei

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=tencent_009ECE842B1AB962044FA740@qq.com \
    --to=lufei@uniontech.com \
    --cc=chrubis@suse.cz \
    --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