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: <48842CDB.1090009@cn.fujitsu.com>
Date:	Mon, 21 Jul 2008 14:29:47 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Al Viro <viro@...IV.linux.org.uk>
CC:	Cyrill Gorcunov <gorcunov@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfs: use kstrdup()

Al Viro wrote:
> On Sat, Jul 19, 2008 at 05:19:09PM +0400, Cyrill Gorcunov wrote:
>> [Cyrill Gorcunov - Sat, Jul 19, 2008 at 05:13:17PM +0400]
>> [...]
>> | | -			}
>> | | -		}
>> | | +		mnt->mnt_devname = kstrdup(name, GFP_KERNEL);
>> | |  	}
>> | |  	return mnt;
>> | |  }
>> | | -- 
>> | | 1.5.4.rc3
>> | | 
>> | | 
>> | 
>> | but kstrdup may return NULL - is it safe there?
>> | Sorry if that "not smart" question.
>> | 
>> | 		- Cyrill -
>>
>> ah, I see it is safe - sorry for noise
> 
> FWIW, it _is_ a good question.
> 
> 	* is all code treating ->mnt_devname as optional?  AFAICS, there's
> at least one place in NFS that doesn't.  We could treat failing allocation
> the same way we treat failing allocation of vfsmount itself - callers can
> cope with that already.

I just did a cleanup, and the original code didn't check for NULL.

I just looked into the git history, and I found out since fs/namespace.c was
created in v2.4.10.4, the code has never changed to check for failing
allocation of ->mnt_devname.

> 	* AFAICS, it should be const char *.

Agreed.

> 	* ... or perhaps we shouldn't copy it at all.  How about something
> like
> 	struct {
> 		int count;
> 		char name[];
> 	}
> with cloning sharing the reference and bumping the count, protecting it with
> e.g. vfsmount_lock?  For setups where we have a lot of bindings/namespaces
> it might be noticable.
> 

I'm not sure whether this is a good idea, as I have limited knowledge about the
vfs internal.


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