Date: Wed, 19 Jun 2002 16:41:11 +0200 From: Martin Faxer <gmh003532@brfmasthugget.se> To: freebsd-fs@FreeBSD.org Subject: a bunch of questions Message-ID: <20020619144111.GA1352@lockdown.spectrum.fearmuffs.net>
next in thread | raw e-mail | index | archive | help
hello! i'm trying to make some sense of vfs and here comes a mail with basically (as the subject says) a bunch of questions: 1) why is it preferred to do the permissions checking in the actual file system specific code instead of vfs_[n]mount()? what i mean is that eg. the ffs code does a permissions check in the !superuser case to see if the user has the necessary permissions on the device (ffs_vfsops.c:ffs_mount()). at the same time vfs_[n]mount() does a permissions check to make sure that the user owns the directory he/she is attempting to mount... why is it split up ? 2) in the statfs() code the f_fsid is zeroed out in the !superuser case. after some searching and cross-checking with OpenBSD i'm lead to believe that this is because of a potential NFS insecurity if any user is able to see the f_fsid. does anybody know more about this ? can a check be added like: if (suser(td) != 0 && strcmp(sp->f_fstypename, "nfs") == 0) ? for what it's worth, NetBSD doesn't appear to zero it out so i guess it can't be that serious... 3) can the vnode lock be of type LK_SHARED when i'm doing a VOP_OPEN() operation with only FREAD (and not FWRITE) set ? 4) what does the flags argument to VOP_UNLOCK() mean ? is it something like "resulting flags" ? (i understand what it means in the VOP_LOCK()/vn_lock() case, but i find it a little bit weird in the VOP_UNLOCK() case.) 5) when i call bread() i'm supposed to hold the vnode lock, right ? i have discussed this loosely with Robert Watson and that's the impression i got. 6) after having called bread(), should i lock it in some way before inspecting the contents of the buffer ? as far as i can tell the ufs/ffs code doesn't do this, at least not in the mount case, but i'm not quite sure if that's correct or simply works because you don't modify the superblock so often. i'm actively reading through the code and understanding more and more for each line, but it's not easy to make sense of everything right away, especially not when you're just a junior kernel hacker like me. i would greatly appreciate some answers to these questions and i believe it will really clear things up, even if only somebody else says what i already know. :) thanks in advance, Martin Faxér To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020619144111.GA1352>