[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <392275844.358.1660133856396.JavaMail.zimbra@efficios.com>
Date: Wed, 10 Aug 2022 08:17:36 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Gavin Shan <gshan@...hat.com>, Florian Weimer <fweimer@...hat.com>,
kvmarm <kvmarm@...ts.cs.columbia.edu>,
KVM list <kvm@...r.kernel.org>,
linux-kselftest <linux-kselftest@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
maz <maz@...nel.org>, oliver upton <oliver.upton@...ux.dev>,
andrew jones <andrew.jones@...ux.dev>,
Sean Christopherson <seanjc@...gle.com>,
yihyu <yihyu@...hat.com>, shan gavin <shan.gavin@...il.com>
Subject: Re: [PATCH 1/2] KVM: selftests: Make rseq compatible with
glibc-2.35
----- On Aug 10, 2022, at 5:14 AM, Paolo Bonzini pbonzini@...hat.com wrote:
> On 8/9/22 14:21, Mathieu Desnoyers wrote:
>>> For kvm/selftests, there are 3 architectures involved actually. So we
>>> just need consider 4 cases: aarch64, x86, s390 and other. For other
>>> case, we just use __builtin_thread_pointer() to maintain code's
>>> integrity, but it's not called at all.
>>>
>>> I think kvm/selftest is always relying on glibc if I'm correct.
>> All those are handled in the rseq selftests and in librseq. Why duplicate all
>> that logic again?
>
> Yeah, rseq_test should reuse librseq code. The simplest way,
> if slightly hackish, is to do something like
>
> diff --git a/tools/testing/selftests/kvm/Makefile
> b/tools/testing/selftests/kvm/Makefile
> index 690b499c3471..6c192b0ec304 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -37,6 +37,7 @@ ifeq ($(ARCH),riscv)
> UNAME_M := riscv
> endif
>
> LIBKVM += lib/assert.c
> LIBKVM += lib/elf.c
> LIBKVM += lib/guest_modes.c
> @@ -198,7 +199,7 @@ endif
> CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
> -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
> -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
> - -I$(<D) -Iinclude/$(UNAME_M) -I.. $(EXTRA_CFLAGS) $(KHDR_INCLUDES)
> + -I$(<D) -Iinclude/$(UNAME_M) -I.. $(EXTRA_CFLAGS) $(KHDR_INCLUDES) -I../rseq
>
> no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
> $(CC) -Werror -no-pie -x c - -o "$$TMP", -no-pie)
>
>
> and just #include "../rseq/rseq.c" in rseq_test.c.
Hi Paolo,
Indeed, this hack seems to be a good approach to immediately fix things without
moving around all source files and headers. In the longer term, I'd prefer Sean's
proposal to move rseq.c to tools/lib/ (and to move rseq headers to tools/include/rseq/).
This can be done in a follow up phase though. I'll put a note on my todo list
for after I come back from vacation.
I'll be able to do this refactoring on top of this fix.
Thanks,
Mathieu
>
> Thanks,
>
> Paolo
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists