aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libfshelp: Cosmetic cleanupsSergey Bugaev2022-08-101-14/+18
|
* libfshelp: Simplify fshelp_start_translator_long () a bitSergey Bugaev2022-08-101-39/+14
| | | | | | | It only really supports ports_len > INIT_PORT_BOOTSTRAP, ports_type == MACH_MSG_TYPE_COPY_SEND, fds_type == MACH_MSG_TYPE_COPY_SEND. Make that explicit, and remove the branches that tried to handle the other cases.
* startup: Request notifications to a separate portSergey Bugaev2022-08-101-6/+24
| | | | | Since this port is never given out to anyone but the kernel, our clients can't spoof a dead-name notification this way.
* console: Forward any libports-requested notifications to themSergey Bugaev2022-08-101-0/+4
| | | | | | libports will start requesting dead-name notifications on its own. As we handle all notifications, both ones we have requested and ones libports has, distinguish between the two handlers by the port.
* console: Return EOPNOTSUPP when appropriateSergey Bugaev2022-08-101-3/+3
| | | | | | | | | | We do not impement most of the mach_notify_* () routines. Explicitly return an error code so that our caller knows to properly deallocate all resources the messages may carry. Even though we don't expect to receive some of the notifications from the kernel as we never sign up for them, we can always receive spoofed notifications from our clients, so don't abort in that case.
* console: Simplify code with ports_request_dead_name_notification ()Sergey Bugaev2022-08-101-25/+3
| | | | | | We can't use it to *request* notifications here, since we need to use a custom per-display port (and not libports' notify_port), but we can still use it to *cancel* notifications with a lot less boilerplate.
* libports: Only accept dead-name notifications on notify_portSergey Bugaev2022-08-101-2/+2
| | | | | Since this port is never given out to anyone but the kernel, our clients can't spoof a dead-name notification this way.
* libports: Return EOPNOTSUPP when appropriateSergey Bugaev2022-08-104-4/+4
| | | | | | We do not impement most of the mach_notify_* () routines. Explicitly return an error code so that our caller knows to properly deallocate all resources the messages may carry.
* libmachdev: Use notify server implementation from libportsSergey Bugaev2022-08-102-44/+2
| | | | | | Since the implementation in libmachdev was just forwarding calls to the corresponding libports functions, we might as well just use ports_notify_server_routine () directly.
* libdiskfs, libnetfs: Disable broken codeSergey Bugaev2022-08-102-1/+11
| | | | This logic is obviously broken, let's disable it for now.
* libfshelp: Update some commentsSergey Bugaev2022-08-102-3/+5
|
* diskfs: Use libports notificationsSergey Bugaev2022-08-103-10/+7
| | | | | Namely, ports_request_dead_name_notification () where we can, and the libports notify port when we have to pass it to libfshelp.
* netfs: Use the libports notify portSergey Bugaev2022-08-102-2/+6
|
* eth-multiplexer: Use notify server implementation from libportsSergey Bugaev2022-08-106-83/+34
| | | | We can simply override proc_dead_name () to handle dead-name notifications.
* eth-multiplexer: Use ports_request_dead_name_notification ()Sergey Bugaev2022-08-102-16/+4
|
* proc: Use notify server implementation from libportsSergey Bugaev2022-08-104-71/+10
| | | | We can simply override proc_dead_name () to handle dead-name notifications.
* proc: Use ports_request_dead_name_notification ()Sergey Bugaev2022-08-103-44/+17
|
* libports: Add ports_request_dead_name_notification ()Sergey Bugaev2022-08-103-1/+63
| | | | | This significantly cuts down the boilerplate of requesting dead-name notifications.
* libports: Request notifications to the notify_portSergey Bugaev2022-08-101-4/+4
|
* libports: Create a notify_port in each bucketSergey Bugaev2022-08-104-7/+45
| | | | | | | This notify port will be used to request & receive Mach notifications. While it is present in the bucket much like any other port, it is not counted in ports_count_bucket () and is not exposed to the user callback in ports_bucket_iterate ().
* libports: Treat no-senders notifications as a hintSergey Bugaev2022-08-101-4/+19
| | | | | | | No-senders notifications are directed to the port that no longer has any senders left. Since any client can easily spoof such a notification, we have to treat the notification as just a hint and verify whether there are, in fact, any senders, and only call ports_no_senders () if there actually are none left.
* proc: Drop some mach_port_destroy () usesSergey Bugaev2022-08-101-11/+5
| | | | | | | | | | | | | | | | mach_port_destroy () is a dangerous API that has to be used with extreme care. Namely, it destroys not one user reference, but *all* user references that a task has for a port name. Different parts of a program may all keep separate references on a port without coordinating it with each other (which is the whole idea behind reference counting). If one part of a program decides to destroy a port with mach_port_destroy () without informing others, others may still believe they hold a reference and will continue to use the name as if it still refered to the now-destroyed port right. This consitutes a port use-after-free, even if their use is also deallocating their reference. In the particular case of the proc server, this manifested itself as S_proc_reassign () destroying all user references to the task port right before the task port right is deallocated again in the dead-name notification handler.
* Do not use ports_get_right () for send-one rightsSergey Bugaev2022-08-102-3/+3
| | | | | | | | | | | | ports_get_right () expects the caller to make a send, not a send-once, right from the returned receive right, and increments the expected make-send count accordingly. The kernel, however, does not increment the make-send count when a send-once right is being made. The result can be described as a "no-senders leak": libports' idea of the current make-send count always stays one step ahead of it actual value (or several steps ahead, if the process is repeated), which makes libports ignore *all* the subsequent no-senders notifications for the port as outdated.
* Update to the improved memory_object_create proxy RPCSamuel Thibault2022-08-102-5/+4
| | | | Thus avoiding two RPCs.
* Do not cache the R/O proxySamuel Thibault2022-08-109-53/+22
| | | | | We cannot properly detect when to release the ro_proxy, so let's just not cache it.
* tmpfs: Return read-only memory objects when appropriateSergey Bugaev2022-08-102-7/+32
|
* fatfs: Return read-only memory objects when appropriateSergey Bugaev2022-08-101-6/+13
|
* ext2fs: Return read-only memory objects when appropriateSergey Bugaev2022-08-101-34/+39
|
* libpager: Add pager_get_ro_port ()Sergey Bugaev2022-08-106-1/+73
| | | | | A pager will now maintain a port to a read-only memory object proxy for itself, and let the users access it with pager_get_ro_port ().
* isofs: Assert we're only supposed to provide a read-only pagerSergey Bugaev2022-08-101-0/+3
|
* fatfs: Properly reference pagerSergey Bugaev2022-08-101-48/+49
| | | | | | | | A node keeps a weak reference on the pager as long as diskfs_node_disknode (node)->pager points to it. A pager keeps a light reference on the node as long as the UPI is alive. This is the same way it's done in ext2fs.
* exec: Support ELIBEXEC errorSamuel Thibault2022-04-121-0/+7
| | | | | So users get a "Cannot exec a shared library directly" error message instead of a segfault.
* rumpdisk: Note multithreading FIXME as doneSamuel Thibault2022-03-011-6/+2
|
* libpager: Make it a bit parallelSamuel Thibault2022-03-011-1/+1
| | | | | | | | Making libpager use several workers allows it to queue several requests to the disk (e.g. for different processes faulting data) rather than waiting for them sequentially. * libpager/demuxer.c (WORKER_COUNT): Set to 10.
* rumpdisk: Override machdev_server with multithread port managementDamien Zammit2022-03-011-1/+16
| | | | | | | This makes rumpdisk multithreaded as much as the root filesystem pager will request. Message-Id: <20220227091013.33112-4-damien@zamaudio.com>
* libmachdev: Export demuxer as machdev_demuxer and bucket pointerDamien Zammit2022-03-012-3/+6
| | | | | | This will allow callers to manage their own server routine. Message-Id: <20220227091013.33112-3-damien@zamaudio.com>
* libmachdev: No-op fix styling of functionsDamien Zammit2022-03-011-4/+8
| | | | Message-Id: <20220227091013.33112-2-damien@zamaudio.com>
* pci-arbiter: Remove invalid pci_device_closeDamien Zammit2022-02-281-8/+1
| | | | | | | | | | | pci_control_port is not a port info so calling deref on it is invalid. There seems no reason to have a device_close for the pci device currently so remove it. TESTED via booting a rump disk Message-Id: <20220227075155.30750-1-damien@zamaudio.com>
* rumpdisk: Protect open/close/read/write with a rwlockDamien Zammit2022-02-271-11/+66
| | | | | | TESTED to boot off a rump based disk Message-Id: <20220227002655.23300-1-damien@zamaudio.com>
* rumpdisk: Do not set a number of bytes in case of errorsSamuel Thibault2022-02-251-9/+2
| | | | | | | The RPC stub will not read it on error anyway. * rumpdisk/block-rump.c (rumpdisk_device_write, rumpdisk_device_read): Do not set the number of bytes when returning an error.
* rumpdisk: Fix warningSamuel Thibault2022-02-251-1/+1
| | | | | | | gcc would complain that dummy_read is unused * rumpdisk/block-rump.c (rumpdisk_device_write): Mark dummy_read with attribute unused.
* Fix store_read callsSamuel Thibault2022-02-253-6/+5
| | | | | | | | | | | store_read takes a look at the size to determine whether to fill the provided buffer or not. Even if providing a null buffer we should set the size to 0. * defpager/defpager.c (pager_read_page): Initialize nread to 0. * storeio/dev.c (buffered_rw): Initialize amount to 0. * fatfs/fat.c (fat_read_sblock): Initialize read to the size of the boot sector. Reuse it as such.
* mtab: turn part:x:device:y into /dev/ysxSamuel Thibault2022-02-251-1/+17
| | | | | This is needed when using a rumpdisk-based root disk. Otherwise fsck does not properly detect when it is mounted.
* rumpdisk: Fix BLKRRPART valueSamuel Thibault2022-02-221-1/+1
| | | | | We have always been using the Linux value, coming from the Linux glue code.
* libmachdev: Register translator for shutdown notificationSamuel Thibault2022-02-201-0/+2
| | | | | When starting a libmachdev translator after bootstrap, we still want the translator to be notified by startup, to properly flush buffers etc.
* mount: Avoid appending empty options to empty mntoptsSamuel Thibault2022-02-201-1/+2
| | | | argz_append does not actually support this.
* mount: Fix deleting noauto/bind optionSamuel Thibault2022-02-201-2/+11
| | | | | After deleting an option, we have to let the loop continue from there instead of skipping another option.
* rumpdisk: cope with unaligned and big accessesSamuel Thibault2022-02-181-27/+86
| | | | | | | Unaligned accesses need a copy into an aligned buffer. Accesses larger than a page currently have to be split into pages, otherwise _bus_dmamap_load_buffer assumes coherent physical allocations.
* acpi: Remove erroneous MAP_FIXEDDamien Zammit2022-02-121-3/+3
| | | | | | | Reading the man page for mmap, MAP_FIXED needs to be removed, because we do not want the mapping to be placed at 0. Message-Id: <20220212215736.28433-1-damien@zamaudio.com>
* Fix warningSamuel Thibault2022-02-121-1/+1
| | | | | | * startup/startup.c (S_io_restrict_auth): Cast const uid_t * pointer to uid_t * when using it in struct idvec which always uses a uid_t* even when reading it.