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]
Message-ID: <4AD6D2E3.9050105@gmail.com>
Date:	Thu, 15 Oct 2009 09:44:35 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	npiggin@...e.de
CC:	Al Viro <viro@...iv.linux.org.uk>, linux-fsdevel@...r.kernel.org,
	Ian Kent <raven@...maw.net>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Miklos Szeredi <mszeredi@...e.cz>
Subject: Re: [patch 2/6] fs: no games with DCACHE_UNHASHED

npiggin@...e.de a écrit :
> (this is in -mm)
> 
> Filesystems outside the regular namespace do not have to clear DCACHE_UNHASHED
> in order to have a working /proc/$pid/fd/XXX. Nothing in proc prevents the
> fd link from being used if its dentry is not in the hash.
> 
> Also, it does not get put into the dcache hash if DCACHE_UNHASHED is clear;
> that depends on the filesystem calling d_add or d_rehash.
> 
> So delete the misleading comments and needless code.
> 

This was added in commit 304e61e6fbadec586dfe002b535f169a04248e49

    [PATCH] net: don't insert socket dentries into dentry_hashtable
    
    We currently insert socket dentries into the global dentry hashtable.  This
    is suboptimal because there is currently no way these entries can be used
    for a lookup().  (/proc/xxx/fd/xxx uses a different mechanism).  Inserting
    them in dentry hashtable slows dcache lookups.
    
    To let __dpath() still work correctly (ie not adding a " (deleted)") after
    dentry name, we do :
    
    - Right after d_alloc(), pretend they are hashed by clearing the
      DCACHE_UNHASHED bit.
    
    - Call d_instantiate() instead of d_add() : dentry is not inserted in
      hash table.
    
      __dpath() & friends work as intended during dentry lifetime.
    
    - At dismantle time, once dput() must clear the dentry, setting again
      DCACHE_UNHASHED bit inside the custom d_delete() function provided by
      socket code, so that dput() can just kill_it.
    
    Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
    Cc: Al Viro <viro@...iv.linux.org.uk>
    Acked-by: "David S. Miller" <davem@...emloft.net>
    Signed-off-by: Andrew Morton <akpm@...l.org>
    Signed-off-by: Linus Torvalds <torvalds@...l.org>



Back in 2006, we had to perform this hack in order to not leak '(deleted)' in __d_path()

if (!IS_ROOT(dentry) && d_unhashed(dentry) &&
	(prepend(&end, &buflen, " (deleted)", 10) != 0)) 
		goto Elong;

In current kernel this part became :

if (d_unlinked(dentry) &&
	(prepend(&end, &buflen, " (deleted)", 10) != 0))
		goto Elong;


So your cleanup seems good, thanks !

Acked-by: Eric Dumazet <dada1@...mosbay.com>
--
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