> > +int arch_livepatch_perform_rela(struct livepatch_elf *elf,
> > +                                const struct livepatch_elf_sec *base,
> > +                                const struct livepatch_elf_sec *rela)
> > +{
.. snip..
> > +        switch ( ELF64_R_TYPE(r->r_info) ) {
> > +        /* Data */
> > +        case R_AARCH64_ABS64:
> > +            if ( r->r_offset + sizeof(uint64_t) > base->sec->sh_size )
> > +                goto bad_offset;
> 
> As you borrow the code from Linux, could we keep the abstraction with
> reloc_data and defer the overflow check? It would avoid to have the same if
> in multiple place in this code.

The above 'if' conditional is a check to make sure that we don't
go past the section (sh_size). In other words it is a boundary check to
make sure the Elf file is not messed up.

I can still copy the reloc_data so we lessen the:
> > +            if ( (int64_t)val !=  *(int32_t *)dest )
> > +                err = -EOVERFLOW;

And such.

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

Reply via email to