aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ext2fs: fix invalid checkEtienne Brateau2022-01-181-2/+2
| | | | | | | log2_dev_block_per_fs_block is unsigned so it won’t never be less than 0 and the check is then always false. Instead check the two values directly before doing the substraction. Message-Id: <20220118211140.8837-1-etienne.brateau@gmail.com>
* Pass mach_task_self when deallocating INIT_PORT_CWDIRFlavio Cruz2022-01-171-1/+1
| | | | Message-Id: <YeXBjT8t777b8+AF@viriathus>
* Fix const warningsSamuel Thibault2022-01-1769-247/+250
| | | | | Now that the RPCs have const, this forces us cleaning our const-meant functions.
* Make RPC input array parameters constSamuel Thibault2022-01-1693-301/+301
| | | | | This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
* pci-arbiter: Pave the way for installing the bootstrap pci-arbiter on ↵Samuel Thibault2022-01-091-1/+2
| | | | /servers/bus/pci
* pci-arbiter: Stop using deprecated region memory pointerJoan Lledó2022-01-085-11/+31
| | | | | | | | | | | | | | | | | | | Use a internal array of pointers instead * pci-arbiter/device_map.h: * Update device_map_region() prototype * Now it receives an output address as parameter * pci-arbiter/device_map.c: * Update device_map_region() definition to match the new prototype * Support for legacy mappings * When the base address is lower than 1 mb * pci-arbiter/func_files.c: * pci-arbiter/netfs_impl.c: * Update calls to device_map_region to match the new prototype * Use the internal array of pointers instead of region->memory * pci-arbiter/pcifs.h: * struct pcifs_dirent: Declare the internal array of pointers Message-Id: <20220108121537.6277-2-jlledom@mailfence.com>
* term: Make sure to have ttydefchars use the proper _POSIX_VDISABLESamuel Thibault2022-01-071-0/+1
| | | | | | For <sys/ttydefaults.h> to catch the proper value of _POSIX_VDISABLE, <unistd.h> has to be included before it. <termios.h> happens to be including it so we have to include <unistd.h> before that.
* portinfo: Do not compare port to anything when it is MACH_PORT_DEADSamuel Thibault2022-01-041-1/+4
| | | | | Otherwise it would successfully compare to any port that happens to be MACH_PORT_DEAD, e.g. the bootstrap port.
* portinfo: Use benign RPCs to discover what ports are all aboutSamuel Thibault2022-01-041-26/+419
| | | | | | | | Most servers have at least one RPC which is benign enough to be used to identify whether a port supports the server and provides some useful information to identify what the port is about. This adds support for most of these, allowing to identify auth ports, file descriptors, sockets, etc.
* login: More port leaks fixesSamuel Thibault2022-01-041-2/+9
| | | | | | ports[INIT_PORT_CRDIR] and [INIT_PORT_CWDIR] were obtained from getcrdir() and getcwdir(), so a referenced needs to be released when replacing them.
* Fix leaking auth portsSamuel Thibault2022-01-046-10/+40
| | | | | | | | | | | We need to be extremely careful with auth ports since leaking them into subprocesses may expose a root-auth port to non-root processes. Notably, get_nonsugid_ids was caching it, thus preventing glibc's exec implementation from dropping it. Login is also reimplementing hurdexec but without all the cloexec logic. This commit fixes various auth leaks.
* Fix build warningsSamuel Thibault2022-01-0149-92/+104
| | | | No actual behavior change.
* pfinet: Fix IPV6 option valuesSamuel Thibault2022-01-011-2/+8
| | | | | pfinet is providing the RFC2292 IPv6 options interface, not the RFC3542 interface, so we have to use the old option numbers here.
* random: export __trivfs_server_nameSamuel Thibault2022-01-012-0/+4
| | | | | Making glibc access trivfs_server_name would violate namespace constraints, so we need to use a out-of-standard name.
* random: try opening time from gnumach before from /dev/timeSamuel Thibault2021-12-311-2/+2
| | | | | | | The system-wide random translator can access time from gnumach, while /dev/time comes from storeio, and its libc initialization (starting from glibc 2.34) uses /dev/random, which was thus bringing an initialization loop.
* random: Add a trivfs_server_nameSamuel Thibault2021-12-303-1/+18
| | | | | | | glibc uses /dev/urandom for getrandom(), and from version 2.34 malloc initialization uses it. We need to be able to know whether we are running the random translator itself, in which case we can't read ourself.
* exec: only constraint loading the ELF interpreterSamuel Thibault2021-12-301-7/+7
| | | | | PIE programs do not need bitmask constraints, only the ELF interpreter needs to leave room for a non-PIE program.
* libtrivfs: Fix static link of the random translatorSamuel Thibault2021-12-301-2/+2
| | | | It needs to override trivfs_S_io_select.
* wire_task_self: Use in various translatorsSamuel Thibault2021-12-305-84/+6
| | | | | | wire_task_self() was duplicating mach-defpager's wire_all_memory(), we can just make mach-defpager now use the former (and not mlockall either). Also pci-arbiter and rumpdisk can use it.
* wire_task_self: Simplify implementationSamuel Thibault2021-12-301-83/+1
| | | | | | | | In the dynamic case, loaded() doesn't actually manage to get maps, and in the static case the _start, _etext, __data_start, _edata symbols are not actually precise, and miss some pages. So let's just call wire_segment_internal on the whole addressing space, vm_region tells us which parts are actually mapped to make it efficient enough.
* libshouldbeinlibc: Add backtrace_stderr and backtrace_machSamuel Thibault2021-12-292-2/+41
| | | | as convenience for printing a backtrace without erroring out.
* rumpdisk: Link with rumpvfs_nofifofs if presentDamien Zammit2021-12-283-3/+37
| | | | Message-Id: <20211228055114.173039-1-damien@zamaudio.com>
* rumpdisk: Use raw uncached character device rwdXdDamien Zammit2021-12-271-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'. Message-Id: <20211226113857.150525-4-damien@zamaudio.com>
* rumpdisk: Fault-in the memory pagesDamien Zammit2021-12-271-2/+12
| | | | | | This ensures memory pages are allocated before written to. Message-Id: <20211226113857.150525-6-damien@zamaudio.com>
* pci-arbiter,rumpdisk: Lock all memory for swappingDamien Zammit2021-12-272-0/+17
| | | | | | | 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>
* rumpdisk: define _STANDALONE to avoid register_tDamien Zammit2021-12-271-0/+1
| | | | | | | 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>
* pci-arbiter: Implement memory mapping over region filesJoan Lledó2021-12-255-12/+124
| | | | | | | | | | | | | | | | | | | * 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>
* libnetfs: Implement RPC: io_mapMarcus Brinkmann2021-12-251-3/+43
| | | | | * libnetfs/iostubs.c: implement io_map Message-Id: <20211219112647.11512-3-jlledom@mailfence.com>
* libnetfs: new user callback: netfs_get_filemap()Joan Lledó2021-12-253-1/+37
| | | | | | | | | | 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>
* Add "comm" as a format spec to psAndrea Monaco2021-12-081-0/+13
| | | | | 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).
* acpi: Factorize codeAndrea Monaco2021-11-211-8/+5
| | | | * acpi/acpi.c (acpi_get_tables): Factorize code.
* acpi: Unignore some mmap failureAndrea Monaco2021-11-211-0/+5
| | | | * acpi/acpi.c (acpi_get_num_tables): Do not ignore mmap failure.
* acpi: Fix spurious munmap callAndrea Monaco2021-11-211-2/+0
| | | | | * 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.
* acpi: remove useless code in acpi.cAndrea Monaco2021-11-181-4/+0
| | | | | | | These were writing to an array and then never using it. Maybe they were useful for debugging. Message-Id: <87sfvtmn6r.fsf@autistici.org>
* console: fix listing of directory in netfs_get_direntsAndrea Monaco2021-11-111-5/+10
| | | | | | | | | | | | | | | 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.
* libnetfs: document return value of netfs_startupAndrea Monaco2021-10-301-1/+2
| | | | * libnetfs/netfs.h: Ditto.
* libdirmgt: remove empty librarySamuel Thibault2021-10-163-77/+0
| | | | * libdirmgt: Remove directory.
* libtreefs: remove unfinished and unused codeSamuel Thibault2021-10-1326-3595/+1
| | | | * libtreefs: Remove directory.
* configure: Allow libtirpc to be missingSamuel Thibault2021-08-241-1/+1
| | | | | | | 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.
* 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.