Commit Graph

17 Commits (e4b5f170cffd0d5e788d9090f8f2a9802fe267e9)

Author SHA1 Message Date
cinap_lenrek 0b33b3b8ad kernel: implement per file descriptor OCEXEC flag, reject ORCLOSE when opening /fd, /srv and /shr
The OCEXEC flag used to be maintained per channel,
making it shared between all the file desciptors.

This has a unexpected side effects with regard to
channel passing drivers such as devdup (/fd),
devsrv (/srv) and devshr (/shr).

For example, opening a /srv file with OCEXEC
makes it impossible to be remounted by exportfs
as it internally does a exec() to mount and
re-export it. There is no way to reset the flag.

This change makes the OCEXEC flag per file descriptor,
so a open with the OCEXEC flag only affects the fd
group of the calling process, and not the channel
itself.

On rfork(RFFDG), the per file descriptor flags get
copied.

On dup(), the per file descriptor flags are reset.

The second modification is that /fd, /srv and /shr
should reject the ORCLOSE flag, as the files that
are returned have already been opend.
2020-12-13 16:04:09 +01:00
cinap_lenrek 24420ab9eb kernel: fix rewinding in directories with pread() offset
reading directories with pread() offset has to work the same
way as read(), otherwise exportfs breaks rewinding in directories.
2017-04-30 01:51:07 +02:00
cinap_lenrek b6005f3a45 avoid updating offset in pread; avoid diagnostic about vlong mask (charles forsyth) 2016-05-16 21:11:54 +02:00
cinap_lenrek b4f56f1f4e kernel: mount flag is int not ulong, reduce size of Mount struct by putting mflag field in what would be wasted as padding 2015-08-09 21:35:50 +02:00
cinap_lenrek 4bd9ed80c3 kernel: export mntattach() from devmnt.c avoiding bogus struct passing and special case in namec()
we already export mntauth() and mntversion(), so why not stop
being sneaky and just export mntattach() so bindmount() and
devshr can just call it directly with proper arguments being
checked.

we can also avoid handling #M attach specially in namec()
by having the devmnt's attach function do error(Enoattach).
2015-07-28 09:52:21 +02:00
cinap_lenrek 497daed116 kernel: make sure fd is in range in fdclose()
as the Fgrp can be shared with other processes, we have to
recheck the fd index after locking the Fgrp in fdclose()
to make sure not to read beyond the bounds of the fd array.
2015-07-23 22:56:49 +02:00
cinap_lenrek 323184d775 kernel: simplify syspipe() 2015-07-23 22:34:58 +02:00
cinap_lenrek 769b3f1c2f kernel: consistent use of nil for pointer in sysfile.c 2015-07-22 21:54:07 +02:00
cinap_lenrek ee6409366e kernel: use nil for pointers instead of 0, zero channel umc and dirrock in newchan() 2014-08-08 16:44:41 +02:00
cinap_lenrek 9ebbfae28b kernel: simplify fdclose() 2014-05-26 22:47:34 +02:00
cinap_lenrek 3207e8b6a4 add _nsec() syscall 53 for binary compatibility with labs distribution
the new syscall is added under the symbol _nsec() for
binary compatibility.

nsec() is still a library function reading /dev/bintime.
2014-05-20 05:06:31 +02:00
cinap_lenrek 29eea45931 kernel: do not pass user address of fd[2] array to newfd2()
access to user memory can pagefault and newfd2() holds
fgrp spinlock while writing to it. make temporary copy
on the stack in syspipe().
2014-02-02 10:41:51 +01:00
cinap_lenrek 6c2e983d32 kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling
convention was also changed to return uintptr (as segattach
returns a pointer) and the arguments are now passed as
va_list which handles amd64 arguments properly (all arguments
are passed in 64bit quantities on the stack, tho the upper
part will not be initialized when the element is smaller
than 8 bytes).

this is partial. xalloc needs to be converted in the future.
2014-01-20 00:47:55 +01:00
cinap_lenrek 6bd82b34fd async clunk for cached mounts, fix closeproc explosion 2012-04-27 17:51:20 +02:00
cinap_lenrek 4ec0e921e5 eqlock(): use eqlock when interruption is possible 2011-08-11 04:25:51 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00