lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Aug 2009 21:36:40 -0500
From:	"Serge E. Hallyn" <serue@...ibm.com>
To:	Xiaotian Feng <dfeng@...hat.com>
Cc:	jmorris@...ei.org, eparis@...isplace.org, sds@...ho.nsa.gov,
	paul.moore@...com, linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] selinux: fix memory leak in sel_make_bools

Quoting Xiaotian Feng (dfeng@...hat.com):
> In sel_make_bools, kernel allocates memory for bool_pending_names[i]
> with security_get_bools. So if we just free bool_pending_names, those
> memories for bool_pending_names[i] will be leaked.
> 
> This patch resolves dozens of following kmemleak report after resuming
> from suspend:
> unreferenced object 0xffff88022e4c7380 (size 32):
>   comm "init", pid 1, jiffies 4294677173
>   backtrace:
>     [<ffffffff810f76b5>] create_object+0x1a2/0x2a9
>     [<ffffffff810f78bb>] kmemleak_alloc+0x26/0x4b
>     [<ffffffff810ef3eb>] __kmalloc+0x18f/0x1b8
>     [<ffffffff811cd511>] security_get_bools+0xd7/0x16f
>     [<ffffffff811c48c0>] sel_write_load+0x12e/0x62b
>     [<ffffffff810f9a39>] vfs_write+0xae/0x10b
>     [<ffffffff810f9b56>] sys_write+0x4a/0x6e
>     [<ffffffff81011b82>] system_call_fastpath+0x16/0x1b
>     [<ffffffffffffffff>] 0xffffffffffffffff
> 
> Signed-off-by: Xiaotian Feng <dfeng@...hat.com>

Acked-by: Serge Hallyn <serue@...ibm.com>

> ---
>  security/selinux/selinuxfs.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index b4fc506..1a8a1c2 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -979,6 +979,8 @@ static int sel_make_bools(void)
>  	u32 sid;
> 
>  	/* remove any existing files */
> +	for (i = 0; i < bool_num; i++)
> +		kfree(bool_pending_names[i]);
>  	kfree(bool_pending_names);
>  	kfree(bool_pending_values);
>  	bool_pending_names = NULL;
> -- 
> 1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ