[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 5/5] xen/x86: livepatch: enable attaching callbacks


  • To: jbeulich@xxxxxxxx
  • From: Ryo Takakura <takakura@xxxxxxxxxxxxx>
  • Date: Tue, 3 Nov 2026 15:06:42 +0900
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6wJbRb4c11sycDgRMbqx2U9KFUPcOdk0j1e342MzWLg=; b=Nvh0la2tBsSmbdgo8imOXHk2pwXofTnUzf3D6KhVwusCqcq1iHgX2+Ge+eiurwt0HMNgNlpfiv9V23gTCQGbtksqwozSWcNOsE/Lbhj+MTJk26/ZjUrlp4IEBu+1mZLOx1nAk7uNxHO/XuopcdxioWQ7tKKekKqjDOl7SB5bAWG3ow7mwAq8zNJfIRbkYbhvdLPWqxTttRWmW1N4cViv3cof7hOZcS3wPHikbRA2/XOj16R/I4MkeDAG6vCuvTUUOd7v8Is7KWgzZDByW55t9OUlsZMqSf8NLlmCZ4RMCWYyRvC2VtRQB26g6j89CbvCscTLEg6Ysf5rUjCQne/Cqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ipx11jCxmVxJ5kNSm9jR0QVlmSv2Z4pgUHSRGTW5sNUPyK5+hxdN95dXz3bxLoUKkFMqPj6nV2npvAMfbn2wCVzsxPZ0DwUY0QEtJOR3GYY5PrkyHwZlioKvC3XNjlQCFuJb93SWH5FLPZD8GbJerMEXStTcERBebtkvT2j5KEG3cDaqTYfJjyBPuWPkH3UVh4bYC2Pn9GLLtdUL9SBA7rmGYsTPv3egA0+/RusJv9ePH6E7QoM736vKMp34UXa+67MMwzT4oARd62dkIXJsSeBDmu1VG648JnFJE/W556PMUW/xinA2f/T5lHCV5fofKci6utyWUvnqxqUVaXpjNQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-Id:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: Volodymyr_Babchuk@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, bertrand.marquis@xxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, ross.lagerwall@xxxxxxxxxx, sstabellini@xxxxxxxxxx, takakura@xxxxxxxxxxxxx, teddy.astie@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 03 Nov 2026 06:07:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, 26 Oct 2026 12:56:56 +0100, Jan Beulich wrote:
>On 26.10.2026 12:42, Andrew Cooper wrote:
>> On 23/10/2026 5:58 am, Ryo Takakura wrote:
>>> +FUNC(xen_livepatch_trace_caller)
>>> +        pushq   %rbp
>>> +        movq    %rsp, %rbp
>>> +        pushfq
>>> +
>>> +        /* Preserve general-purpose registers. */
>>> +        pushq   %rax
>>> +        pushq   %rcx
>>> +        pushq   %rdx
>>> +        pushq   %rsi
>>> +        pushq   %rdi
>>> +        pushq   %r8
>>> +        pushq   %r9
>>> +        pushq   %r10
>>> +        pushq   %r11
>>> +
>>> +        /*
>>> +         * xen_livepatch_trace_dispatcher(ip, parent_ip)
>>> +         *
>>> +         * ip: Address of the traced function.
>>> +         * parent_ip: Address where the traced function was called.
>>> +         */
>>> +        movq    8(%rbp), %rdi
>>> +        subq    $5, %rdi
>>> +        movq    16(%rbp), %rsi
>>> +        call    xen_livepatch_trace_dispatcher
>>> +
>>> +        /* Restore the saved state. */
>>> +        popq    %r11
>>> +        popq    %r10
>>> +        popq    %r9
>>> +        popq    %r8
>>> +        popq    %rdi
>>> +        popq    %rsi
>>> +        popq    %rdx
>>> +        popq    %rcx
>>> +        popq    %rax
>>> +        popfq
>>> +        popq    %rbp
>>> +        ret
>>> +END(xen_livepatch_trace_caller)
>> 
>> Just in case there's a problem doing this all in C...
>> 
>> No need for pushf or popf at all.  Flags are undefined at function
>> boundaries.
>> 
>> Please drop the q suffixes; they're all unnecessary here.
>> 
>> The ret needs to be RET for speculative mitigations.  (It's emitted as
>> JMP which will be turned back into a RET on safe system.)
>
>Just for completeness: "will" as in "will eventually"; see my still
>pending "x86: re-inline RET used in assembly code" (with me doing C side
>work still pending feedback for that initial, smaller change).

Understood. Thank you for the input.
I'll use RET in case the assembly trampoline remains.

Sincerely,
Ryo Takakura



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.