lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <946da82b-4792-fd0b-9b01-d64bacb17578@efficios.com>
Date:   Mon, 30 Jan 2023 10:50:18 -0500
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     YueHaibing <yuehaibing@...wei.com>, pbonzini@...hat.com,
        shuah@...nel.org, gshan@...hat.com, peterz@...radead.org
Cc:     kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] KVM: selftests: Fix build error

On 2023-01-30 07:44, YueHaibing wrote:
> kvm selftests build fails with below info:
> 
> rseq_test.c:48:13: error: conflicting types for ‘sys_getcpu’; have ‘void(unsigned int *)’
>     48 | static void sys_getcpu(unsigned *cpu)
>        |             ^~~~~~~~~~
> In file included from rseq_test.c:23:
> ../rseq/rseq.c:82:12: note: previous definition of ‘sys_getcpu’ with type ‘int(unsigned int *, unsigned int *)’
>     82 | static int sys_getcpu(unsigned *cpu, unsigned *node)
>        |            ^~~~~~~~~~
> 
> commit 66d42ac73fc6 ("KVM: selftests: Make rseq compatible with glibc-2.35")
> has include "../rseq/rseq.c", and commit 99babd04b250 ("selftests/rseq: Implement rseq numa node id field selftest")
> add sys_getcpu() implement, so use sys_getcpu in rseq/rseq.c to fix this.
> 
> Fixes: 99babd04b250 ("selftests/rseq: Implement rseq numa node id field selftest")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>

Hi,

This patch replicates an already existing patch:

https://lore.kernel.org/all/20230106-fix-kvm-rseq-build-v1-1-b704d9831d02@kernel.org/

The original patch should be routed through the tip tree by Peter Zijlstra shortly.

Thanks,

Mathieu

> ---
>   tools/testing/selftests/kvm/rseq_test.c | 19 ++++++-------------
>   1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c
> index 3045fdf9bdf5..69ff39aa2991 100644
> --- a/tools/testing/selftests/kvm/rseq_test.c
> +++ b/tools/testing/selftests/kvm/rseq_test.c
> @@ -41,18 +41,6 @@ static void guest_code(void)
>   		GUEST_SYNC(0);
>   }
>   
> -/*
> - * We have to perform direct system call for getcpu() because it's
> - * not available until glic 2.29.
> - */
> -static void sys_getcpu(unsigned *cpu)
> -{
> -	int r;
> -
> -	r = syscall(__NR_getcpu, cpu, NULL, NULL);
> -	TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)", errno, strerror(errno));
> -}
> -
>   static int next_cpu(int cpu)
>   {
>   	/*
> @@ -249,7 +237,12 @@ int main(int argc, char *argv[])
>   			 * across the seq_cnt reads.
>   			 */
>   			smp_rmb();
> -			sys_getcpu(&cpu);
> +			/*
> +			 * We have to perform direct system call for getcpu() because it's
> +			 * not available until glic 2.29.
> +			 */
> +			r = sys_getcpu(&cpu, NULL);
> +			TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)", errno, strerror(errno));
>   			rseq_cpu = rseq_current_cpu_raw();
>   			smp_rmb();
>   		} while (snapshot != atomic_read(&seq_cnt));

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ