public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/9] KVM: Disable EBP register use in 32bit code
Date: Mon, 6 May 2024 21:41:56 +0200	[thread overview]
Message-ID: <20240506194156.GA38981@pevik> (raw)
In-Reply-To: <20240430122208.13043-2-mdoucha@suse.cz>

Hi Martin,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> The EBP register points to the stack segment by default but GCC uses
> it to access data segment without the proper prefix. This works fine
> on most systems because the stack and data segments are usually
> identical. However, KVM environment intentionally enforces strict
> limits on the stack segment and access to the data segment using
> unprefixed EBP would trigger stack segment fault exception in 32bit
> LTP builds (stack segment limits are ignored in 64bit mode).

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  testcases/kernel/kvm/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
> index ce4a5ede2..c85790e11 100644
> --- a/testcases/kernel/kvm/Makefile
> +++ b/testcases/kernel/kvm/Makefile
> @@ -22,7 +22,7 @@ ifeq ($(HOST_CPU),x86_64)
>  endif

>  ifeq ($(HOST_CPU),x86)
> -	GUEST_CFLAGS += -m32
> +	GUEST_CFLAGS += -m32 -ffixed-ebp

FYI this will fail on 32 bit build on clang:

clang: error: unknown argument: '-ffixed-ebp'

I don't want to block this patchset which brings important test, but it'd be
great to fix it.

Is there clang equivalent? Or is it even needed for clang?

Either way, we need to detect clang. I don't think simple

ifeq ($(CXX),clang)

would be enough, because cc can be alias to clang.

Maybe wrap it with version detection:

ifeq ($(shell $(CC) -v 2>&1 | grep "clang version"), 1)
	GUEST_CFLAGS += -ffixed-ebp
endif

Kind regards,
Petr

>  	ASFLAGS += --32
>  endif

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

  reply	other threads:[~2024-05-06 19:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 12:21 [LTP] [PATCH 0/9] Add functional test for AMD VMSAVE/VMLOAD instructions Martin Doucha
2024-04-30 12:21 ` [LTP] [PATCH 1/9] KVM: Disable EBP register use in 32bit code Martin Doucha
2024-05-06 19:41   ` Petr Vorel [this message]
2024-05-07 14:10     ` Martin Doucha
2024-05-07 14:22       ` Petr Vorel
2024-05-07 14:25       ` Petr Vorel
2024-05-07 14:45         ` Martin Doucha
2024-04-30 12:21 ` [LTP] [PATCH 2/9] KVM: Implement strchr() and basic sprintf() Martin Doucha
2024-04-30 12:21 ` [LTP] [PATCH 3/9] KVM: Implement printf-like formatting for tst_res() and tst_brk() Martin Doucha
2024-04-30 12:22 ` [LTP] [PATCH 4/9] kvm_svm02: Fix saved stack segment index value Martin Doucha
2024-04-30 12:22 ` [LTP] [PATCH 5/9] kvm_find_free_descriptor(): Skip descriptor 0 Martin Doucha
2024-04-30 12:22 ` [LTP] [PATCH 6/9] KVM: Add system control MSR constants Martin Doucha
2024-04-30 12:22 ` [LTP] [PATCH 7/9] KVM: Add VMSAVE/VMLOAD functions to x86 SVM library Martin Doucha
2024-05-07 14:57   ` Petr Vorel
2024-04-30 12:22 ` [LTP] [PATCH 8/9] KVM: Add functional test for VMSAVE/VMLOAD instructions Martin Doucha
2024-04-30 12:22 ` [LTP] [PATCH 9/9] KVM: Move kvm_pagefault01 to the end of KVM runfile Martin Doucha
2024-05-06  4:34   ` Petr Vorel
2024-05-07 14:59   ` Petr Vorel

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=20240506194156.GA38981@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mdoucha@suse.cz \
    /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