Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1560255 > unrolled thread

Re: arm: module: Add apply_relocate_add

Started byJessica Yu <jeyu@redhat.com>
First post2017-01-17 05:50 +0100
Last post2017-01-18 11:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: arm: module: Add apply_relocate_add Jessica Yu <jeyu@redhat.com> - 2017-01-17 05:50 +0100
    Re: arm: module: Add apply_relocate_add Miroslav Benes <mbenes@suse.cz> - 2017-01-18 11:40 +0100

#1560255 — Re: arm: module: Add apply_relocate_add

FromJessica Yu <jeyu@redhat.com>
Date2017-01-17 05:50 +0100
SubjectRe: arm: module: Add apply_relocate_add
Message-ID<t0tSx-2dE-5@gated-at.bofh.it>
+++ Abel Vesa [06/12/16 17:06 +0000]:
>It was only added to fix compiler error. It is not implemented
>yet.
>
>Signed-off-by: Abel Vesa <abelvesa@linux.com>
>---
> arch/arm/kernel/module.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
>index 4f14b5c..bf94922 100644
>--- a/arch/arm/kernel/module.c
>+++ b/arch/arm/kernel/module.c
>@@ -52,6 +52,15 @@ void *module_alloc(unsigned long size)
> #endif
>
> int
>+apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
>+		   unsigned int symindex, unsigned int relindex,
>+		   struct module *module)
>+{
>+	/* Not implemented yet */
>+	return 0;
>+}

Are SHT_RELA relocation sections actually supported on 32-bit arm? It looks
like there's only support for SHT_REL.

arch/arm/Kconfig:84:	select MODULES_USE_ELF_REL

If we support SHT_REL sections, the correct fix is to probably have
klp_write_object_relocations() check if the relocation section is
SHT_REL or SHT_RELA, and call the appropriate function (apply_relocate
or apply_relocate_add), similar to how the module loader does it.

Jessica

[toc] | [next] | [standalone]


#1561462

FromMiroslav Benes <mbenes@suse.cz>
Date2017-01-18 11:40 +0100
Message-ID<t0VON-2O5-9@gated-at.bofh.it>
In reply to#1560255
On Mon, 16 Jan 2017, Jessica Yu wrote:

> +++ Abel Vesa [06/12/16 17:06 +0000]:
> > It was only added to fix compiler error. It is not implemented
> > yet.
> > 
> > Signed-off-by: Abel Vesa <abelvesa@linux.com>
> > ---
> > arch/arm/kernel/module.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> > 
> > diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> > index 4f14b5c..bf94922 100644
> > --- a/arch/arm/kernel/module.c
> > +++ b/arch/arm/kernel/module.c
> > @@ -52,6 +52,15 @@ void *module_alloc(unsigned long size)
> > #endif
> > 
> > int
> > +apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
> > +		   unsigned int symindex, unsigned int relindex,
> > +		   struct module *module)
> > +{
> > +	/* Not implemented yet */
> > +	return 0;
> > +}
> 
> Are SHT_RELA relocation sections actually supported on 32-bit arm? It looks
> like there's only support for SHT_REL.
> 
> arch/arm/Kconfig:84:	select MODULES_USE_ELF_REL
> 
> If we support SHT_REL sections, the correct fix is to probably have
> klp_write_object_relocations() check if the relocation section is
> SHT_REL or SHT_RELA, and call the appropriate function (apply_relocate
> or apply_relocate_add), similar to how the module loader does it.

Agreed. According to arch/Kconfig and definitions you can use only one of 
MODULES_USE_ELF_REL and MODULES_USE_ELF_RELA. arm arch uses the former. So 
yes, I think we should use the same if/else construct from the module 
loader in klp_write_object_relocations()... and it should go with this 
patch set, because arm is the first arch to actually use SHT_REL and not 
SHT_RELA (iiuc). x86, s390 and powerpc (archs we support) use SHT_RELA.

Miroslav

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web