aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "rumpdisk: Use raw uncached character device rwdXd"Samuel Thibault2021-08-241-2/+2
| | | | | | This reverts commit 517edb7fe7c614a683e18671afc52de8cabe8fdf. It seems to be actually breaking access to the disk.
* rumpdisk: Ensure physical allocation of memory for DMA readsDamien Zammit2021-08-241-0/+3
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_read): Memset the buffer after allocating it.
* rumpdisk: Use raw uncached character device rwdXdDamien Zammit2021-08-241-2/+2
| | | | | | | | This disables the rump buffer cache and avoids any magic translation that rump would do. * rumpdisk/block-rump.c (translate_name): Use `/dev/r%sd' format instead of `/dev/%sd'.
* nfs/nfsd: Use libtirpcSamuel Thibault2021-08-229-8/+22
| | | | | | | | | | | | | Sun RPC is being phased out from glibc. * configure.ac: Detect libtirpc.pc, subst libtirpc_CFLAGS and libtirpc_LIBS. * config.make.in: Subst libtirpc_CFLAGS and libtirpc_LIBS. * nfs/Makefile, nfsd/Makefile: Include libtirpc_CFLAGS and libtirpc_LIBS * nfs/mount.c: Include <rpc/xdr.h> * nfsd/main.c: Likewise. * nfsd/ops.c: Likewise. * nfsd/cache.c: Undef TRUE/FALSE after including rpc/ headers. * nfsd/loop.c: Likewise.
* rumpdisk: Simplify allocating data for device_readSamuel Thibault2021-08-221-7/+7
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_read): Use vm_allocate/vm_deallocate instead of mmap/munmap.
* rumpdisk: Add missing deallocation in device_writeSamuel Thibault2021-08-221-0/+2
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_write): Call vm_deallocate after writing the data.
* mach-defpager: Fix error reportingSamuel Thibault2021-08-221-1/+1
| | | | * mach-defpager/main.c (main): After mlockall, report error from errno, not the value returned by mlockall.
* libstore: Detect device-based access overflowSamuel Thibault2021-08-161-4/+16
| | | | | | | | | 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.
* mach-defpager: Drop kalloc/kfreeSamuel Thibault2021-08-166-409/+65
| | | | | | | | | | | | 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.
* exec: Fix and use mask for memory layoutSamuel Thibault2021-08-161-20/+7
| | | | | | | 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.
* ext2fs: Disable an expensive checkSamuel Thibault2021-08-121-0/+4
| | | | | | 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.
* assert_*_backtrace: Tell the compiler that failures are unlikelySamuel Thibault2021-08-111-3/+3
|
* libdiskfs: Flush node to disk before removing it from the cacheSamuel Thibault2021-08-111-0/+4
| | | | | | 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.
* ext2fs: clear inline dataSamuel Thibault2021-08-111-0/+13
| | | | | 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.
* pci-arbiter, rumpdisk: Rename options for bootstrap chainSamuel Thibault2021-08-115-23/+23
| | | | | | | | 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.
* libmachdev: Fix startup_dosyncSamuel Thibault2021-08-116-31/+13
| | | | | | | 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.
* pci-arbiter: do not install as translator for nowSamuel Thibault2021-08-111-1/+1
| | | | | | 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.
* pci-arbiter: Use _SERVERS_BUS macroSamuel Thibault2021-08-111-1/+1
|
* bootstrap: Fix passing proc server from FS to rumpdiskSamuel Thibault2021-08-112-23/+29
| | | | | libdiskfs was passing its own proc port, thus confusing the fsys_init call in rumpdisk.
* rumpdisk: Make sure probe abort is printedSamuel Thibault2021-08-111-0/+2
|
* ext2fs: Fix block allocation on symlink->translator conversionSamuel Thibault2021-08-111-18/+19
| | | | | In diskfs_set_translator we need to truncate the existing node before allocating the block for the translator.
* ext2fs: clear data when setting a translator on a symlinkSamuel Thibault2021-08-111-0/+18
| | | | | | | e2fsck does not like seeing both blocks for the symlink and for the translation entry. This fixes the disappearance of /dev/urandom.
* startup: Fix double-free on bogus startup_essential_task callSamuel Thibault2021-08-101-4/+4
| | | | | | Returning an error will deallocate the RPC references. Reported-by: Sergey Bugaev <bugaevc@gmail.com>
* ext2fs: Fix getting filemap for forcing delayed copiesSamuel Thibault2021-08-101-1/+1
| | | | The delayed copy actually needs write access.
* Fix /proc/?/exe values for bootstrap processesDamien Zammit2021-07-112-16/+15
| | | | | | | 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>
* procfs: Fix use-after-freeSergey Bugaev2021-05-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* utils/ps.c: Don't limit output width to 80 on non-ttySergey Bugaev2021-05-181-0/+5
| | | | | | | | 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>
* settrans: get rid of translator that couldn't be attachedSergey Bugaev2021-05-081-1/+5
| | | | | * utils/settrans.c (main): When file_set_translator fails, make the just-started translator go away.
* libpager: pager_write_page () should not unmap pageSergey Bugaev2021-05-084-14/+12
| | | | | Clarify this in the documentation, and fix the storeio implementation. Message-Id: <20210508153144.332832-2-bugaevc@gmail.com>
* Revert "fshelp: Fix fetching control ports."Samuel Thibault2021-05-081-1/+5
| | | | | | | | | 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
* libpager: Properly zero-initialize pagemapSergey Bugaev2021-05-071-0/+2
| | | | | | Unlike mmap () and calloc (), reallocarray () does not automatically zero-fill the newly allocated memory. Do so explicitly. Message-Id: <CAN9u=Hd21Es7Kc4tVBAUeLaKo9CWKO1e577TqnXMzmmvwLi22Q@mail.gmail.com>
* libpager: Use libc heap for pagemapSergey Bugaev2021-05-072-19/+12
| | | | | | | | | 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>
* libpager: Fix overallocating pagemapSergey Bugaev2021-05-071-4/+5
| | | | | | | | 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>
* libpager: Store pagemapsize as vm_size_tSergey Bugaev2021-05-062-2/+2
| | | | | | 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>
* libpager: Do not flush in-core pages on offerSergey Bugaev2021-05-061-7/+0
| | | | | | | | | | | 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>
* libpager: Fix mixing up success and errorSergey Bugaev2021-05-061-13/+14
| | | | | | _pager_pagemap_resize () returns an error or 0 on success, not a boolean. Message-Id: <20210506125631.79117-2-bugaevc@gmail.com>
* fs.defs: Make dir_readder documentation clearerSamuel Thibault2021-04-241-1/+3
| | | | * hurd/fs.defs: make it clear that dir_readdir returns a series, not an array.
* libmachdev: Restore making machdev_trivfs_server blockingSamuel Thibault2021-04-153-24/+18
| | | | | | | | | | | | | | | 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().
* Fix typoSamuel Thibault2021-04-141-1/+1
| | | | | * libmachdev/trivfs_server.c (trivfs_S_fsys_init): Pass machdev_argv to _hurd_libc_proc_init, not diskfs_argv.
* Call _hurd_libc_proc_init when availableSamuel Thibault2021-04-113-0/+7
| | | | | | | | | | | 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.
* pci-arbiter: Fix --device-master-port option nameSamuel Thibault2021-04-051-1/+1
| | | | | | | for coherency with ext2fs and rumpdisk * pci-arbiter/options.h (options): Rename --dev-master-port option to --device-master-port option.
* libmachdev: Fix non-bootstrap translator startupSamuel Thibault2021-04-041-1/+14
| | | | | * libmachdev/trivfs_server.c (machdev_trivfs_init): Call fsys_getpriv only when bootstrapping.
* pci-arbiter: restore code that allows it to run non-bootstrapSamuel Thibault2021-04-043-10/+21
| | | | | | | | | | * 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.
* machdev: Pass argv through to _hurd_initDamien Zammit2021-04-044-7/+10
| | | | Message-Id: <20210404033750.143411-1-damien@zamaudio.com>
* pflocal: Make io_stat allocate inode idSamuel Thibault2021-04-031-1/+6
| | | | | | | 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.
* machdev: Fix parent proc passthrough in fsys_initDamien Zammit2021-03-191-5/+12
| | | | | | | | | | * 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>
* fsys_init: Document that the proc port is for the task itselfSamuel Thibault2021-03-191-1/+1
|
* Makeconf: Add missing vpathSamuel Thibault2021-03-161-0/+3
| | | | | * Makeconf (vpath): Add $(libdir)/ for libpthread.%, libbz2.%, and libz.%.
* Do not hardcode /libexec libexecdirSamuel Thibault2021-03-169-7/+187
| | | | | | | | | | | | | | | | 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.
* machdev,rump,pci: Rework bootstrapDamien Zammit2021-03-166-144/+86
| | | | | | | | | | | | | | | | | | | | | | | | | * 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>