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, 12 Mar 2018 21:17:42 +0000
From:   Al Viro <viro@...IV.linux.org.uk>
To:     Roman Gushchin <guro@...com>
Cc:     linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
        Michal Hocko <mhocko@...e.com>,
        Johannes Weiner <hannes@...xchg.org>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-team@...com
Subject: Re: [PATCH 3/3] dcache: account external names as indirectly
 reclaimable memory

On Mon, Mar 05, 2018 at 01:37:43PM +0000, Roman Gushchin wrote:
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 5c7df1df81ff..a0312d73f575 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -273,8 +273,16 @@ static void __d_free(struct rcu_head *head)
>  static void __d_free_external(struct rcu_head *head)
>  {
>  	struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
> -	kfree(external_name(dentry));
> -	kmem_cache_free(dentry_cache, dentry); 
> +	struct external_name *name = external_name(dentry);
> +	unsigned long bytes;
> +
> +	bytes = dentry->d_name.len + offsetof(struct external_name, name[1]);
> +	mod_node_page_state(page_pgdat(virt_to_page(name)),
> +			    NR_INDIRECTLY_RECLAIMABLE_BYTES,
> +			    -kmalloc_size(kmalloc_index(bytes)));
> +
> +	kfree(name);
> +	kmem_cache_free(dentry_cache, dentry);
>  }

That can't be right - external names can be freed in release_dentry_name_snapshot()
and copy_name() as well.  When do you want kfree_rcu() paths accounted for, BTW?
At the point where we are freeing them, or where we are scheduling their freeing?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ