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

Re: [Xen-devel] [PATCH v4 04/11] livepatch/arm[32, 64]: Don't load and crash on livepatches loaded with wrong text alignment.



>>> On 21.09.17 at 00:31, <konrad@xxxxxxxxxx> wrote:

> @@ -272,6 +271,16 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
>                      elf->name, symndx);
>              return -EINVAL;
>          }
> +        else if ( (type != R_ARM_ABS32 && type != R_ARM_REL32) /* Only check 
> code. */ &&
> +                  ((uint32_t)dest % sizeof(uint32_t)) )
> +        {
> +            dprintk(XENLOG_ERR, LIVEPATCH "%s: dest=%p (%s) is not aligned 
> properly!\n",
> +                    elf->name, dest, base->name);
> +            return -EINVAL;
> +        }

And no similar check being added to ARM64? Looking at that code I
also notice that the general "minimum 32-bit width" there is likely
wrong for at least ABS16 and PREL16.

> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -473,6 +473,13 @@ static bool section_ok(const struct livepatch_elf *elf,
>          return false;
>      }
>  
> +    if ( !arch_livepatch_verify_alignment(sec) )
> +    {
> +        dprintk(XENLOG_ERR, LIVEPATCH "%s: %s text section is not aligned 
> properly!\n",
> +               elf->name, sec->name);

If you really mean to say "text section" here, then the SHF_EXECINSTR
check should move here too.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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