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

Re: [Xen-devel] [PATCH v5 1/2] xen/PVH: Set up GS segment for stack canary



>>> On 23.05.18 at 16:30, <boris.ostrovsky@xxxxxxxxxx> wrote:
> @@ -98,6 +101,12 @@ ENTRY(pvh_start_xen)
>       /* 64-bit entry point. */
>       .code64
>  1:
> +     /* Set base address in stack canary descriptor. */
> +     mov $MSR_GS_BASE,%ecx
> +     mov $_pa(canary), %rax
> +     xor %rdx, %rdx

Why rax and rdx instead of eax and edx? In the former case, the
relocation produced might confuse whatever entity processing it
(it'll have a sign-extended 32-bit quantity to deal with, which
wouldn't allow representing an address in the [2Gb, 4Gb) range).
In the latter case, while surely neither performance nor code size
matter much here, it's still a bad precedent (people copy-and-paste
code all the time): Zero-ing of registers should generally use the
32-bit forms of the insn. Gas has actually gained an optimization
mode recently (upon request from Linus and the x86 maintainers)
to silently "repair" such inefficiencies.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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