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] [day] [month] [year] [list]
Date:	Sat, 30 Jun 2007 18:13:57 +0200
From:	Andreas Gruenbacher <agruen@...e.de>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	jjohansen@...e.de, linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: Re: [RFD 1/4] Pass no useless nameidata to the create, lookup, and permission IOPs

On Saturday 30 June 2007 11:13, Christoph Hellwig wrote:
> We need something like this, but I don't quite like the way you've done
> it.  First the name is wrong, it's not a nameidata anymore but a lookup
> intent, so it should be named that way, struct lookup_intent.

Sure, that name was pretty random ... lookup_intent has gotten the majority of 
votes so far, and I'm perfectly fine with that.

> Second the macro hackery is more than ugly,  please keep the structures
> separate. With modern gcc it might be possible to embed the lookup_intent
> into the nameidata anonymously.

http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Unnamed-Fields.html

If we can add the -fms-extensions gcc option we can get rid of the macro, and 
the code becomes pretty clean (as shown below). If we cannot add this option, 
then gcc would puke on ``struct lookup_intent;'' in the definition of struct 
nameidata. The macro is the cleanest way to work around this I could come up 
with, but maybe somebody knows another trick.

--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -14,14 +14,10 @@ struct open_intent {
 
 enum { MAX_NESTED_LINKS = 8 };
 
-struct nameidata {
+struct lookup_intent {
 	struct dentry	*dentry;
 	struct vfsmount *mnt;
-	struct qstr	last;
 	unsigned int	flags;
-	int		last_type;
-	unsigned	depth;
-	char *saved_names[MAX_NESTED_LINKS + 1];
 
 	/* Intent data */
 	union {
@@ -29,6 +25,19 @@ struct nameidata {
 	} intent;
 };
 
+struct nameidata {
+	struct lookup_intent;
+	struct qstr	last;
+	int		last_type;
+	unsigned	depth;
+	char *saved_names[MAX_NESTED_LINKS + 1];
+};

> Also please either remove the dentry from struct lookup_entry or from the
> direct argument list of the functions and methods - there is no need to pass
> this one twice.

The dentry in the lookup_intent of the create inode operation is the parent 
dentry right now, and the child dentry is passed as the separate parameter. I 
would prefer the cleaner interface in which the lookup_intent refers to the 
child dentry as well. (Getting from the child to the parent is trivial.) I 
guess this can go in an incremental patch with the next version of these 
patches.

Thanks,
Andreas
-
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