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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Jul 2021 14:57:37 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     isaku.yamahata@...el.com, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, erdemaktas@...gle.com,
        Connor Kuehl <ckuehl@...hat.com>,
        Sean Christopherson <seanjc@...gle.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     isaku.yamahata@...il.com, Xiaoyao Li <xiaoyao.li@...el.com>
Subject: Re: [RFC PATCH v2 06/69] KVM: TDX: add a helper function for kvm to
 call seamcall

On 03/07/21 00:04, isaku.yamahata@...el.com wrote:
> +
> +.Lseamcall:
> +	seamcall
> +	jmp	.Lseamcall_ret
> +.Lspurious_fault:
> +	call	kvm_spurious_fault
> +.Lseamcall_ret:
> +
> +	movq    (FRAME_OFFSET + 8)(%rsp), %rdi
> +	testq   %rdi, %rdi
> +	jz 1f
> +
> +	/* If ex is non-NULL, store extra return values into it. */
> +	movq    %rcx, TDX_SEAM_rcx(%rdi)
> +	movq    %rdx, TDX_SEAM_rdx(%rdi)
> +	movq    %r8,  TDX_SEAM_r8(%rdi)
> +	movq    %r9,  TDX_SEAM_r9(%rdi)
> +	movq    %r10, TDX_SEAM_r10(%rdi)
> +	movq    %r11, TDX_SEAM_r11(%rdi)
> +
> +1:
> +	FRAME_END
> +	ret
> +
> +	_ASM_EXTABLE(.Lseamcall, .Lspurious_fault)

Please use local labels and avoid unnecessary jmp, for example

1:
	seamcall
	movq	(FRAME_OFFSET + 8)(%rsp), %rdi
	testq	%rdi, %rdi
	jz	2f

	/* If ex is non-NULL, store extra return values into it. */
	movq    %rcx, TDX_SEAM_rcx(%rdi)
	movq    %rdx, TDX_SEAM_rdx(%rdi)
	movq    %r8,  TDX_SEAM_r8(%rdi)
	movq    %r9,  TDX_SEAM_r9(%rdi)
	movq    %r10, TDX_SEAM_r10(%rdi)
	movq    %r11, TDX_SEAM_r11(%rdi)
2:
	FRAME_END
	ret
3:
	/* Probably it helps to write an error code in %rax? */
	movq	$0x4000000500000000, %rax
	cmpb	$0, kvm_rebooting
	jne	2b
	ud2
	_ASM_EXTABLE(1b, 3b)

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ