Re: [GIT PULL] ima: bug fixes for Linus

From: Sebastian Ott
Date: Wed Nov 27 2013 - 07:30:04 EST


Hello,

On Mon, 25 Nov 2013, Roberto Sassu wrote:

> On 11/25/2013 07:46 PM, Roberto Sassu wrote:
> > On 11/25/2013 04:40 PM, James Morris wrote:
> > > On Mon, 25 Nov 2013, Mimi Zohar wrote:
> > >
> > > > Hi James,
> > > >
> > > > These are the "essential fixes for regressions".
> > > >
> > > > The following changes since commit
> > > > 4c1cc40a2d49500d84038ff751bc6cd183e729b5:
> > > >
> > > > Revert "KEYS: verify a certificate is signed by a 'trusted' key"
> > > > (2013-11-23 16:38:17 -0800)
> > > >
> > > > are available in the git repository at:
> > > >
> > > >
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity
> > > > for-linus
> > > >
> > > > for you to fetch changes up to 72ca1bd303a5126d0ce377cff699282b6b38bd86:
> > > >
> > > > ima: make a copy of template_fmt in template_desc_init_fields()
> > > > (2013-11-25 07:32:46 -0500)
> > > >
> > > > thanks,
> > > >
> > > > Mimi
> > > >
> > > > ----------------------------------------------------------------
> > > > Roberto Sassu (3):
> > >
> > > > ima: make a copy of template_fmt in template_desc_init_fields()

commit dbc335d2dc3c437649eb6b39f4e9aee2a13eb0af
"ima: make a copy of template_fmt in template_desc_init_fields()"

claimed to fix a kstrdup memleak..looks like it didn't:

unreferenced object 0x56c82370 (size 8):
comm "swapper/0", pid 1, jiffies 4294937476 (age 916.520s)
hex dump (first 8 bytes):
64 00 6e 00 6b 6b 6b a5 d.n.kkk.
backtrace:
[<000000000027c7ac>] __kmalloc_track_caller+0x2e0/0x450
[<0000000000240738>] kstrdup+0x4c/0xd0
[<00000000003c93c4>] ima_init_template+0x9c/0x1f4
[<0000000000a11a54>] ima_init+0x74/0x98
[<0000000000a11ba8>] init_ima+0x30/0x4c
[<00000000001001e2>] do_one_initcall+0xce/0x160
[<00000000009ebb70>] kernel_init_freeable+0x22c/0x2dc
[<000000000061b704>] kernel_init+0x24/0x134
[<0000000000633322>] kernel_thread_starter+0x6/0xc
[<000000000063331c>] kernel_thread_starter+0x0/0xc
unreferenced object 0x56ccc158 (size 16):
comm "swapper/0", pid 1, jiffies 4294937476 (age 916.520s)
hex dump (first 16 bytes):
64 2d 6e 67 00 6e 2d 6e 67 00 73 69 67 00 6b a5 d-ng.n-ng.sig.k.
backtrace:
[<000000000027c7ac>] __kmalloc_track_caller+0x2e0/0x450
[<0000000000240738>] kstrdup+0x4c/0xd0
[<00000000003c93c4>] ima_init_template+0x9c/0x1f4
[<0000000000a11a54>] ima_init+0x74/0x98
[<0000000000a11ba8>] init_ima+0x30/0x4c
[<00000000001001e2>] do_one_initcall+0xce/0x160
[<00000000009ebb70>] kernel_init_freeable+0x22c/0x2dc
[<000000000061b704>] kernel_init+0x24/0x134
[<0000000000633322>] kernel_thread_starter+0x6/0xc
[<000000000063331c>] kernel_thread_starter+0x0/0xc


strsep will modify your template_fmt_copy pointer.

Regards,
Sebastian

> > >
> > >
> > > > template_desc_init_fields(char *template_fmt,
> > >
> > > That should probably be const char.
> > >
> > > Also, the call to kstrdup() results in a memory leak.
> > >
> >
> > Hi James
> >
> > thanks for the comments. I'm implementing them and I will post
> > a new version of the patch 'ima: make a copy of template_fmt in
> > template_desc_init_fields()' shortly.
> >
>
> Hi everyone
>
> attached to this email, there is the new version of the above patch.
>
> Regards
>
> Roberto Sassu
>
>
> > Roberto Sassu
> >
> >
> > >
> > >
> > >
> > >
> >
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/