summaryrefslogtreecommitdiff
path: root/libdiskfs
AgeCommit message (Collapse)Author
2025-04-19libdiskfs: Fix catching exceptionsv0.9.git20250420Samuel Thibault
This fixes making diskfs_catch_exception recursive, catching the last fault exception, and fixes callers.
2025-03-05libdiskfs: Fix using unitialized value on renameSamuel Thibault
2025-02-24libdiskfs: Avoid putting ref of NULL pointerSamuel Thibault
E.g in the "Negative lookup cached." error case, diskfs_lookup clears NP, so we would segfault.
2025-02-08Add names to threadsSamuel Thibault
2025-02-04libdiskfs: Check for EROFS on io_prenotify and io_write tooSamuel Thibault
This avoids Assertion `!diskfs_readonly' failed. messages at shutdown.
2025-01-17libdiskfs: Avoid crashing on system shutdownSamuel Thibault
when processes which were upgraded didn't get restarted, and stop after making the filesystem readonly.
2025-01-11libdiskfs: catch mmap failureSamuel Thibault
Just backtrace for now
2024-12-14Add a description comment for the MIG type translation filesZhaoming Luo
Signed-off-by: Zhaoming Luo <zhmingluo@163.com> Message-ID: <20241213005831.748151-1-zhmingluo@163.com>
2024-08-25Fix line-buffered stderrSamuel Thibault
mach_open_devstream creates a fully-buffered stream by default. This prevents from seeing various messages.
2024-08-25libdiskfs: Print error if we fail to open /dev/consoleSamuel Thibault
2024-08-25Make sure to also print early-fatal errors on mach consoleSamuel Thibault
In case the user is using a debug kernel, they will get to see these.
2024-07-10netfs and diskfs: make showtrans work correctly when translators are set on ↵v0.9.git20240714Flavio Cruz
top of sylink/device/fifo/socket files. While these are short-circuited translators and simply change st_mode, actual translators can be set on top. We want `showtrans` to show the actual passive translator, not the short-circuited one. Message-ID: <b3ujoovkmz3iagqkmv6lyzgqsv3g5u2wiaqwktlttbalyd7oak@6qeiiupzzmag>
2023-12-29Cast bootinfo to struct diskfs_control * to silence warningFlavio Cruz
Message-ID: <20231229212105.858759-2-flaviocruz@gmail.com>
2023-12-29Replace deprecated sigmask with sigset_t callsFlavio Cruz
Message-ID: <20231229161211.312389-2-flaviocruz@gmail.com>
2023-12-17Update server handlers to return kern_return_error to fix ↵v0.9.git20231217Flavio Cruz
-Werror=enum-int-mismatch warnings MiG expects those to return kern_return_t. Message-ID: <ZXqbbXpVqQAwd2qv@jupiter.tail36e24.ts.net>
2023-09-02S_dir_lookup: Handle O_DIRECTORYSamuel Thibault
When e.g. looking up a socket with O_DIRECTORY, we should return ENOTDIR rather than EACCESS.
2023-09-02Revert "S_dir_lookup: Handle O_DIRECTORY"Samuel Thibault
This reverts commit 8b5b59c704e9edbb0784697ada1df9112fc3e18b. This actually breaks various posix behaviors.
2023-09-02S_dir_lookup: Handle O_DIRECTORYSamuel Thibault
When e.g. looking up a socket with O_DIRECTORY, we should return ENOTDIR rather than EACCESS.
2023-08-12file-syncfs: Avoid deadlockSamuel Thibault
This is a four-player problem (here for diskfs): - One runs sync, which calls diskfs_S_file_syncfs, which triggers fsys_syncfs on all active translators, while keeping the translator_ihash_lock lock. - One of the active translators is hung, for some reason - Another ext2fs thread is trying to call fshelp_set_active_translator from dir_lookup. It is stuck on trying to acquire translator_ihash_lock, and it holds the np. - The ext2fs thread running diskfs_sync_everything tries to lock that np, while holding the nodecache_lock. In the end everything is locked. While diskfs_S_file_syncfs can as well just atomically get the list of active translators, and then call fsys_syncfs without keeping translator_ihash_lock held.
2023-08-08Homogeneize [gs]et_translator and get_dire[nc]ts into mach_msg_type_number_tSamuel Thibault
This makes netfs_[gs]et_translator use mach_msg_type_number_t like the RPC and diskfs. This also makes the fshelp_fetch_root_callback1_t for fshelp_fetch_root use mach_msg_type_number_t. This also makes procfs_get_translator and the get_translator proc method use mach_msg_type_number_t. This makes diskfs_get_directs use mach_msg_type_number_t like the dir_readdir RPC Also get rid of u_int. This notably fixes _diskfs_translator_callback1_fn's bogus cast of size_t *argz_len into (u_int *).
2023-07-03libdiskfs: Don't warn if requesting shutdown notification fails with EPERMSergey Bugaev
The code already ignores proc_mark_important failing with EPERM; do the same for opening /servers/startup and startup_request_notification. All of these calls will fail for unprivileged mounts. Also plug a port leak: we want to deallocate the "init" port whether the RPC succeeds or not. Message-Id: <20230625231137.403096-1-bugaevc@gmail.com>
2023-05-10libdiskfs: Port to x86_64Sergey Bugaev
Message-Id: <20230508213136.608575-9-bugaevc@gmail.com>
2023-05-02Use uintptr_t for message payloads.Flavio Cruz
A follow up to 92fad38a043b75ed6b435b3efa574ede91dbe9ee in gnumach. Message-Id: <ZFCNasf9bJ9qj+CG@jupiter.tail36e24.ts.net>
2023-04-08Further modernize Hurd code by enforcing strict prototypes and no implicit ↵Flavio Cruz
function declarations. Most of the changes land in one of these buckets: * Removed unused declarations. * Used (void) to represent no parameters instead of () which means an undeterminate number of parameters. * Included missing header files whenever necessary (stdlib.h, sys/mman.h, etc) * Typedefed function pointers to be able to fully declare the parameter types. * Added declarations of library functions that are used elsewhere (example is libps/ps.h). * Made functions static whenever they are only used in that file. * Forwarded declarations of some methods that were made static. Message-Id: <ZDD1o7/tVYeZew+G@jupiter.tail36e24.ts.net>
2023-04-07Use default pager MiG stubs from Hurd instead of gnumachFlavio Cruz
Hurd code relies on gnumach default_pager.defs headers when making calls using the default pager RPC. Those stubs were checked in back in the 90s and are essentially unused because gnumach does not implement or use that interface. Instead use the Hurd interface directly. This is safe since the Hurd stubs are a super set of the gnumach stubs. Later, we won't need to install the gnumach stubs anymore through glibc. Message-Id: <ZC5WqPKfCCiE8D29@jupiter.tail36e24.ts.net>
2023-04-03Modernize code by removing use of old style definitions.Flavio Cruz
Also add -Werror=old-style-definition to enforce new code. Message-Id: <ZBZ+8xf7GHy2RT/h@jupiter.tail36e24.ts.net>
2023-01-02fsys_get_children: Fix double-free on errorSamuel Thibault
2023-01-02fsys_get_children: Fix comparing stringsSamuel Thibault
2023-01-02fsys_get_children: Fix memleak on errorSamuel Thibault
2023-01-01Fix accessing cred before checking it is non-NULLSamuel Thibault
2023-01-01libdiskfs: white-list fall-through in switchSamuel Thibault
2023-01-01make_peropen: Fix memory leaks on errorSamuel Thibault
2023-01-01fsys_get_children: Fix double-free on errorSamuel Thibault
2022-12-06Fix *printf specifier for user space mach ports.Flavio Cruz
mach_port_t are mach_port_name_t and thus require %u instead of %lu. Message-Id: <Y42RELMbulK4xaKM@reue>
2022-08-30libdiskfs: Add missing includeSamuel Thibault
2022-08-30libdiskfs: Avoid crashing when stdout/err shuts downv0.9.git20220830Samuel Thibault
stdout/err could shut down for whatever reason (killed the term on /dev/console or whatever). We should not crash just because we lost our ability to print output.
2022-08-29Fix types of read write and readables methodsEtienne Brateau
Message-Id: <20220829193617.13481-1-etienne.brateau@gmail.com>
2022-08-23file_exec: Homogeneize adding the gratuitous send rightSamuel Thibault
2022-08-10libnetfs, libtrivs: Shield S_file_exec_paths () from cancellationSergey Bugaev
Here's the sequence of events that leads to a bug: * A task calls file_exec_paths () on itself, holding the only send right to the protid, passing EXEC_NEWTASK (or EXEC_SECURE, which implies it). * S_file_exec_paths () calls exec_exec_paths () * The exec server sets up a new task and calls proc_reassign () or proc_reauthenticate_reassign (). * The proc server destroys the old task, and the only send right to the protid with it. * The translator gets a no-senders notification, which results in a ports_interrupt_rpcs () call on the S_file_exec_paths (). * This propagates to the exec server (and potentially proc and auth servers). * The exec gets canceled, and the new task gets killed. In my opinion, the party that seems most guilty is the translator canceling exec upon receiving a no-senders notification for the protid. Normally, a no-senders notification means that the caller is no longer interested in the RPC, but this is not true in case of exec. To work around this, create an additional send right to the protid.
2022-08-10libdiskfs, libnetfs: Disable broken codeSergey Bugaev
This logic is obviously broken, let's disable it for now.
2022-08-10diskfs: Use libports notificationsSergey Bugaev
Namely, ports_request_dead_name_notification () where we can, and the libports notify port when we have to pass it to libfshelp.
2022-08-10Do not cache the R/O proxySamuel Thibault
We cannot properly detect when to release the ro_proxy, so let's just not cache it.
2022-01-23typoSamuel Thibault
2022-01-20libdiskfs: improve asserts and remove a sign compare warningEtienne Brateau
Message-Id: <20220119192945.36654-4-etienne.brateau@gmail.com>
2022-01-17Fix const warningsSamuel Thibault
Now that the RPCs have const, this forces us cleaning our const-meant functions.
2022-01-16Make RPC input array parameters constSamuel Thibault
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
2022-01-01Fix build warningsSamuel Thibault
No actual behavior change.
2021-08-11libdiskfs: Flush node to disk before removing it from the cacheSamuel Thibault
libdiskfs' dosync goes through the cache to flush nodes to the disk. We thus have to flush a node to the disk before removing it from the cache in diskfs_try_dropping_softrefs.
2021-08-11bootstrap: Fix passing proc server from FS to rumpdiskSamuel Thibault
libdiskfs was passing its own proc port, thus confusing the fsys_init call in rumpdisk.
2021-04-11Call _hurd_libc_proc_init when availableSamuel Thibault
glibc 2.33 separated out _hurd_libc_proc_init from _hurd_init, so we have to additionally call it. * configure.ac (_hurd_libc_proc_init): Detect function. * libdiskfs/boot-start.c (diskfs_S_fsys_init): Call _hurd_libc_proc_init. * libmachdev/trivfs_server.c (trivfs_S_fsys_init): Call _hurd_libc_proc_init.