Re: potential memory leak in netlbl_mgmt_add_common

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 18, 2020 at 8:28 AM Stephen Smalley
<stephen.smalley.work@xxxxxxxxx> wrote:
>
> On Mon, Aug 17, 2020 at 10:25 PM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> >
> > On Thu, Aug 13, 2020 at 12:32 PM Stephen Smalley
> > <stephen.smalley.work@xxxxxxxxx> wrote:
> > >
> > > I noticed this in /sys/kernel/debug/kmemleak while testing other
> > > patches.  This is on 5.8.0-rc1 but may be older.
> > >
> > > unreferenced object 0xffff888158b40380 (size 32):
> > >   comm "netlabelctl", pid 2982, jiffies 4295212079 (age 3234.561s)
> > >   hex dump (first 32 bytes):
> > >     80 03 b4 58 81 88 ff ff 80 03 b4 58 81 88 ff ff  ...X.......X....
> > >     90 03 b4 58 81 88 ff ff 90 03 b4 58 81 88 ff ff  ...X.......X....
> > >   backtrace:
> > >     [<000000009fe161a4>] netlbl_mgmt_add_common+0x2df/0x9b0
> > >     [<00000000816cc1d9>] netlbl_mgmt_adddef+0x133/0x190
> > >     [<00000000f060e456>] genl_rcv_msg+0x2dd/0x490
> > >     [<000000001c733400>] netlink_rcv_skb+0xd0/0x200
> > >     [<00000000c42f6f58>] genl_rcv+0x24/0x40
> > >     [<000000005421c040>] netlink_unicast+0x2b4/0x3e0
> > >     [<00000000ab107bba>] netlink_sendmsg+0x3a6/0x660
> > >     [<00000000643024bd>] sock_sendmsg+0x96/0xa0
> > >     [<00000000ba78e5a6>] ____sys_sendmsg+0x404/0x440
> > >     [<000000006f3de0f5>] ___sys_sendmsg+0xd8/0x140
> > >     [<000000009b8c70ea>] __sys_sendmsg+0xa3/0x110
> > >     [<00000000e65194c3>] do_syscall_64+0x52/0xb0
> > >     [<00000000367aebc6>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> >
> > Hmmm, that's interesting, a quick look at the code doesn't reveal
> > anything obvious and it looks like I don't currently have kmemleak
> > enabled in my kernel so I'll need to rebuild ... you wouldn't happen
> > to have line numbers for the backtrace above would you?  Anything
> > special you did to reproduce this?
>
> I don't still have that kernel so I'll need to reproduce it again.

No problem.  If you remember to do it next time you've got a test
going, it would be nice to have the confirmation, but I started
building a kernel this morning (forgot to start it last night).

> It
> was reproducible however just by running the selinux-testsuite and
> then echo scan > /sys/kernel/debug/kmemleak and then cat
> /sys/kernel/debug/kmemleak.  kmemleak-related config was:
> CONFIG_HAVE_DEBUG_KMEMLEAK=y
> CONFIG_DEBUG_KMEMLEAK=y
> CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE=4096
> # CONFIG_DEBUG_KMEMLEAK_TEST is not set
> # CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set
> CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y

Okay, good.  I was worried the reproducer might be tricky, but that's
easy enough.

-- 
paul moore
www.paul-moore.com



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux