linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the livepatching tree with the modules tree
@ 2020-05-08  8:05 Stephen Rothwell
  2020-05-11 11:43 ` Miroslav Benes
  2020-06-05  4:45 ` Stephen Rothwell
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Rothwell @ 2020-05-08  8:05 UTC (permalink / raw)
  To: Jiri Kosina, Josh Poimboeuf, Miroslav Benes, Petr Mladek,
	Joe Lawrence, Jessica Yu
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Peter Zijlstra

[-- Attachment #1: Type: text/plain, Size: 2334 bytes --]

Hi all,

Today's linux-next merge of the livepatching tree got a conflict in:

  kernel/module.c

between commits:

  db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs")
  5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX")

from the modules tree and commit:

  e6eff4376e28 ("module: Make module_enable_ro() static again")

from the livepatching tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/module.c
index c69291362676,a26343ea4d50..000000000000
--- a/kernel/module.c
+++ b/kernel/module.c
@@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru
  	frob_writable_data(&mod->init_layout, set_memory_nx);
  }
  
 +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
 +				       char *secstrings, struct module *mod)
 +{
 +	const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR;
 +	int i;
 +
 +	for (i = 0; i < hdr->e_shnum; i++) {
 +		if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
 +			return -ENOEXEC;
 +	}
 +
 +	return 0;
 +}
 +
  #else /* !CONFIG_STRICT_MODULE_RWX */
 +/* module_{enable,disable}_ro() stubs are in module.h */
  static void module_enable_nx(const struct module *mod) { }
+ static void module_enable_ro(const struct module *mod, bool after_init) {}
 -#endif /*  CONFIG_STRICT_MODULE_RWX */
 -static void module_enable_x(const struct module *mod)
 +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
 +				       char *secstrings, struct module *mod)
  {
 -	frob_text(&mod->core_layout, set_memory_x);
 -	frob_text(&mod->init_layout, set_memory_x);
 +	return 0;
  }
 -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
 -static void module_enable_nx(const struct module *mod) { }
 -static void module_enable_x(const struct module *mod) { }
 -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
 -
 +#endif /*  CONFIG_STRICT_MODULE_RWX */
  
  #ifdef CONFIG_LIVEPATCH
  /*

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: manual merge of the livepatching tree with the modules tree
  2020-05-08  8:05 linux-next: manual merge of the livepatching tree with the modules tree Stephen Rothwell
@ 2020-05-11 11:43 ` Miroslav Benes
  2020-06-05  4:45 ` Stephen Rothwell
  1 sibling, 0 replies; 5+ messages in thread
From: Miroslav Benes @ 2020-05-11 11:43 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Jiri Kosina, Josh Poimboeuf, Petr Mladek, Joe Lawrence,
	Jessica Yu, Linux Next Mailing List, Linux Kernel Mailing List,
	Peter Zijlstra

On Fri, 8 May 2020, Stephen Rothwell wrote:

> Hi all,
> 
> Today's linux-next merge of the livepatching tree got a conflict in:
> 
>   kernel/module.c
> 
> between commits:
> 
>   db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs")
>   5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX")
> 
> from the modules tree and commit:
> 
>   e6eff4376e28 ("module: Make module_enable_ro() static again")
> 
> from the livepatching tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc kernel/module.c
> index c69291362676,a26343ea4d50..000000000000
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru
>   	frob_writable_data(&mod->init_layout, set_memory_nx);
>   }
>   
>  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>  +				       char *secstrings, struct module *mod)
>  +{
>  +	const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR;
>  +	int i;
>  +
>  +	for (i = 0; i < hdr->e_shnum; i++) {
>  +		if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
>  +			return -ENOEXEC;
>  +	}
>  +
>  +	return 0;
>  +}
>  +
>   #else /* !CONFIG_STRICT_MODULE_RWX */
>  +/* module_{enable,disable}_ro() stubs are in module.h */

The line should go away too as part of the final conflict resolution, but 
we'll have to deal with that later while sending pull requests.

Otherwise it looks good.

Thanks
Miroslav

>   static void module_enable_nx(const struct module *mod) { }
> + static void module_enable_ro(const struct module *mod, bool after_init) {}
>  -#endif /*  CONFIG_STRICT_MODULE_RWX */
>  -static void module_enable_x(const struct module *mod)
>  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>  +				       char *secstrings, struct module *mod)
>   {
>  -	frob_text(&mod->core_layout, set_memory_x);
>  -	frob_text(&mod->init_layout, set_memory_x);
>  +	return 0;
>   }
>  -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>  -static void module_enable_nx(const struct module *mod) { }
>  -static void module_enable_x(const struct module *mod) { }
>  -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>  -
>  +#endif /*  CONFIG_STRICT_MODULE_RWX */
>   
>   #ifdef CONFIG_LIVEPATCH
>   /*
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: manual merge of the livepatching tree with the modules tree
  2020-05-08  8:05 linux-next: manual merge of the livepatching tree with the modules tree Stephen Rothwell
  2020-05-11 11:43 ` Miroslav Benes
@ 2020-06-05  4:45 ` Stephen Rothwell
  2020-06-05  6:56   ` Jiri Kosina
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2020-06-05  4:45 UTC (permalink / raw)
  To: Jiri Kosina, Josh Poimboeuf, Miroslav Benes, Petr Mladek,
	Joe Lawrence, Jessica Yu
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Peter Zijlstra

[-- Attachment #1: Type: text/plain, Size: 2228 bytes --]

Hi all,

On Fri, 8 May 2020 18:05:24 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the livepatching tree got a conflict in:
> 
>   kernel/module.c
> 
> between commits:
> 
>   db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs")
>   5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX")
> 
> from the modules tree and commit:
> 
>   e6eff4376e28 ("module: Make module_enable_ro() static again")
> 
> from the livepatching tree.
> 
> diff --cc kernel/module.c
> index c69291362676,a26343ea4d50..000000000000
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru
>   	frob_writable_data(&mod->init_layout, set_memory_nx);
>   }
>   
>  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>  +				       char *secstrings, struct module *mod)
>  +{
>  +	const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR;
>  +	int i;
>  +
>  +	for (i = 0; i < hdr->e_shnum; i++) {
>  +		if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
>  +			return -ENOEXEC;
>  +	}
>  +
>  +	return 0;
>  +}
>  +
>   #else /* !CONFIG_STRICT_MODULE_RWX */
>  +/* module_{enable,disable}_ro() stubs are in module.h */
>   static void module_enable_nx(const struct module *mod) { }
> + static void module_enable_ro(const struct module *mod, bool after_init) {}
>  -#endif /*  CONFIG_STRICT_MODULE_RWX */
>  -static void module_enable_x(const struct module *mod)
>  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>  +				       char *secstrings, struct module *mod)
>   {
>  -	frob_text(&mod->core_layout, set_memory_x);
>  -	frob_text(&mod->init_layout, set_memory_x);
>  +	return 0;
>   }
>  -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>  -static void module_enable_nx(const struct module *mod) { }
>  -static void module_enable_x(const struct module *mod) { }
>  -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>  -
>  +#endif /*  CONFIG_STRICT_MODULE_RWX */
>   
>   #ifdef CONFIG_LIVEPATCH
>   /*

This is now a conflict between the modules tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: manual merge of the livepatching tree with the modules tree
  2020-06-05  4:45 ` Stephen Rothwell
@ 2020-06-05  6:56   ` Jiri Kosina
  2020-06-05  7:37     ` Jessica Yu
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2020-06-05  6:56 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Josh Poimboeuf, Miroslav Benes, Petr Mladek, Joe Lawrence,
	Jessica Yu, Linux Next Mailing List, Linux Kernel Mailing List,
	Peter Zijlstra

On Fri, 5 Jun 2020, Stephen Rothwell wrote:

> > Today's linux-next merge of the livepatching tree got a conflict in:
> > 
> >   kernel/module.c
> > 
> > between commits:
> > 
> >   db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs")
> >   5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX")
> > 
> > from the modules tree and commit:
> > 
> >   e6eff4376e28 ("module: Make module_enable_ro() static again")
> > 
> > from the livepatching tree.
> > 
> > diff --cc kernel/module.c
> > index c69291362676,a26343ea4d50..000000000000
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru
> >   	frob_writable_data(&mod->init_layout, set_memory_nx);
> >   }
> >   
> >  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
> >  +				       char *secstrings, struct module *mod)
> >  +{
> >  +	const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR;
> >  +	int i;
> >  +
> >  +	for (i = 0; i < hdr->e_shnum; i++) {
> >  +		if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
> >  +			return -ENOEXEC;
> >  +	}
> >  +
> >  +	return 0;
> >  +}
> >  +
> >   #else /* !CONFIG_STRICT_MODULE_RWX */
> >  +/* module_{enable,disable}_ro() stubs are in module.h */
> >   static void module_enable_nx(const struct module *mod) { }
> > + static void module_enable_ro(const struct module *mod, bool after_init) {}
> >  -#endif /*  CONFIG_STRICT_MODULE_RWX */
> >  -static void module_enable_x(const struct module *mod)
> >  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
> >  +				       char *secstrings, struct module *mod)
> >   {
> >  -	frob_text(&mod->core_layout, set_memory_x);
> >  -	frob_text(&mod->init_layout, set_memory_x);
> >  +	return 0;
> >   }
> >  -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
> >  -static void module_enable_nx(const struct module *mod) { }
> >  -static void module_enable_x(const struct module *mod) { }
> >  -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
> >  -
> >  +#endif /*  CONFIG_STRICT_MODULE_RWX */
> >   
> >   #ifdef CONFIG_LIVEPATCH
> >   /*
> 
> This is now a conflict between the modules tree and Linus' tree.

I've made Linus aware of this coming when sending livepatching tree, but 
given the fact that the modules tree hasn't been merged yet, Jessica, I 
believe it'd make sense to point it out again once sending your tree.

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: manual merge of the livepatching tree with the modules tree
  2020-06-05  6:56   ` Jiri Kosina
@ 2020-06-05  7:37     ` Jessica Yu
  0 siblings, 0 replies; 5+ messages in thread
From: Jessica Yu @ 2020-06-05  7:37 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Stephen Rothwell, Josh Poimboeuf, Miroslav Benes, Petr Mladek,
	Joe Lawrence, Linux Next Mailing List, Linux Kernel Mailing List,
	Peter Zijlstra

+++ Jiri Kosina [05/06/20 08:56 +0200]:
>On Fri, 5 Jun 2020, Stephen Rothwell wrote:
>
>> > Today's linux-next merge of the livepatching tree got a conflict in:
>> >
>> >   kernel/module.c
>> >
>> > between commits:
>> >
>> >   db991af02f11 ("module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs")
>> >   5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX")
>> >
>> > from the modules tree and commit:
>> >
>> >   e6eff4376e28 ("module: Make module_enable_ro() static again")
>> >
>> > from the livepatching tree.
>> >
>> > diff --cc kernel/module.c
>> > index c69291362676,a26343ea4d50..000000000000
>> > --- a/kernel/module.c
>> > +++ b/kernel/module.c
>> > @@@ -2055,29 -2023,20 +2042,30 @@@ static void module_enable_nx(const stru
>> >   	frob_writable_data(&mod->init_layout, set_memory_nx);
>> >   }
>> >
>> >  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>> >  +				       char *secstrings, struct module *mod)
>> >  +{
>> >  +	const unsigned long shf_wx = SHF_WRITE|SHF_EXECINSTR;
>> >  +	int i;
>> >  +
>> >  +	for (i = 0; i < hdr->e_shnum; i++) {
>> >  +		if ((sechdrs[i].sh_flags & shf_wx) == shf_wx)
>> >  +			return -ENOEXEC;
>> >  +	}
>> >  +
>> >  +	return 0;
>> >  +}
>> >  +
>> >   #else /* !CONFIG_STRICT_MODULE_RWX */
>> >  +/* module_{enable,disable}_ro() stubs are in module.h */
>> >   static void module_enable_nx(const struct module *mod) { }
>> > + static void module_enable_ro(const struct module *mod, bool after_init) {}
>> >  -#endif /*  CONFIG_STRICT_MODULE_RWX */
>> >  -static void module_enable_x(const struct module *mod)
>> >  +static int module_enforce_rwx_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
>> >  +				       char *secstrings, struct module *mod)
>> >   {
>> >  -	frob_text(&mod->core_layout, set_memory_x);
>> >  -	frob_text(&mod->init_layout, set_memory_x);
>> >  +	return 0;
>> >   }
>> >  -#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>> >  -static void module_enable_nx(const struct module *mod) { }
>> >  -static void module_enable_x(const struct module *mod) { }
>> >  -#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
>> >  -
>> >  +#endif /*  CONFIG_STRICT_MODULE_RWX */
>> >
>> >   #ifdef CONFIG_LIVEPATCH
>> >   /*
>>
>> This is now a conflict between the modules tree and Linus' tree.
>
>I've made Linus aware of this coming when sending livepatching tree, but
>given the fact that the modules tree hasn't been merged yet, Jessica, I
>believe it'd make sense to point it out again once sending your tree.

Yep, will do. Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-05  7:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  8:05 linux-next: manual merge of the livepatching tree with the modules tree Stephen Rothwell
2020-05-11 11:43 ` Miroslav Benes
2020-06-05  4:45 ` Stephen Rothwell
2020-06-05  6:56   ` Jiri Kosina
2020-06-05  7:37     ` Jessica Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).