Message ID | 5846B45B02000078001259E5@prv-mh.provo.novell.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Dec 06, 2016 at 04:51:39AM -0700, Jan Beulich wrote: > When iterating over sections, table entry zero needs to be ignored. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > --- a/xen/common/libelf/libelf-dominfo.c > +++ b/xen/common/libelf/libelf-dominfo.c > @@ -536,7 +536,7 @@ elf_errorstatus elf_xen_parse(struct elf > if ( xen_elfnotes == 0 ) > { > count = elf_shdr_count(elf); > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > --- a/xen/common/libelf/libelf-loader.c > +++ b/xen/common/libelf/libelf-loader.c > @@ -79,7 +79,7 @@ elf_errorstatus elf_init(struct elf_bina > > /* Find symbol table and symbol string table. */ > count = elf_shdr_count(elf); > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > --- a/xen/common/libelf/libelf-tools.c > +++ b/xen/common/libelf/libelf-tools.c > @@ -153,7 +153,7 @@ ELF_HANDLE_DECL(elf_shdr) elf_shdr_by_na > const char *sname; > unsigned i; > > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > > > > libelf: section index 0 is special > > When iterating over sections, table entry zero needs to be ignored. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > > --- a/xen/common/libelf/libelf-dominfo.c > +++ b/xen/common/libelf/libelf-dominfo.c > @@ -536,7 +536,7 @@ elf_errorstatus elf_xen_parse(struct elf > if ( xen_elfnotes == 0 ) > { > count = elf_shdr_count(elf); > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > --- a/xen/common/libelf/libelf-loader.c > +++ b/xen/common/libelf/libelf-loader.c > @@ -79,7 +79,7 @@ elf_errorstatus elf_init(struct elf_bina > > /* Find symbol table and symbol string table. */ > count = elf_shdr_count(elf); > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > --- a/xen/common/libelf/libelf-tools.c > +++ b/xen/common/libelf/libelf-tools.c > @@ -153,7 +153,7 @@ ELF_HANDLE_DECL(elf_shdr) elf_shdr_by_na > const char *sname; > unsigned i; > > - for ( i = 0; i < count; i++ ) > + for ( i = 1; i < count; i++ ) > { > shdr = elf_shdr_by_index(elf, i); > if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > https://lists.xen.org/xen-devel
On Tue, Dec 06, 2016 at 04:51:39AM -0700, Jan Beulich wrote: > When iterating over sections, table entry zero needs to be ignored. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
--- a/xen/common/libelf/libelf-dominfo.c +++ b/xen/common/libelf/libelf-dominfo.c @@ -536,7 +536,7 @@ elf_errorstatus elf_xen_parse(struct elf if ( xen_elfnotes == 0 ) { count = elf_shdr_count(elf); - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) --- a/xen/common/libelf/libelf-loader.c +++ b/xen/common/libelf/libelf-loader.c @@ -79,7 +79,7 @@ elf_errorstatus elf_init(struct elf_bina /* Find symbol table and symbol string table. */ count = elf_shdr_count(elf); - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) ) --- a/xen/common/libelf/libelf-tools.c +++ b/xen/common/libelf/libelf-tools.c @@ -153,7 +153,7 @@ ELF_HANDLE_DECL(elf_shdr) elf_shdr_by_na const char *sname; unsigned i; - for ( i = 0; i < count; i++ ) + for ( i = 1; i < count; i++ ) { shdr = elf_shdr_by_index(elf, i); if ( !elf_access_ok(elf, ELF_HANDLE_PTRVAL(shdr), 1) )