summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-08-16libstore: Detect device-based access overflowSamuel Thibault
recnum_t is 32bit while offsets are 64bit. We need to detect the otherwise-silent truncation of the address. This happens here at 2TiB for 512-byte sectors. * libstore/device.c (dev_read, dev_write): Return EOVERFLOW on addresses that are larger than what the device interface can handle.
2021-08-16mach-defpager: Drop kalloc/kfreeSamuel Thibault
glibc is removing its malloc hooks, but gnumach now has support for mlockall, which we can just use instead of kalloc/kfree. * mach-defpager/main.c (main): Call mlockall. * mach-defpager/kalloc.c: Remove. * mach-defpager/kalloc.h: Remove. * mach-defpager/default_pager.c: Use malloc/free instead of kalloc/kfree. * mach-defpager/setup.c: Likewise.
2021-08-16exec: Fix and use mask for memory layoutSamuel Thibault
Gnumach's 0650a4ee30e3 implements support for high bits being set in the mask parameter of vm_map. This allowed to remove the rmh kludge in the dynamic linker. Exec now can and should use the mask for excluding parts of the memory layout.
2021-08-12ext2fs: Disable an expensive checkSamuel Thibault
disk_cache_block_is_ref calls hurd_ihash_find which is very expensive, so better disable the checks from record_global_poke and record_indir_poke unless building a debugging version.
2021-08-11assert_*_backtrace: Tell the compiler that failures are unlikelySamuel Thibault
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-11ext2fs: clear inline dataSamuel Thibault
When truncating a node with inline data, it's safer to really frob the inline data, to make sure ext2fs does not wrongly interprete it as block numbers.
2021-08-11pci-arbiter, rumpdisk: Rename options for bootstrap chainSamuel Thibault
We may end up with an arbitrary series of bootstrap translators, which can know about each other through devices, and thus do not need any particular order except dependencies. The actual bootstrap order can thus be arbitrary (provided it respects dependencies), so better not hardcode it.
2021-08-11libmachdev: Fix startup_dosyncSamuel Thibault
We do not actually want to shut everything down. For instance, we still have to be able to start the acpi translator to perform the actual shutdown. What we however have to do is syncing the disks.
2021-08-11pci-arbiter: do not install as translator for nowSamuel Thibault
machdev installs the trivfs translator, not the netfs translator, and thus pci-arbiter would only show up as the pci device, not the pci filesystem.
2021-08-11pci-arbiter: Use _SERVERS_BUS macroSamuel Thibault
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-08-11rumpdisk: Make sure probe abort is printedSamuel Thibault
2021-08-11ext2fs: Fix block allocation on symlink->translator conversionSamuel Thibault
In diskfs_set_translator we need to truncate the existing node before allocating the block for the translator.
2021-08-11ext2fs: clear data when setting a translator on a symlinkv0.9.git20210811Samuel Thibault
e2fsck does not like seeing both blocks for the symlink and for the translation entry. This fixes the disappearance of /dev/urandom.
2021-08-10startup: Fix double-free on bogus startup_essential_task callSamuel Thibault
Returning an error will deallocate the RPC references. Reported-by: Sergey Bugaev <bugaevc@gmail.com>
2021-08-10ext2fs: Fix getting filemap for forcing delayed copiesSamuel Thibault
The delayed copy actually needs write access.
2021-07-11Fix /proc/?/exe values for bootstrap processesDamien Zammit
This makes libmachdev follow the exec case, and make sure to be waiting for all bootstrap processes by waiting for the FS process. Message-Id: <20210711012042.77920-1-damien@zamaudio.com>
2021-05-24procfs: Fix use-after-freeSergey Bugaev
Fix several issues with reference counting in rootdir_make_translated_node (): * Grab an additional reference while still holding the lock. * Give the node an additional reference for being pointed to by the ops. * Reference the existing node if we find it on the second try, not only if we find it on the first try. * Dereference, not just clean, the created node if it turns out to be unneeded. Fixes a crash with the following backtrace: #2 0x010855c8 in __assert_fail_backtrace ( assertion=0x1051148 "! (r.hard == 1 && r.weak == 0) || !\"refcount detected use-after-free!\"", file=0x1050cec "../../libshouldbeinlibc/refcount.h", line=170, function=0x1051220 <__PRETTY_FUNCTION__.3> "refcounts_ref") at ../../libshouldbeinlibc/assert-backtrace.c:64 #3 0x01050358 in refcounts_ref (result=0x0, ref=0x15009a0) at ../../libshouldbeinlibc/refcount.h:170 #4 netfs_nref (np=0x15008f0) at ../../libnetfs/nref.c:26 #5 0x0804c9f4 in rootdir_make_translated_node (dir_hook=0x10001990, entry_hook=0x8055180 <__compound_literal.8>) at ../../procfs/rootdir.c:674 #6 0x0804ace3 in procfs_dir_lookup (hook=0x10001c10, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/procfs_dir.c:88 #7 0x0804a410 in procfs_lookup (np=0x10001c40, name=0x2857efc "mounts", npp=0x2855d68) at ../../procfs/procfs.c:185 #8 0x0804cae5 in dircat_lookup (hook=0x10001d50, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/dircat.c:76 #9 0x0804a410 in procfs_lookup (np=0x10001d80, name=0x2857efc "mounts", npp=0x2855d68) at ../../procfs/procfs.c:185 #10 0x0804a96f in netfs_attempt_lookup (user=0x1401c60, dir=0x10001d80, name=0x2857efc "mounts", np=0x2855d68) at ../../procfs/netfs.c:212 #11 0x0103fd5b in netfs_S_dir_lookup (dircred=<optimized out>, filename=<optimized out>, flags=<optimized out>, mode=<optimized out>, do_retry=<optimized out>, retry_name=<optimized out>, retry_port=<optimized out>, retry_port_type=<optimized out>) at ../../libnetfs/dir-lookup.c:175 Message-Id: <20210524154340.264885-2-bugaevc@gmail.com>
2021-05-18utils/ps.c: Don't limit output width to 80 on non-ttySergey Bugaev
If no output width limit has been set explicitly, and we're not printing to a tty, do not limit output width. In particular, this fixes grepping ps output. Message-Id: <20210518122150.1490468-1-bugaevc@gmail.com>
2021-05-08settrans: get rid of translator that couldn't be attachedSergey Bugaev
* utils/settrans.c (main): When file_set_translator fails, make the just-started translator go away.
2021-05-08libpager: pager_write_page () should not unmap pageSergey Bugaev
Clarify this in the documentation, and fix the storeio implementation. Message-Id: <20210508153144.332832-2-bugaevc@gmail.com>
2021-05-08Revert "fshelp: Fix fetching control ports."Samuel Thibault
This reverts commit 7b9011628ec0dea3e01b19b75013ce5cf5b9c841. We do want to release dead names, and not report the KERN_INVALID_RIGHT error, just return that there is no translator any more. As suggested by Sergey Bugaev
2021-05-07libpager: Properly zero-initialize pagemapSergey Bugaev
Unlike mmap () and calloc (), reallocarray () does not automatically zero-fill the newly allocated memory. Do so explicitly. Message-Id: <CAN9u=Hd21Es7Kc4tVBAUeLaKo9CWKO1e577TqnXMzmmvwLi22Q@mail.gmail.com>
2021-05-07libpager: Use libc heap for pagemapSergey Bugaev
libc already implements the functionality for allocating and managing memory blocks like the pagemap. Using libc functions gives us some additional niceties like overflow checking in reallocarray (). it also means that we will not allocate a whole page of memory if we need to store just a few integers. Message-Id: <20210506125631.79117-7-bugaevc@gmail.com>
2021-05-07libpager: Fix overallocating pagemapSergey Bugaev
The code tried to round up the allocation size to a multiple of page size. But we actually allocate newsize * sizeof (*p->pagemap) bytes, not newsize bytes, which meant allocations were sizeof (*p->pagemap) times larger than they needed to be. Message-Id: <20210506125631.79117-6-bugaevc@gmail.com>
2021-05-06libpager: Store pagemapsize as vm_size_tSergey Bugaev
On a 64-bit system, there can be a lot more pages than a 32-bit int can fit. Message-Id: <20210506125631.79117-5-bugaevc@gmail.com>
2021-05-06libpager: Do not flush in-core pages on offerSergey Bugaev
pager_offer_page () is documented to may ignore the offered page if the kernel already has a copy in core (indeed, that's what Mach does). However the current behavior is the inverse of that: it asks the kernel to flush (i.e. drop) its in-core copy, and replace it with the offered one. Fix this by not doing that, and calling memory_object_data_supply () directly. Message-Id: <20210506125631.79117-3-bugaevc@gmail.com>
2021-05-06libpager: Fix mixing up success and errorSergey Bugaev
_pager_pagemap_resize () returns an error or 0 on success, not a boolean. Message-Id: <20210506125631.79117-2-bugaevc@gmail.com>
2021-04-24fs.defs: Make dir_readder documentation clearerSamuel Thibault
* hurd/fs.defs: make it clear that dir_readdir returns a series, not an array.
2021-04-15libmachdev: Restore making machdev_trivfs_server blockingSamuel Thibault
netdde actually needs to control which thread runs the trivfs server, for managing per-thread state etc. Only pci-arbiter needs to run machdev_trivfs_server non-blockingly, it can create a thread by itself. * libmachdev/trivfs_server.c (machdev_trivfs_loop): Move back muxer loop to... (machdev_trivfs_server): ... here. * pci-arbiter/main.c (main): Run machdev_trivfs_server in its own thread. * rumpdisk/main.c (main): Do not call pthread_exit().
2021-04-14Fix typoSamuel Thibault
* libmachdev/trivfs_server.c (trivfs_S_fsys_init): Pass machdev_argv to _hurd_libc_proc_init, not diskfs_argv.
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.
2021-04-05pci-arbiter: Fix --device-master-port option nameSamuel Thibault
for coherency with ext2fs and rumpdisk * pci-arbiter/options.h (options): Rename --dev-master-port option to --device-master-port option.
2021-04-04libmachdev: Fix non-bootstrap translator startupSamuel Thibault
* libmachdev/trivfs_server.c (machdev_trivfs_init): Call fsys_getpriv only when bootstrapping.
2021-04-04pci-arbiter: restore code that allows it to run non-bootstrapSamuel Thibault
* pci-arbiter/pcifs.h (init_root_node): Restore underlying_node parameter. * pci-arbiter/pcifs.c (underlying_stat): Drop global variable. (init_root_node): Restore getting the stat from the underlying node. * pci-arbiter/main.c (main): Restore calling netfs_startup in non-bootstrap case, and pass underlying node to init_root_node. Only call pcifs_startup in bootstrap case.
2021-04-04machdev: Pass argv through to _hurd_initv0.9.git20210404Damien Zammit
Message-Id: <20210404033750.143411-1-damien@zamaudio.com>
2021-04-03pflocal: Make io_stat allocate inode idSamuel Thibault
We may not have io_identity called before io_stat, and programs like diff rely on inode numbers being different for different files. * pflocal/io.c (S_io_stat): Allocate socket id if not already allocated.
2021-03-19machdev: Fix parent proc passthrough in fsys_initDamien Zammit
* libmachdev/trivfs_server.c (parent_task): New global variable. (machdev_trivfs_init): Remove parent_task local variable. (trivfs_S_fsys_init): Pass parent's proc port to fsys_init call. Accept EPERM error from proc_mark_important for bootstrap case. Check errors from proc_set_exe call. Message-Id: <20210319021512.823541-1-damien@zamaudio.com>
2021-03-19fsys_init: Document that the proc port is for the task itselfSamuel Thibault
2021-03-16Makeconf: Add missing vpathSamuel Thibault
* Makeconf (vpath): Add $(libdir)/ for libpthread.%, libbz2.%, and libz.%.
2021-03-16Do not hardcode /libexec libexecdirSamuel Thibault
So that distributions can use the --libexecdir configure parameter. * configure.ac (AC_CONFIG_FILES): Add daemons/runsystem.hurd.sh. * config/ttys: Rename to ttys.in, replace /libexec with @libexecdir@. * config/Makefile (ttys): Generate from ttys.in * daemons/runsystem.hurd.sh.in (prefix): Define to @prefix@. (exec_prefix): Define to @exec_prefix@. (RUNCOM, RUNTTYS): Replace /libexec with @libexecdir@. * init/Makefile (init-CPPFLAGS): Define LIBEXECDIR. * init/init.c (main): Use LIBEXECDIR instead of hardcoding /libexec. * startup/Makefile (startup-CPPFLAGS): Define LIBEXECDIR. * startup/startup.c (start_child, launch_something): Use LIBEXECDIR instead of hardcoding /libexec.
2021-03-16machdev,rump,pci: Rework bootstrapDamien Zammit
* libmachdev/trivfs_server.c (bootstrapped): Rename to bootstrapping. (trivfs_S_fsys_startup): Call fsys_startup on the bootstrap port. (essential_task): New function. (trivfs_S_fsys_init): Call fsys_init on the bootstrap port. Configure proc. Mark us as essential when bootstrapping even without a devnode. (arrange_shutdown_notification): Do not configure proc. (machdev_trivfs_init): Always get the bootstrap port from the kernel, leave it MACH_PORT_NULL if unavailable. Call fsys_getpriv on it if it is. * pci-arbiter/Makefile (SRCS): Remove startup.c. * pci-arbiter/startup.c: Delete file. * pci-arbiter/startup.h: Delete file. * pci-arbiter/main.c: Do not include "startup.h" (pci_device_shutdown): Do not try to lokup the dosync_handle. (pcifs_startup): Always create the pci_control_port right on the control port. (main): Call machdev_device_init after machdev_trivfs_init. Do not call arrange_shutdown_notification. * rumpdisk/main.c (netfs_server_name): Don't pretend to be the arbiter anymore (main): Call machdev_device_init after machdev_trivfs_init. Message-Id: <20210316054715.788725-1-damien@zamaudio.com>
2021-03-13Document fsys_getpriv and fsys_init RPCsSamuel Thibault
2021-03-08pci-arbiter: Introduce machdev into this serverDamien Zammit
* pci-arbiter/Makefile Add machdev lib and simplify * pci-arbiter/main.c (pci_device_{open,close,shutdown}): New methods (netfs_server_func): Thread the demuxer loop (pcifs_startup): Custom startup method (main): Use machdev for server and detach worker threads * pci-arbiter/options.{c,h} Add disk-server-task and priv ports * pci-arbiter/startup-ops.c Delete file Message-Id: <20210308130457.693821-4-damien@zamaudio.com>
2021-03-08acpi, pci-arbiter: Fix get_direntsDamien Zammit
* acpi/netfs_impl.c (get_dirents): Fix computing number of elements to be returned. Simplify computing the data size. * pci-arbiter/netfs_impl.c (get_dirents): Likewise. (netfs_get_dirents): Fix passing max_data_len rather than max_entries a second time.
2021-03-07libmachdev: pass shutdown handle to shutdown methodDamien Zammit
* libmachdev/machdev-device_emul.h (struct machdev_device_emulation_ops): Add shutdown method. * libmachdev/ds_routines.c (machdev_device_shutdown): Take dosync_handle handle and pass it to shutdown method. * libmachdev/machdev.h (machdev_device_shutdown): Update prototype. * libmachdev/trivfs_server.c (S_startup_dosync): Pass shutdown handle to machdev_device_shutdown call. * rumpdisk/block-rump.c (rumpdisk_device_shutdown): Take dosync_handle parameter.
2021-03-07pci-arbiter: Accept not having an underlying node.Damien Zammit
* pci-arbiter/pcifs.c (underlying_stat): New variable. (init_file_system): When underlying_node is nul, use the underlying_stat content.
2021-03-07TypoDamien Zammit
* pci-arbiter/pci-ops.c: Fix typo in comment.
2021-03-02rumpdisk: Let server threads runDamien Zammit
* rumpdisk/main.c (main): Call pthread_exit(NULL) to let server threads continue.