[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 06/16] livepatch: ARM/x86: Check displacement of old_addr and new_addr
On Fri, Sep 23, 2016 at 03:36:27PM +0100, Ross Lagerwall wrote: > On 09/21/2016 06:32 PM, Konrad Rzeszutek Wilk wrote: > > If the distance is too big we are in trouble - as our relocation > > distance can surely be clipped, or still have a valid width - but > > cause an overflow of distance. > > > > On various architectures the maximum displacement for a unconditional > > branch/jump varies. ARM32 is +/- 32MB, ARM64 is +/- 128MB while x86 > > for 32-bit relocations is +/- 2G. > > > > Note: On x86 we could use the 64-bit jmpq instruction which > > would provide much bigger displacement to do a jump, but we would > > still have issues with the new function not being able to reach > > any of the old functions (as all the relocations would assume 32-bit > > displacement). And "furthermore would require an register or > > memory location to load/store the address to." (From Jan). > > > > On ARM the conditional branch supports even a smaller displacement > > but fortunately we are not using that. > > Wouldn't this be simpler as a BUILD_BUG_ON() in arch_livepatch_init()? > > Something like BUILD_BUG_ON(((XEN_VIRT_END - NR_CPUS * PAGE_SIZE) - > XEN_VIRT_START) > ARCH_LIVEPATCH_RANGE)? > > And BUILD_BUG_ON(((XEN_VIRT_END - NR_CPUS * PAGE_SIZE) - XEN_VIRT_START) > > ARCH_LIVEPATCH_RANGE) > > And something similar for ARM... What does that have to with the payload? The displacement calculations(checks) are done when we load the payload. > > -- > Ross Lagerwall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |