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:	Mon, 13 Jul 2015 20:52:37 +0200
From:	Helge Deller <deller@....de>
To:	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	jejb@...isc-linux.org, mpatocka@...hat.com,
	kirill.shutemov@...ux.intel.com
CC:	linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	John David Anglin <dave.anglin@...l.net>,
	Meelis Roos <mroos@...ux.ee>
Subject: Re: [PATCH] parisc: mm: Fix a memory leak related to pmd not attached
 to the pgd

Hi Christophe,

On 13.07.2015 11:32, Christophe JAILLET wrote:
> Commit 0e0da48dee8d ("parisc: mm: don't count preallocated pmds")
> introduced a memory leak.
>
> After this commit, the 'return' statement in pmd_free is executed in all
> cases. Even for pmd that are not attached to the pgd.
> So 'free_pages' can never be called anymore, leading to a memory leak.

That's really great!!! Thanks for spotting this!

I assume this fixes the leak which killed our debian buildds with OOM
after an uptime of 1-4 days and which only happened since kernel 4.0.
Meelis Roos reported the issue already in this thread:
http://marc.info/?l=linux-parisc&m=142999113232154&w=2

> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Acked-by: Helge Deller <deller@....de>


Will this patch be pushed via linux-mm or another tree, if
not I can take it via the parisc tree?


Helge


> ---
> This patch is *untested* as I don't have the hardware to test it.
>
> This is just a guess based on the indentation, the comment in the code
> and the commit log.
> ---
>   arch/parisc/include/asm/pgalloc.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
> index 3a08eae..f66d3738 100644
> --- a/arch/parisc/include/asm/pgalloc.h
> +++ b/arch/parisc/include/asm/pgalloc.h
> @@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
>
>   static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
>   {
> -	if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
> +	if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
>   		/*
>   		 * This is the permanent pmd attached to the pgd;
>   		 * cannot free it.
> @@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
>   		 */
>   		mm_inc_nr_pmds(mm);
>   		return;
> +	}
>   	free_pages((unsigned long)pmd, PMD_ORDER);
>   }
>
>

--
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