summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-12-30utils/queryauth.sh utils/queryauth-setup.sh: add checkperms helperscheckperm-deferred-authorizationArne Babenhauserheide
- setup FIFOs for USER and GROUP if not existing - only check for translators if file exists - create the group if needed
2021-12-29trans/checkperms.c: add deferred authorization translatorArne Babenhauserheide
Setup the translator: echo HELLOWORLD > /hello && \ settrans -cga /hello $(realpath ~/Dev/hurd/trans/checkperms) --groupname=user Create the FIFOs: USER=root GROUP=user mkdir -p /run/$USER/request-permission mkdir -p /run/$USER/grant-permission mkfifo /run/$USER/request-permission/$GROUP mkfifo /run/$USER/grant-permission/$GROUP Setup the permission-granting program in a separate shell: USER=root GROUP=user while true; do PID="$(cat /run/$USER/request-permission/$GROUP)" echo Process $PID tries to access file /hello but is not in the required group $GROUP. ps-hurd -p $PID -aeux if [[ "$(read -e -p 'Grant permission and add group "'$GROUP'" for 5 minutes? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then addauth -p $PID -g $GROUP echo 0 > /run/$USER/grant-permission/$GROUP (sleep 300 && rmauth -p $PID -g $GROUP 2>/dev/null) & else echo 1 > /run/$USER/grant-permission/$GROUP fi done Access the translator as user without the required group and with the group: su - user --shell /bin/bash -c 'cat /hello' cat /hello & # accept the request in the permission granting program
2021-12-29libshouldbeinlibc: Add backtrace_stderr and backtrace_machSamuel Thibault
as convenience for printing a backtrace without erroring out.
2021-12-28rumpdisk: Link with rumpvfs_nofifofs if presentDamien Zammit
Message-Id: <20211228055114.173039-1-damien@zamaudio.com>
2021-12-27rumpdisk: Use raw uncached character device rwdXdDamien Zammit
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'. Message-Id: <20211226113857.150525-4-damien@zamaudio.com>
2021-12-27rumpdisk: Fault-in the memory pagesDamien Zammit
This ensures memory pages are allocated before written to. Message-Id: <20211226113857.150525-6-damien@zamaudio.com>
2021-12-27pci-arbiter,rumpdisk: Lock all memory for swappingDamien Zammit
This locks all memory in bootstrap processes so that disk driver dependencies don't get swapped out. Message-Id: <20211226113857.150525-5-damien@zamaudio.com>
2021-12-27rumpdisk: define _STANDALONE to avoid register_tDamien Zammit
This works around a faulty HAVE_REGISTER_T in rump so the rump.h header can be included without errors. Message-Id: <20211226113857.150525-2-damien@zamaudio.com>
2021-12-25pci-arbiter: Implement memory mapping over region filesJoan Lledó
* pci-arbiter/Makefile: * Add device_map.c to sources * pci-arbiter/device_map.c: * pci-arbiter/device_map.h: * New module for device mapping * Relies on libpciaccess mapping methods * pci-arbiter/func_files.c: * io_region_file(): Use the new device mapping module * pci-arbiter/netfs_impl.c: * Implements netfs_get_filemap(): * Uses the device mapping module to map the region to the arbiter space * Calls the kernel RPC vm_region_create_proxy() to obtain the memory object proxy * Only region files are mapped for now Message-Id: <20211219112647.11512-4-jlledom@mailfence.com>
2021-12-25libnetfs: Implement RPC: io_mapMarcus Brinkmann
* libnetfs/iostubs.c: implement io_map Message-Id: <20211219112647.11512-3-jlledom@mailfence.com>
2021-12-25libnetfs: new user callback: netfs_get_filemap()Joan Lledó
Provide the user with a new callback so they can implement file mapping over file system nodes. * libnetfs/netfs.h: Add prototype for netfs_get_filemap * libnetfs/file-map.c: netfs_get_filemap definition * libnetfs/Makefile: add file-map.c to sources Message-Id: <20211224172132.15058-2-jlledom@mailfence.com>
2021-12-08Add "comm" as a format spec to psAndrea Monaco
comm was not recognized by Hurd's ps as a format spec, but is required by POSIX to display the command name (like "exe", but without the full path).
2021-11-21acpi: Factorize codeAndrea Monaco
* acpi/acpi.c (acpi_get_tables): Factorize code.
2021-11-21acpi: Unignore some mmap failureAndrea Monaco
* acpi/acpi.c (acpi_get_num_tables): Do not ignore mmap failure.
2021-11-21acpi: Fix spurious munmap callAndrea Monaco
* acpi/acpi.c (acpi_get_num_tables, acpi_get_tables): Munmap is not needed, because when mmap_phys_acpi_header returns non-zero, no mmap is performed.
2021-11-18acpi: remove useless code in acpi.cAndrea Monaco
These were writing to an array and then never using it. Maybe they were useful for debugging. Message-Id: <87sfvtmn6r.fsf@autistici.org>
2021-11-11console: fix listing of directory in netfs_get_direntsAndrea Monaco
Listing /dev/vcs which is translated by /hurd/console gives the following: $ ls /dev/vcs ls: reading directory '/dev/vcs': Invalid argument 1 2 3 4 5 6 That error is probably harmless but annoying. It is caused by netfs_get_dirents the last time it is called during listing, because it calls mmap with size = 0. * console/console.c (netfs_get_dirents): Do not call mmap when size is 0.
2021-10-30libnetfs: document return value of netfs_startupAndrea Monaco
* libnetfs/netfs.h: Ditto.
2021-10-16libdirmgt: remove empty librarySamuel Thibault
* libdirmgt: Remove directory.
2021-10-13libtreefs: remove unfinished and unused codeSamuel Thibault
* libtreefs: Remove directory.
2021-08-24configure: Allow libtirpc to be missingSamuel Thibault
The dependency on libtirpc is already optional in the Makefiles, we do not need to fail configure when it is missing. * configure.ac: Do not fail when libtirpc is not available.
2021-08-24Revert "rumpdisk: Use raw uncached character device rwdXd"Samuel Thibault
This reverts commit 517edb7fe7c614a683e18671afc52de8cabe8fdf. It seems to be actually breaking access to the disk.
2021-08-24rumpdisk: Ensure physical allocation of memory for DMA readsDamien Zammit
* rumpdisk/block-rump.c (rumpdisk_device_read): Memset the buffer after allocating it.
2021-08-24rumpdisk: Use raw uncached character device rwdXdDamien Zammit
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'.
2021-08-22nfs/nfsd: Use libtirpcSamuel Thibault
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.
2021-08-22rumpdisk: Simplify allocating data for device_readSamuel Thibault
* rumpdisk/block-rump.c (rumpdisk_device_read): Use vm_allocate/vm_deallocate instead of mmap/munmap.
2021-08-22rumpdisk: Add missing deallocation in device_writeSamuel Thibault
* rumpdisk/block-rump.c (rumpdisk_device_write): Call vm_deallocate after writing the data.
2021-08-22mach-defpager: Fix error reportingSamuel Thibault
* mach-defpager/main.c (main): After mlockall, report error from errno, not the value returned by mlockall.
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>