All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the modules tree with the  tree
@ 2012-10-22  1:35 Stephen Rothwell
  2012-10-22  2:09 ` Kees Cook
  2012-10-24  0:21 ` Rusty Russell
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Rothwell @ 2012-10-22  1:35 UTC (permalink / raw)
  To: Rusty Russell
  Cc: linux-next, linux-kernel, David Howells, Linus, Kees Cook,
	Andrew Morton

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

Hi Rusty,

Today's linux-next merge of the modules tree got a conflict in
kernel/module.c between commit caabe240574a ("MODSIGN: Move the magic
string to the end of a module and eliminate the search") from Linus' tree
and commit 0250abdeec54 ("module: add syscall to load module from fd")
from the modules tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

I do wonder why the above change in Linus' tree seems to have bypassed
the modules maintainer.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc kernel/module.c
index 6085f5e,261bf82..0000000
--- a/kernel/module.c
+++ b/kernel/module.c
@@@ -2420,18 -2422,27 +2422,18 @@@ static inline void kmemleak_load_module
  #endif
  
  #ifdef CONFIG_MODULE_SIG
- static int module_sig_check(struct load_info *info,
- 			    const void *mod, unsigned long *_len)
+ static int module_sig_check(struct load_info *info)
  {
  	int err = -ENOKEY;
- 	unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
- 	unsigned long len = *_len;
+ 	const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
+ 	const void *mod = info->hdr;
 -	const void *p = mod, *end = mod + info->len;
++	unsigned long len = info->len;
  
 -	/* Poor man's memmem. */
 -	while ((p = memchr(p, MODULE_SIG_STRING[0], end - p))) {
 -		if (p + markerlen > end)
 -			break;
 -
 -		if (memcmp(p, MODULE_SIG_STRING, markerlen) == 0) {
 -			const void *sig = p + markerlen;
 -			/* Truncate module up to signature. */
 -			info->len = p - mod;
 -			err = mod_verify_sig(mod, info->len,
 -					     sig, end - sig);
 -			break;
 -		}
 -		p++;
 +	if (len > markerlen &&
 +	    memcmp(mod + len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
 +		/* We truncate the module to discard the signature */
- 		*_len -= markerlen;
- 		err = mod_verify_sig(mod, _len);
++		info->len -= markerlen;
++		err = mod_verify_sig(mod, &info->len);
  	}
  
  	if (!err) {

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: linux-next: manual merge of the modules tree with the tree
  2012-10-22  1:35 linux-next: manual merge of the modules tree with the tree Stephen Rothwell
@ 2012-10-22  2:09 ` Kees Cook
  2012-10-24  0:21 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2012-10-22  2:09 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Rusty Russell, linux-next, linux-kernel, David Howells, Linus,
	Andrew Morton

On Sun, Oct 21, 2012 at 6:35 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Rusty,
>
> Today's linux-next merge of the modules tree got a conflict in
> kernel/module.c between commit caabe240574a ("MODSIGN: Move the magic
> string to the end of a module and eliminate the search") from Linus' tree
> and commit 0250abdeec54 ("module: add syscall to load module from fd")
> from the modules tree.
>
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).
>
> I do wonder why the above change in Linus' tree seems to have bypassed
> the modules maintainer.
>
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au
>
> diff --cc kernel/module.c
> index 6085f5e,261bf82..0000000
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@@ -2420,18 -2422,27 +2422,18 @@@ static inline void kmemleak_load_module
>   #endif
>
>   #ifdef CONFIG_MODULE_SIG
> - static int module_sig_check(struct load_info *info,
> -                           const void *mod, unsigned long *_len)
> + static int module_sig_check(struct load_info *info)
>   {
>         int err = -ENOKEY;
> -       unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
> -       unsigned long len = *_len;
> +       const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
> +       const void *mod = info->hdr;

I got rid of "mod" when I did my merge of these changes against
Linus's tree, but I had to cast it in the memcmp, so probably best to
just keep "mod".

>  -      const void *p = mod, *end = mod + info->len;
> ++      unsigned long len = info->len;
>
>  -      /* Poor man's memmem. */
>  -      while ((p = memchr(p, MODULE_SIG_STRING[0], end - p))) {
>  -              if (p + markerlen > end)
>  -                      break;
>  -
>  -              if (memcmp(p, MODULE_SIG_STRING, markerlen) == 0) {
>  -                      const void *sig = p + markerlen;
>  -                      /* Truncate module up to signature. */
>  -                      info->len = p - mod;
>  -                      err = mod_verify_sig(mod, info->len,
>  -                                           sig, end - sig);
>  -                      break;
>  -              }
>  -              p++;
>  +      if (len > markerlen &&
>  +          memcmp(mod + len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
>  +              /* We truncate the module to discard the signature */
> -               *_len -= markerlen;
> -               err = mod_verify_sig(mod, _len);
> ++              info->len -= markerlen;
> ++              err = mod_verify_sig(mod, &info->len);
>         }
>
>         if (!err) {

-Kees

-- 
Kees Cook
Chrome OS Security

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

* Re: linux-next: manual merge of the modules tree with the  tree
  2012-10-22  1:35 linux-next: manual merge of the modules tree with the tree Stephen Rothwell
  2012-10-22  2:09 ` Kees Cook
@ 2012-10-24  0:21 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2012-10-24  0:21 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-kernel, David Howells, Linus, Kees Cook,
	Andrew Morton

Stephen Rothwell <sfr@canb.auug.org.au> writes:

> Hi Rusty,
>
> Today's linux-next merge of the modules tree got a conflict in
> kernel/module.c between commit caabe240574a ("MODSIGN: Move the magic
> string to the end of a module and eliminate the search") from Linus' tree
> and commit 0250abdeec54 ("module: add syscall to load module from fd")
> from the modules tree.
>
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).
>
> I do wonder why the above change in Linus' tree seems to have bypassed
> the modules maintainer.

Yes.  David tacked it on to a real bugfix which went straight to Linus;
having fixed my mess I couldn't complain too much (though I had NAKed
similar patches in the past).

I will rebase my -next tree today.

Cheers,
Rusty.

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

end of thread, other threads:[~2012-10-24 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22  1:35 linux-next: manual merge of the modules tree with the tree Stephen Rothwell
2012-10-22  2:09 ` Kees Cook
2012-10-24  0:21 ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.