Commit graph

97 commits

Author SHA1 Message Date
Olga Kornievskaia
6292181f8d adding nocache mount options 2011-12-08 17:47:34 -05:00
Olga Kornievskaia
aed1493e90 adding writethru mount option
for large writes it is beneficial to turnoff write buffering and allow
large write buffer sizes than 1M (for win 7).
2011-12-08 17:07:12 -05:00
Olga Kornievskaia
37f3fa0862 saving security context in vnetroot
windows calls into our driver from processes that have restricted access.

save security context during mount and use that for all other irps.
2011-12-08 17:07:05 -05:00
Olga Kornievskaia
6b05d84e93 [driver] dont set NetRootStatus on failure
Setting it was cause exiting mounts to go away.
2011-11-08 14:35:17 -05:00
Olga Kornievskaia
572c69e3d0 need to close vnetroot handle in create_connection 2011-11-02 12:00:21 -04:00
Casey Bodley
3d053740c3 mount: propagate errors back to nfs_mount
nfs41_np.c:
NPAddConnection3() was overwriting status=WN_BAD_NETNAME on any errors from DeviceIoControl()

nfs41_driver.c:
GetConnectionHandle() was only returning the handle, and throwing away the return value from ZwCreateFile()
map_mount_errors() was missing a mapping from ERROR_BAD_NET_NAME to STATUS_BAD_NETWORK_NAME

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-10-25 11:44:37 -04:00
Olga Kornievskaia
a2375b78ac [cosmetic] [driver] modify printouts in getsecurity
print function names where SeCreateClientSecurityFromSubjectContext fails
2011-10-24 12:14:03 -04:00
Olga Kornievskaia
4c52473527 hooking up rsize-wsize mount options
after parsing read and write rpc size from the mount command,
add the values to mount upcall, then pass these values when creating
a CLIENT structure.
2011-10-11 16:03:59 -04:00
Olga Kornievskaia
d646e5c58c [driver] verifier raised issue with lists
first element in the lists (head) doesn't store any entries so
we should skip it when we traverse the list.
2011-10-06 12:38:55 -04:00
Olga Kornievskaia
65c6091f69 [driver] verifier raised issues with mdls
it complained that mdls had to have a certain (undocumented) flag set.
also, it seemed to imply that in readdir, the locking of pages needed
to be done by the thread creating the mdl. so i moved the locking/unlocking
there.
2011-10-06 12:32:50 -04:00
Olga Kornievskaia
b3e4953890 [driver] fixing printing a unicode string in setattr 2011-10-04 14:33:18 -04:00
Olga Kornievskaia
981e73dc61 [driver] read-only mount option
if the nfs_mount passes us a read-only mount option. then return
access_denied if:
1. requests for open with desired access of write or append,
2. we get a write irp,
3. requests for setattr, setattrex, setacl
4. ignore the delete_on_open flag passed to open
2011-10-04 10:57:06 -04:00
Olga Kornievskaia
52081e3175 support for multiuser environment
on a mount request, search a list of existing mounts for a given netroot
based on LUID entries (login ids). if an entry is found, then check the
current request rpcsec flavor against existing sessions/mounts. If no
match found, do another upcall for a mount and store a session of this
flavor for this LUID. if no entry found for this LUID, then do a mount
upcall, create a new entry and add it to the list.
2011-09-29 18:45:21 -04:00
Olga Kornievskaia
27030b1764 removing copies from readdir path 2011-09-27 12:21:26 -04:00
Olga Kornievskaia
7e52f53097 [acls] removing unneeded safety checks 2011-09-23 12:12:45 -04:00
Olga Kornievskaia
3295a9da05 [timings] counting avg acl reply size in cached case 2011-09-22 17:07:44 -04:00
Olga Kornievskaia
6eea9faa2e first draft of named attributes 2011-09-22 14:56:11 -04:00
Olga Kornievskaia
eae8988d6e [driver] minor fix store pointer not pointer to pointer 2011-09-07 13:45:09 -04:00
Olga Kornievskaia
0474d3afbe [driver] adding timing stats to upcalls 2011-09-06 18:01:17 -04:00
Olga Kornievskaia
e3cbc70f14 removing unnecessary copy in readdir 2011-09-06 17:55:02 -04:00
Olga Kornievskaia
27bc5b862e [driver] ignore label_security queries 2011-08-24 13:22:51 -04:00
Olga Kornievskaia
28992406a7 [driver] caching acl buffer between query security irps
windows api frequently sends a query security with a buffer len of 0
to figure out how big of buffer is needed for a security descriptor.

we send a getattr for acl attribute on the 1st irp, then cache the
returned security descriptor in fobx. on the 2nd query, if the buffer
is cached and it's not "stale", we return that buffer.
2011-08-24 12:23:04 -04:00
Olga Kornievskaia
04ab888492 [cosmetic] minor license changes
added 2011 year to the copyright line
added authors info to the license
added UofM license to libtirpc files that we modified
(but i probably missed some)
2011-08-12 13:20:12 -04:00
Olga Kornievskaia
c722076d09 [driver] removing mrxsetinfoatcleanup
this function was called before writes and was setting time and size
attributes of the file. we were translating it into a setattr. reads
were also followed by a setattr of timestamp (unnecessarily)
2011-07-18 15:24:19 -04:00
Olga Kornievskaia
2db91a3001 deny setattr for size if not opened for write
proposes an alternate solution for attempts to set file size without an open sta
teid.  instead of acquiring one by sending OPEN, fail the request with ACCESS_DE
NIED

according the MS File System Algorithms documentation for setting FileAllocation
Information and FileEndOfFileInformation [http://msdn.microsoft.com/en-us/librar
y/ff469355%28v=PROT.10%29.aspx]:
"If Open.GrantedAccess does not contain FILE_WRITE_DATA, the operation MUST be f
ailed with STATUS_ACCESS_DENIED"

-removes open_owner_id, access_mask, access_mode from setattr upcall arguments
-moves map_access_2_allowdeny() back to open.c as a static function, since handl
e_setattr() was its only other call site
2011-06-27 14:51:15 -04:00
Olga Kornievskaia
9f2587c3b3 [driver] abandoned upcalls dont delete security context
Deleting client's security context was causing kernel crashes.

During upcall, we remember a pointer to the client's security context,
then on close we delete the security context. Previously we would also
delete the context if the upcall was abandoned.

Apparently, windows will always send a close for the fcb that was used
for the abandoned upcall. Close deletes the context. Then when upcall
was done, it would try to delete the context again (oops).
2011-06-22 11:42:30 -04:00
Casey Bodley
d98da23d49 lock: address differences in lock semantics
zero-length ranges: valid on windows, but nfs servers MUST return NFS4ERR_INVAL for LOCK with length=0. use MRxIsLockRealizable() to return STATUS_NOT_SUPPORTED for zero-length ranges (avoiding the lock upcall and rpc)

ranges that extend past UINT64_MAX: not valid on windows. NFS expects length=UINT64_MAX for locking to end-of-file. use length=UINT64_MAX if length >= UINT64_MAX-offset (making lock ranges consistent with linux client)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-13 12:02:59 -04:00
Olga Kornievskaia
2d252266c2 [driver] fixing dereference of upcall entry after free if we fail to get security context 2011-06-08 12:54:31 -04:00
Olga Kornievskaia
25cf92a60b [driver] changing logic in volume query
previously, if the supplied buffer length was smaller than the result
of the volume query we returned SUCCESS and no data (ie. it was needed
because Notepad passes in a buffer too small but doesn't like a
buffer_too_small error.) However, it does work with buffer_overflow
error and then a partial resulted returned.
2011-06-06 18:44:59 -04:00
Olga Kornievskaia
8153733a77 [driver] fixing volume label length 2011-06-06 11:25:02 -04:00
Olga Kornievskaia
d83fece068 [driver] fixing return value for security query
rdbss doesn't like status_buffer_too_small return and instead needs
status_buffer_overflow
2011-05-02 13:38:41 -04:00
Olga Kornievskaia
ab7bdbd125 [cosmetic] adding iostatus printf to fsddispatch 2011-04-29 14:29:54 -04:00
Olga Kornievskaia
dd6f2c1849 [driver] share any session for WILD vnetroot
when vnetroot creation of wild comes in it is always for "AUTH_SYS" but if
there exists a gss_session than use that.
2011-04-27 11:37:27 -04:00
Casey Bodley
880dbf8afc driver: fix for has_nfs_prefix()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-20 12:46:29 -04:00
Olga Kornievskaia
5628175fbb [driver] handling UNC paths 2011-04-20 12:36:02 -04:00
Olga Kornievskaia
089a283a3a [driver] [cosmetic] changing printfs 2011-04-19 14:00:45 -04:00
Olga Kornievskaia
20493b9e88 turning off caching if WRITE_THROUGH or NO_BUFFERING is set 2011-04-14 20:14:59 -04:00
Olga Kornievskaia
7f5f903b0a [driver] [cosmetic] restructuring debugging output 2011-04-14 20:14:21 -04:00
Olga Kornievskaia
7a77e95bcd [driver] removed unused Lock.handle 2011-04-13 20:17:59 -04:00
Olga Kornievskaia
529d7ce6db moving session and open_state in upcall header
every upcall (except few) pass session and open_state pointer, so
add that to marshal_nfs41_header() in the driver. remove passing
of session and open_state elsewhere in marshal functions.

in the deamon, upcall.c now reads and stores pointers to session
and open_state in nfs41_upcall datastructure instead of having
each individual upcall store their own pointers. setattrl
and readdir args keeping pointer because the rest of the code
uses them a lot.

in upcall_parse() up refcounts on session and open_state if
valid handles were passed in. down refcounts upcall_cleanup() as
before. but need to be careful with count value for mount and open
upcalls. we need to take an extra ref because upcall_cleanup() now
will always decrement it.
2011-04-13 20:07:37 -04:00
Olga Kornievskaia
ea390c1d25 [driver] moving session and open_state out of upcall union
also passing session, open_state and version to upcallcreate function
2011-04-13 15:28:48 -04:00
Olga Kornievskaia
80b3d11609 changing getacl downcall
instead of passing sids for the owner and group, create a security
descriptor and pass that back. this way we can add all the security
information that was queried in the daemon and pass a fully formed
security descriptor back to the kernel.

notice: irp_mj_query_security provides a pointer to the buffer that
suppose to hold the security descriptor. that memory is valid only
in the context of the process doing the security irp. we can't use
this pointer in then upcall entry and try to write the security
descriptor directly there as we process the downcall. that leads
to kernel oops.

thus we have to first allocate memory to hold the security descriptor
then copy bytes passed to us from the daemon. then do another copy
with the context of the security irp.
2011-04-12 15:57:04 -04:00
Olga Kornievskaia
2b5e3fd64f [acls] driver portion of setacl upcall 2011-04-12 15:56:20 -04:00
Olga Kornievskaia
36ea0af8e7 fixing typo in marshal_nfs41_getacl 2011-04-12 14:09:01 -04:00
Olga Kornievskaia
b9e369fac6 adding query for FileInternalInformation infoclass
this query asks for a file index which is unique identifier for a file which
we can satisfy from file attribute called "fileid"
2011-04-12 14:06:13 -04:00
Olga Kornievskaia
3a06ec9080 [driver] fixing kernel crash when mount quits
Problem: say nfsd is not running but the redirector is active already
(ie. start deamon, stop deamon). problem doesn't exist if nfsd has never
been started. now a user process executes a mount command, the kernel
ends up creating a system thread to handle creation of the vnetroot.
that thread places a mount upcall and waits for the down call. now
kill the user process. now start the nfsd. it will pick up a queued up
upcall entry. however, in the arguments there are pointers to server name
and mount point values that are stored in the memory of the user process
that started the mount but now ended.

Solution: check that Mount.srv_name and Mount.root are still valid
addresses before dereferencing them.
2011-03-25 13:11:08 -04:00
Olga Kornievskaia
ab55e6e8c5 first stab at handling security irp
Basic handling of owner and group security query (no dacl).

Added new upcall for NFS41_ACL_QUERY (driver and daemon code).

Daemon, upon getting NFS41_ACL_QUERY first places a getattr that has
owner, group attribute request. We currently don't cache them!!!

Then, we parse nfs4name format (ie user@domain or group@domain)
into user and domain. We currently ignore domain part!!!

Then, we assume that whatever we are mapping is "known" locally
(ie LookupAccountName() api which retrieves a SID for a given name).
Mapping from name to SID can only be done in the userland. We then
copy the bytes via the upcall pipe to the kernel. If the received
user or group cant be mapped via LookupAccoundName(), we create a
well known null SID as the reply.

Kernel creates a security descriptor in the absolute-format and adds
owner and group sids to it. Important: RtlSetOwner/Group functions only
work with absolute-format security descriptor, however the reply to the
user needs to be in the self-relative format.

The way security query works is that it passes us a buffer to be filled
with the security context. However the user doesn't know how big the
buffer should be so, the user is allowed to pass a null buffer and have
the kernel return how much memory is needed. This leads to 2 security
queries => 2 NFS41_ACL_QUERY upcalls => 2 getattr rpcs... It should be
improved.

TODO:
- need to add caching of owner/group attributes for a file?
- need to add calls to LDAP for more general mapping?
- need to cache reply of the ACL if supplied length is 0?
2011-03-22 17:21:13 -04:00
Casey Bodley
e3c67c0bfa volume: use actual fh instead of rootfh for volume queries
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:40 -05:00
Casey Bodley
19867b892f driver: made UNLOCK upcalls uninterruptible
connectathon locking tests trigger an interrupted UNLOCK upcall, which leads to the bugcheck in CloseSrvOpen() when freeing the security context

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-02-15 15:04:57 -05:00
Olga Kornievskaia
67ae1eddaf making all but CLOSE interruptable
leaving CLOSE upcall non-interruptable as it leads to issues with security context.

making all other upcalls interruptable so that when something goes wrong we can ctrl-c out of a user application. otherwise, the machine requires a reboot (ie caz the wait we made the wait non-interrutable so nothing can kill it).
2011-02-03 11:46:51 -05:00